1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate gtype;
26extern crate lazy_static;
27extern crate location;
28extern crate longrunning;
29extern crate lro;
30extern crate reqwest;
31extern crate rpc;
32extern crate serde;
33extern crate serde_json;
34extern crate serde_with;
35extern crate std;
36extern crate tracing;
37extern crate wkt;
38
39mod debug;
40mod deserialize;
41mod serialize;
42
43#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct Barcode {
47 pub format: std::string::String,
65
66 pub value_format: std::string::String,
83
84 pub raw_value: std::string::String,
87
88 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
89}
90
91impl Barcode {
92 pub fn new() -> Self {
93 std::default::Default::default()
94 }
95
96 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98 self.format = v.into();
99 self
100 }
101
102 pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
104 self.value_format = v.into();
105 self
106 }
107
108 pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
110 self.raw_value = v.into();
111 self
112 }
113}
114
115impl wkt::message::Message for Barcode {
116 fn typename() -> &'static str {
117 "type.googleapis.com/google.cloud.documentai.v1.Barcode"
118 }
119}
120
121#[derive(Clone, Default, PartialEq)]
126#[non_exhaustive]
127pub struct Document {
128 pub docid: std::string::String,
130
131 pub mime_type: std::string::String,
134
135 pub text: std::string::String,
137
138 #[deprecated]
142 pub text_styles: std::vec::Vec<crate::model::document::Style>,
143
144 pub pages: std::vec::Vec<crate::model::document::Page>,
148
149 pub entities: std::vec::Vec<crate::model::document::Entity>,
155
156 pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
161
162 pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
169
170 pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
173
174 pub error: std::option::Option<rpc::model::Status>,
176
177 pub revisions: std::vec::Vec<crate::model::document::Revision>,
179
180 pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
182
183 pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
185
186 pub entity_validation_output:
189 std::option::Option<crate::model::document::EntityValidationOutput>,
190
191 pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
195
196 pub entities_revision_id: std::string::String,
202
203 pub source: std::option::Option<crate::model::document::Source>,
205
206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
207}
208
209impl Document {
210 pub fn new() -> Self {
211 std::default::Default::default()
212 }
213
214 pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
216 self.docid = v.into();
217 self
218 }
219
220 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
222 self.mime_type = v.into();
223 self
224 }
225
226 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
228 self.text = v.into();
229 self
230 }
231
232 #[deprecated]
234 pub fn set_text_styles<T, V>(mut self, v: T) -> Self
235 where
236 T: std::iter::IntoIterator<Item = V>,
237 V: std::convert::Into<crate::model::document::Style>,
238 {
239 use std::iter::Iterator;
240 self.text_styles = v.into_iter().map(|i| i.into()).collect();
241 self
242 }
243
244 pub fn set_pages<T, V>(mut self, v: T) -> Self
246 where
247 T: std::iter::IntoIterator<Item = V>,
248 V: std::convert::Into<crate::model::document::Page>,
249 {
250 use std::iter::Iterator;
251 self.pages = v.into_iter().map(|i| i.into()).collect();
252 self
253 }
254
255 pub fn set_entities<T, V>(mut self, v: T) -> Self
257 where
258 T: std::iter::IntoIterator<Item = V>,
259 V: std::convert::Into<crate::model::document::Entity>,
260 {
261 use std::iter::Iterator;
262 self.entities = v.into_iter().map(|i| i.into()).collect();
263 self
264 }
265
266 pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
268 where
269 T: std::iter::IntoIterator<Item = V>,
270 V: std::convert::Into<crate::model::document::EntityRelation>,
271 {
272 use std::iter::Iterator;
273 self.entity_relations = v.into_iter().map(|i| i.into()).collect();
274 self
275 }
276
277 pub fn set_text_changes<T, V>(mut self, v: T) -> Self
279 where
280 T: std::iter::IntoIterator<Item = V>,
281 V: std::convert::Into<crate::model::document::TextChange>,
282 {
283 use std::iter::Iterator;
284 self.text_changes = v.into_iter().map(|i| i.into()).collect();
285 self
286 }
287
288 pub fn set_shard_info<T>(mut self, v: T) -> Self
290 where
291 T: std::convert::Into<crate::model::document::ShardInfo>,
292 {
293 self.shard_info = std::option::Option::Some(v.into());
294 self
295 }
296
297 pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
299 where
300 T: std::convert::Into<crate::model::document::ShardInfo>,
301 {
302 self.shard_info = v.map(|x| x.into());
303 self
304 }
305
306 pub fn set_error<T>(mut self, v: T) -> Self
308 where
309 T: std::convert::Into<rpc::model::Status>,
310 {
311 self.error = std::option::Option::Some(v.into());
312 self
313 }
314
315 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
317 where
318 T: std::convert::Into<rpc::model::Status>,
319 {
320 self.error = v.map(|x| x.into());
321 self
322 }
323
324 pub fn set_revisions<T, V>(mut self, v: T) -> Self
326 where
327 T: std::iter::IntoIterator<Item = V>,
328 V: std::convert::Into<crate::model::document::Revision>,
329 {
330 use std::iter::Iterator;
331 self.revisions = v.into_iter().map(|i| i.into()).collect();
332 self
333 }
334
335 pub fn set_document_layout<T>(mut self, v: T) -> Self
337 where
338 T: std::convert::Into<crate::model::document::DocumentLayout>,
339 {
340 self.document_layout = std::option::Option::Some(v.into());
341 self
342 }
343
344 pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
346 where
347 T: std::convert::Into<crate::model::document::DocumentLayout>,
348 {
349 self.document_layout = v.map(|x| x.into());
350 self
351 }
352
353 pub fn set_chunked_document<T>(mut self, v: T) -> Self
355 where
356 T: std::convert::Into<crate::model::document::ChunkedDocument>,
357 {
358 self.chunked_document = std::option::Option::Some(v.into());
359 self
360 }
361
362 pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
364 where
365 T: std::convert::Into<crate::model::document::ChunkedDocument>,
366 {
367 self.chunked_document = v.map(|x| x.into());
368 self
369 }
370
371 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
373 where
374 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
375 {
376 self.entity_validation_output = std::option::Option::Some(v.into());
377 self
378 }
379
380 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
382 where
383 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
384 {
385 self.entity_validation_output = v.map(|x| x.into());
386 self
387 }
388
389 pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
391 where
392 T: std::iter::IntoIterator<Item = V>,
393 V: std::convert::Into<crate::model::document::EntitiesRevision>,
394 {
395 use std::iter::Iterator;
396 self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
397 self
398 }
399
400 pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
402 mut self,
403 v: T,
404 ) -> Self {
405 self.entities_revision_id = v.into();
406 self
407 }
408
409 pub fn set_source<
414 T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
415 >(
416 mut self,
417 v: T,
418 ) -> Self {
419 self.source = v.into();
420 self
421 }
422
423 pub fn uri(&self) -> std::option::Option<&std::string::String> {
427 #[allow(unreachable_patterns)]
428 self.source.as_ref().and_then(|v| match v {
429 crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
430 _ => std::option::Option::None,
431 })
432 }
433
434 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
440 self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
441 self
442 }
443
444 pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
448 #[allow(unreachable_patterns)]
449 self.source.as_ref().and_then(|v| match v {
450 crate::model::document::Source::Content(v) => std::option::Option::Some(v),
451 _ => std::option::Option::None,
452 })
453 }
454
455 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
461 self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
462 self
463 }
464}
465
466impl wkt::message::Message for Document {
467 fn typename() -> &'static str {
468 "type.googleapis.com/google.cloud.documentai.v1.Document"
469 }
470}
471
472pub mod document {
474 #[allow(unused_imports)]
475 use super::*;
476
477 #[derive(Clone, Default, PartialEq)]
481 #[non_exhaustive]
482 pub struct ShardInfo {
483 pub shard_index: i64,
485
486 pub shard_count: i64,
488
489 pub text_offset: i64,
495
496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
497 }
498
499 impl ShardInfo {
500 pub fn new() -> Self {
501 std::default::Default::default()
502 }
503
504 pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
506 self.shard_index = v.into();
507 self
508 }
509
510 pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
512 self.shard_count = v.into();
513 self
514 }
515
516 pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
518 self.text_offset = v.into();
519 self
520 }
521 }
522
523 impl wkt::message::Message for ShardInfo {
524 fn typename() -> &'static str {
525 "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
526 }
527 }
528
529 #[derive(Clone, Default, PartialEq)]
532 #[non_exhaustive]
533 pub struct Style {
534 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
539
540 pub color: std::option::Option<gtype::model::Color>,
542
543 pub background_color: std::option::Option<gtype::model::Color>,
545
546 pub font_weight: std::string::String,
549
550 pub text_style: std::string::String,
553
554 pub text_decoration: std::string::String,
559
560 pub font_size: std::option::Option<crate::model::document::style::FontSize>,
562
563 pub font_family: std::string::String,
566
567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
568 }
569
570 impl Style {
571 pub fn new() -> Self {
572 std::default::Default::default()
573 }
574
575 pub fn set_text_anchor<T>(mut self, v: T) -> Self
577 where
578 T: std::convert::Into<crate::model::document::TextAnchor>,
579 {
580 self.text_anchor = std::option::Option::Some(v.into());
581 self
582 }
583
584 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
586 where
587 T: std::convert::Into<crate::model::document::TextAnchor>,
588 {
589 self.text_anchor = v.map(|x| x.into());
590 self
591 }
592
593 pub fn set_color<T>(mut self, v: T) -> Self
595 where
596 T: std::convert::Into<gtype::model::Color>,
597 {
598 self.color = std::option::Option::Some(v.into());
599 self
600 }
601
602 pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
604 where
605 T: std::convert::Into<gtype::model::Color>,
606 {
607 self.color = v.map(|x| x.into());
608 self
609 }
610
611 pub fn set_background_color<T>(mut self, v: T) -> Self
613 where
614 T: std::convert::Into<gtype::model::Color>,
615 {
616 self.background_color = std::option::Option::Some(v.into());
617 self
618 }
619
620 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
622 where
623 T: std::convert::Into<gtype::model::Color>,
624 {
625 self.background_color = v.map(|x| x.into());
626 self
627 }
628
629 pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
631 self.font_weight = v.into();
632 self
633 }
634
635 pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
637 self.text_style = v.into();
638 self
639 }
640
641 pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
643 mut self,
644 v: T,
645 ) -> Self {
646 self.text_decoration = v.into();
647 self
648 }
649
650 pub fn set_font_size<T>(mut self, v: T) -> Self
652 where
653 T: std::convert::Into<crate::model::document::style::FontSize>,
654 {
655 self.font_size = std::option::Option::Some(v.into());
656 self
657 }
658
659 pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
661 where
662 T: std::convert::Into<crate::model::document::style::FontSize>,
663 {
664 self.font_size = v.map(|x| x.into());
665 self
666 }
667
668 pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
670 self.font_family = v.into();
671 self
672 }
673 }
674
675 impl wkt::message::Message for Style {
676 fn typename() -> &'static str {
677 "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
678 }
679 }
680
681 pub mod style {
683 #[allow(unused_imports)]
684 use super::*;
685
686 #[derive(Clone, Default, PartialEq)]
688 #[non_exhaustive]
689 pub struct FontSize {
690 pub size: f32,
692
693 pub unit: std::string::String,
696
697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
698 }
699
700 impl FontSize {
701 pub fn new() -> Self {
702 std::default::Default::default()
703 }
704
705 pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
707 self.size = v.into();
708 self
709 }
710
711 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
713 self.unit = v.into();
714 self
715 }
716 }
717
718 impl wkt::message::Message for FontSize {
719 fn typename() -> &'static str {
720 "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
721 }
722 }
723 }
724
725 #[derive(Clone, Default, PartialEq)]
729 #[non_exhaustive]
730 pub struct Page {
731 pub page_number: i32,
740
741 pub image: std::option::Option<crate::model::document::page::Image>,
745
746 pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
751
752 pub dimension: std::option::Option<crate::model::document::page::Dimension>,
754
755 pub layout: std::option::Option<crate::model::document::page::Layout>,
759
760 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
762
763 pub blocks: std::vec::Vec<crate::model::document::page::Block>,
767
768 pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
771
772 pub lines: std::vec::Vec<crate::model::document::page::Line>,
775
776 pub tokens: std::vec::Vec<crate::model::document::page::Token>,
778
779 pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
782
783 pub tables: std::vec::Vec<crate::model::document::page::Table>,
785
786 pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
788
789 pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
791
792 pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
794
795 pub image_quality_scores:
797 std::option::Option<crate::model::document::page::ImageQualityScores>,
798
799 #[deprecated]
801 pub provenance: std::option::Option<crate::model::document::Provenance>,
802
803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
804 }
805
806 impl Page {
807 pub fn new() -> Self {
808 std::default::Default::default()
809 }
810
811 pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
813 self.page_number = v.into();
814 self
815 }
816
817 pub fn set_image<T>(mut self, v: T) -> Self
819 where
820 T: std::convert::Into<crate::model::document::page::Image>,
821 {
822 self.image = std::option::Option::Some(v.into());
823 self
824 }
825
826 pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
828 where
829 T: std::convert::Into<crate::model::document::page::Image>,
830 {
831 self.image = v.map(|x| x.into());
832 self
833 }
834
835 pub fn set_transforms<T, V>(mut self, v: T) -> Self
837 where
838 T: std::iter::IntoIterator<Item = V>,
839 V: std::convert::Into<crate::model::document::page::Matrix>,
840 {
841 use std::iter::Iterator;
842 self.transforms = v.into_iter().map(|i| i.into()).collect();
843 self
844 }
845
846 pub fn set_dimension<T>(mut self, v: T) -> Self
848 where
849 T: std::convert::Into<crate::model::document::page::Dimension>,
850 {
851 self.dimension = std::option::Option::Some(v.into());
852 self
853 }
854
855 pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
857 where
858 T: std::convert::Into<crate::model::document::page::Dimension>,
859 {
860 self.dimension = v.map(|x| x.into());
861 self
862 }
863
864 pub fn set_layout<T>(mut self, v: T) -> Self
866 where
867 T: std::convert::Into<crate::model::document::page::Layout>,
868 {
869 self.layout = std::option::Option::Some(v.into());
870 self
871 }
872
873 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
875 where
876 T: std::convert::Into<crate::model::document::page::Layout>,
877 {
878 self.layout = v.map(|x| x.into());
879 self
880 }
881
882 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
884 where
885 T: std::iter::IntoIterator<Item = V>,
886 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
887 {
888 use std::iter::Iterator;
889 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
890 self
891 }
892
893 pub fn set_blocks<T, V>(mut self, v: T) -> Self
895 where
896 T: std::iter::IntoIterator<Item = V>,
897 V: std::convert::Into<crate::model::document::page::Block>,
898 {
899 use std::iter::Iterator;
900 self.blocks = v.into_iter().map(|i| i.into()).collect();
901 self
902 }
903
904 pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
906 where
907 T: std::iter::IntoIterator<Item = V>,
908 V: std::convert::Into<crate::model::document::page::Paragraph>,
909 {
910 use std::iter::Iterator;
911 self.paragraphs = v.into_iter().map(|i| i.into()).collect();
912 self
913 }
914
915 pub fn set_lines<T, V>(mut self, v: T) -> Self
917 where
918 T: std::iter::IntoIterator<Item = V>,
919 V: std::convert::Into<crate::model::document::page::Line>,
920 {
921 use std::iter::Iterator;
922 self.lines = v.into_iter().map(|i| i.into()).collect();
923 self
924 }
925
926 pub fn set_tokens<T, V>(mut self, v: T) -> Self
928 where
929 T: std::iter::IntoIterator<Item = V>,
930 V: std::convert::Into<crate::model::document::page::Token>,
931 {
932 use std::iter::Iterator;
933 self.tokens = v.into_iter().map(|i| i.into()).collect();
934 self
935 }
936
937 pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
939 where
940 T: std::iter::IntoIterator<Item = V>,
941 V: std::convert::Into<crate::model::document::page::VisualElement>,
942 {
943 use std::iter::Iterator;
944 self.visual_elements = v.into_iter().map(|i| i.into()).collect();
945 self
946 }
947
948 pub fn set_tables<T, V>(mut self, v: T) -> Self
950 where
951 T: std::iter::IntoIterator<Item = V>,
952 V: std::convert::Into<crate::model::document::page::Table>,
953 {
954 use std::iter::Iterator;
955 self.tables = v.into_iter().map(|i| i.into()).collect();
956 self
957 }
958
959 pub fn set_form_fields<T, V>(mut self, v: T) -> Self
961 where
962 T: std::iter::IntoIterator<Item = V>,
963 V: std::convert::Into<crate::model::document::page::FormField>,
964 {
965 use std::iter::Iterator;
966 self.form_fields = v.into_iter().map(|i| i.into()).collect();
967 self
968 }
969
970 pub fn set_symbols<T, V>(mut self, v: T) -> Self
972 where
973 T: std::iter::IntoIterator<Item = V>,
974 V: std::convert::Into<crate::model::document::page::Symbol>,
975 {
976 use std::iter::Iterator;
977 self.symbols = v.into_iter().map(|i| i.into()).collect();
978 self
979 }
980
981 pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
983 where
984 T: std::iter::IntoIterator<Item = V>,
985 V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
986 {
987 use std::iter::Iterator;
988 self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
989 self
990 }
991
992 pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
994 where
995 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
996 {
997 self.image_quality_scores = std::option::Option::Some(v.into());
998 self
999 }
1000
1001 pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1003 where
1004 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1005 {
1006 self.image_quality_scores = v.map(|x| x.into());
1007 self
1008 }
1009
1010 #[deprecated]
1012 pub fn set_provenance<T>(mut self, v: T) -> Self
1013 where
1014 T: std::convert::Into<crate::model::document::Provenance>,
1015 {
1016 self.provenance = std::option::Option::Some(v.into());
1017 self
1018 }
1019
1020 #[deprecated]
1022 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1023 where
1024 T: std::convert::Into<crate::model::document::Provenance>,
1025 {
1026 self.provenance = v.map(|x| x.into());
1027 self
1028 }
1029 }
1030
1031 impl wkt::message::Message for Page {
1032 fn typename() -> &'static str {
1033 "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1034 }
1035 }
1036
1037 pub mod page {
1039 #[allow(unused_imports)]
1040 use super::*;
1041
1042 #[derive(Clone, Default, PartialEq)]
1044 #[non_exhaustive]
1045 pub struct Dimension {
1046 pub width: f32,
1048
1049 pub height: f32,
1051
1052 pub unit: std::string::String,
1054
1055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1056 }
1057
1058 impl Dimension {
1059 pub fn new() -> Self {
1060 std::default::Default::default()
1061 }
1062
1063 pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1065 self.width = v.into();
1066 self
1067 }
1068
1069 pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1071 self.height = v.into();
1072 self
1073 }
1074
1075 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1077 self.unit = v.into();
1078 self
1079 }
1080 }
1081
1082 impl wkt::message::Message for Dimension {
1083 fn typename() -> &'static str {
1084 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1085 }
1086 }
1087
1088 #[derive(Clone, Default, PartialEq)]
1090 #[non_exhaustive]
1091 pub struct Image {
1092 pub content: ::bytes::Bytes,
1094
1095 pub mime_type: std::string::String,
1099
1100 pub width: i32,
1102
1103 pub height: i32,
1105
1106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1107 }
1108
1109 impl Image {
1110 pub fn new() -> Self {
1111 std::default::Default::default()
1112 }
1113
1114 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1116 self.content = v.into();
1117 self
1118 }
1119
1120 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1122 mut self,
1123 v: T,
1124 ) -> Self {
1125 self.mime_type = v.into();
1126 self
1127 }
1128
1129 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1131 self.width = v.into();
1132 self
1133 }
1134
1135 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1137 self.height = v.into();
1138 self
1139 }
1140 }
1141
1142 impl wkt::message::Message for Image {
1143 fn typename() -> &'static str {
1144 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1145 }
1146 }
1147
1148 #[derive(Clone, Default, PartialEq)]
1151 #[non_exhaustive]
1152 pub struct Matrix {
1153 pub rows: i32,
1155
1156 pub cols: i32,
1158
1159 pub r#type: i32,
1164
1165 pub data: ::bytes::Bytes,
1167
1168 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1169 }
1170
1171 impl Matrix {
1172 pub fn new() -> Self {
1173 std::default::Default::default()
1174 }
1175
1176 pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1178 self.rows = v.into();
1179 self
1180 }
1181
1182 pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1184 self.cols = v.into();
1185 self
1186 }
1187
1188 pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1190 self.r#type = v.into();
1191 self
1192 }
1193
1194 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1196 self.data = v.into();
1197 self
1198 }
1199 }
1200
1201 impl wkt::message::Message for Matrix {
1202 fn typename() -> &'static str {
1203 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1204 }
1205 }
1206
1207 #[derive(Clone, Default, PartialEq)]
1209 #[non_exhaustive]
1210 pub struct Layout {
1211 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1216
1217 pub confidence: f32,
1225
1226 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1231
1232 pub orientation: crate::model::document::page::layout::Orientation,
1237
1238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1239 }
1240
1241 impl Layout {
1242 pub fn new() -> Self {
1243 std::default::Default::default()
1244 }
1245
1246 pub fn set_text_anchor<T>(mut self, v: T) -> Self
1248 where
1249 T: std::convert::Into<crate::model::document::TextAnchor>,
1250 {
1251 self.text_anchor = std::option::Option::Some(v.into());
1252 self
1253 }
1254
1255 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1257 where
1258 T: std::convert::Into<crate::model::document::TextAnchor>,
1259 {
1260 self.text_anchor = v.map(|x| x.into());
1261 self
1262 }
1263
1264 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1266 self.confidence = v.into();
1267 self
1268 }
1269
1270 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1272 where
1273 T: std::convert::Into<crate::model::BoundingPoly>,
1274 {
1275 self.bounding_poly = std::option::Option::Some(v.into());
1276 self
1277 }
1278
1279 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1281 where
1282 T: std::convert::Into<crate::model::BoundingPoly>,
1283 {
1284 self.bounding_poly = v.map(|x| x.into());
1285 self
1286 }
1287
1288 pub fn set_orientation<
1290 T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1291 >(
1292 mut self,
1293 v: T,
1294 ) -> Self {
1295 self.orientation = v.into();
1296 self
1297 }
1298 }
1299
1300 impl wkt::message::Message for Layout {
1301 fn typename() -> &'static str {
1302 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1303 }
1304 }
1305
1306 pub mod layout {
1308 #[allow(unused_imports)]
1309 use super::*;
1310
1311 #[derive(Clone, Debug, PartialEq)]
1327 #[non_exhaustive]
1328 pub enum Orientation {
1329 Unspecified,
1331 PageUp,
1333 PageRight,
1336 PageDown,
1339 PageLeft,
1342 UnknownValue(orientation::UnknownValue),
1347 }
1348
1349 #[doc(hidden)]
1350 pub mod orientation {
1351 #[allow(unused_imports)]
1352 use super::*;
1353 #[derive(Clone, Debug, PartialEq)]
1354 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1355 }
1356
1357 impl Orientation {
1358 pub fn value(&self) -> std::option::Option<i32> {
1363 match self {
1364 Self::Unspecified => std::option::Option::Some(0),
1365 Self::PageUp => std::option::Option::Some(1),
1366 Self::PageRight => std::option::Option::Some(2),
1367 Self::PageDown => std::option::Option::Some(3),
1368 Self::PageLeft => std::option::Option::Some(4),
1369 Self::UnknownValue(u) => u.0.value(),
1370 }
1371 }
1372
1373 pub fn name(&self) -> std::option::Option<&str> {
1378 match self {
1379 Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
1380 Self::PageUp => std::option::Option::Some("PAGE_UP"),
1381 Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
1382 Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
1383 Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
1384 Self::UnknownValue(u) => u.0.name(),
1385 }
1386 }
1387 }
1388
1389 impl std::default::Default for Orientation {
1390 fn default() -> Self {
1391 use std::convert::From;
1392 Self::from(0)
1393 }
1394 }
1395
1396 impl std::fmt::Display for Orientation {
1397 fn fmt(
1398 &self,
1399 f: &mut std::fmt::Formatter<'_>,
1400 ) -> std::result::Result<(), std::fmt::Error> {
1401 wkt::internal::display_enum(f, self.name(), self.value())
1402 }
1403 }
1404
1405 impl std::convert::From<i32> for Orientation {
1406 fn from(value: i32) -> Self {
1407 match value {
1408 0 => Self::Unspecified,
1409 1 => Self::PageUp,
1410 2 => Self::PageRight,
1411 3 => Self::PageDown,
1412 4 => Self::PageLeft,
1413 _ => Self::UnknownValue(orientation::UnknownValue(
1414 wkt::internal::UnknownEnumValue::Integer(value),
1415 )),
1416 }
1417 }
1418 }
1419
1420 impl std::convert::From<&str> for Orientation {
1421 fn from(value: &str) -> Self {
1422 use std::string::ToString;
1423 match value {
1424 "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
1425 "PAGE_UP" => Self::PageUp,
1426 "PAGE_RIGHT" => Self::PageRight,
1427 "PAGE_DOWN" => Self::PageDown,
1428 "PAGE_LEFT" => Self::PageLeft,
1429 _ => Self::UnknownValue(orientation::UnknownValue(
1430 wkt::internal::UnknownEnumValue::String(value.to_string()),
1431 )),
1432 }
1433 }
1434 }
1435
1436 impl serde::ser::Serialize for Orientation {
1437 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1438 where
1439 S: serde::Serializer,
1440 {
1441 match self {
1442 Self::Unspecified => serializer.serialize_i32(0),
1443 Self::PageUp => serializer.serialize_i32(1),
1444 Self::PageRight => serializer.serialize_i32(2),
1445 Self::PageDown => serializer.serialize_i32(3),
1446 Self::PageLeft => serializer.serialize_i32(4),
1447 Self::UnknownValue(u) => u.0.serialize(serializer),
1448 }
1449 }
1450 }
1451
1452 impl<'de> serde::de::Deserialize<'de> for Orientation {
1453 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1454 where
1455 D: serde::Deserializer<'de>,
1456 {
1457 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
1458 ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
1459 ))
1460 }
1461 }
1462 }
1463
1464 #[derive(Clone, Default, PartialEq)]
1467 #[non_exhaustive]
1468 pub struct Block {
1469 pub layout: std::option::Option<crate::model::document::page::Layout>,
1475
1476 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1478
1479 #[deprecated]
1481 pub provenance: std::option::Option<crate::model::document::Provenance>,
1482
1483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1484 }
1485
1486 impl Block {
1487 pub fn new() -> Self {
1488 std::default::Default::default()
1489 }
1490
1491 pub fn set_layout<T>(mut self, v: T) -> Self
1493 where
1494 T: std::convert::Into<crate::model::document::page::Layout>,
1495 {
1496 self.layout = std::option::Option::Some(v.into());
1497 self
1498 }
1499
1500 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1502 where
1503 T: std::convert::Into<crate::model::document::page::Layout>,
1504 {
1505 self.layout = v.map(|x| x.into());
1506 self
1507 }
1508
1509 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1511 where
1512 T: std::iter::IntoIterator<Item = V>,
1513 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1514 {
1515 use std::iter::Iterator;
1516 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1517 self
1518 }
1519
1520 #[deprecated]
1522 pub fn set_provenance<T>(mut self, v: T) -> Self
1523 where
1524 T: std::convert::Into<crate::model::document::Provenance>,
1525 {
1526 self.provenance = std::option::Option::Some(v.into());
1527 self
1528 }
1529
1530 #[deprecated]
1532 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1533 where
1534 T: std::convert::Into<crate::model::document::Provenance>,
1535 {
1536 self.provenance = v.map(|x| x.into());
1537 self
1538 }
1539 }
1540
1541 impl wkt::message::Message for Block {
1542 fn typename() -> &'static str {
1543 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
1544 }
1545 }
1546
1547 #[derive(Clone, Default, PartialEq)]
1549 #[non_exhaustive]
1550 pub struct Paragraph {
1551 pub layout: std::option::Option<crate::model::document::page::Layout>,
1557
1558 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1560
1561 #[deprecated]
1563 pub provenance: std::option::Option<crate::model::document::Provenance>,
1564
1565 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1566 }
1567
1568 impl Paragraph {
1569 pub fn new() -> Self {
1570 std::default::Default::default()
1571 }
1572
1573 pub fn set_layout<T>(mut self, v: T) -> Self
1575 where
1576 T: std::convert::Into<crate::model::document::page::Layout>,
1577 {
1578 self.layout = std::option::Option::Some(v.into());
1579 self
1580 }
1581
1582 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1584 where
1585 T: std::convert::Into<crate::model::document::page::Layout>,
1586 {
1587 self.layout = v.map(|x| x.into());
1588 self
1589 }
1590
1591 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1593 where
1594 T: std::iter::IntoIterator<Item = V>,
1595 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1596 {
1597 use std::iter::Iterator;
1598 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1599 self
1600 }
1601
1602 #[deprecated]
1604 pub fn set_provenance<T>(mut self, v: T) -> Self
1605 where
1606 T: std::convert::Into<crate::model::document::Provenance>,
1607 {
1608 self.provenance = std::option::Option::Some(v.into());
1609 self
1610 }
1611
1612 #[deprecated]
1614 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1615 where
1616 T: std::convert::Into<crate::model::document::Provenance>,
1617 {
1618 self.provenance = v.map(|x| x.into());
1619 self
1620 }
1621 }
1622
1623 impl wkt::message::Message for Paragraph {
1624 fn typename() -> &'static str {
1625 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
1626 }
1627 }
1628
1629 #[derive(Clone, Default, PartialEq)]
1632 #[non_exhaustive]
1633 pub struct Line {
1634 pub layout: std::option::Option<crate::model::document::page::Layout>,
1640
1641 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1643
1644 #[deprecated]
1646 pub provenance: std::option::Option<crate::model::document::Provenance>,
1647
1648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1649 }
1650
1651 impl Line {
1652 pub fn new() -> Self {
1653 std::default::Default::default()
1654 }
1655
1656 pub fn set_layout<T>(mut self, v: T) -> Self
1658 where
1659 T: std::convert::Into<crate::model::document::page::Layout>,
1660 {
1661 self.layout = std::option::Option::Some(v.into());
1662 self
1663 }
1664
1665 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1667 where
1668 T: std::convert::Into<crate::model::document::page::Layout>,
1669 {
1670 self.layout = v.map(|x| x.into());
1671 self
1672 }
1673
1674 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1676 where
1677 T: std::iter::IntoIterator<Item = V>,
1678 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1679 {
1680 use std::iter::Iterator;
1681 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1682 self
1683 }
1684
1685 #[deprecated]
1687 pub fn set_provenance<T>(mut self, v: T) -> Self
1688 where
1689 T: std::convert::Into<crate::model::document::Provenance>,
1690 {
1691 self.provenance = std::option::Option::Some(v.into());
1692 self
1693 }
1694
1695 #[deprecated]
1697 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1698 where
1699 T: std::convert::Into<crate::model::document::Provenance>,
1700 {
1701 self.provenance = v.map(|x| x.into());
1702 self
1703 }
1704 }
1705
1706 impl wkt::message::Message for Line {
1707 fn typename() -> &'static str {
1708 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
1709 }
1710 }
1711
1712 #[derive(Clone, Default, PartialEq)]
1714 #[non_exhaustive]
1715 pub struct Token {
1716 pub layout: std::option::Option<crate::model::document::page::Layout>,
1722
1723 pub detected_break:
1728 std::option::Option<crate::model::document::page::token::DetectedBreak>,
1729
1730 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1732
1733 #[deprecated]
1735 pub provenance: std::option::Option<crate::model::document::Provenance>,
1736
1737 pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
1739
1740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1741 }
1742
1743 impl Token {
1744 pub fn new() -> Self {
1745 std::default::Default::default()
1746 }
1747
1748 pub fn set_layout<T>(mut self, v: T) -> Self
1750 where
1751 T: std::convert::Into<crate::model::document::page::Layout>,
1752 {
1753 self.layout = std::option::Option::Some(v.into());
1754 self
1755 }
1756
1757 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1759 where
1760 T: std::convert::Into<crate::model::document::page::Layout>,
1761 {
1762 self.layout = v.map(|x| x.into());
1763 self
1764 }
1765
1766 pub fn set_detected_break<T>(mut self, v: T) -> Self
1768 where
1769 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
1770 {
1771 self.detected_break = std::option::Option::Some(v.into());
1772 self
1773 }
1774
1775 pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
1777 where
1778 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
1779 {
1780 self.detected_break = v.map(|x| x.into());
1781 self
1782 }
1783
1784 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1786 where
1787 T: std::iter::IntoIterator<Item = V>,
1788 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1789 {
1790 use std::iter::Iterator;
1791 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1792 self
1793 }
1794
1795 #[deprecated]
1797 pub fn set_provenance<T>(mut self, v: T) -> Self
1798 where
1799 T: std::convert::Into<crate::model::document::Provenance>,
1800 {
1801 self.provenance = std::option::Option::Some(v.into());
1802 self
1803 }
1804
1805 #[deprecated]
1807 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1808 where
1809 T: std::convert::Into<crate::model::document::Provenance>,
1810 {
1811 self.provenance = v.map(|x| x.into());
1812 self
1813 }
1814
1815 pub fn set_style_info<T>(mut self, v: T) -> Self
1817 where
1818 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
1819 {
1820 self.style_info = std::option::Option::Some(v.into());
1821 self
1822 }
1823
1824 pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
1826 where
1827 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
1828 {
1829 self.style_info = v.map(|x| x.into());
1830 self
1831 }
1832 }
1833
1834 impl wkt::message::Message for Token {
1835 fn typename() -> &'static str {
1836 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
1837 }
1838 }
1839
1840 pub mod token {
1842 #[allow(unused_imports)]
1843 use super::*;
1844
1845 #[derive(Clone, Default, PartialEq)]
1850 #[non_exhaustive]
1851 pub struct DetectedBreak {
1852 pub r#type: crate::model::document::page::token::detected_break::Type,
1854
1855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1856 }
1857
1858 impl DetectedBreak {
1859 pub fn new() -> Self {
1860 std::default::Default::default()
1861 }
1862
1863 pub fn set_type<
1865 T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
1866 >(
1867 mut self,
1868 v: T,
1869 ) -> Self {
1870 self.r#type = v.into();
1871 self
1872 }
1873 }
1874
1875 impl wkt::message::Message for DetectedBreak {
1876 fn typename() -> &'static str {
1877 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
1878 }
1879 }
1880
1881 pub mod detected_break {
1883 #[allow(unused_imports)]
1884 use super::*;
1885
1886 #[derive(Clone, Debug, PartialEq)]
1902 #[non_exhaustive]
1903 pub enum Type {
1904 Unspecified,
1906 Space,
1908 WideSpace,
1910 Hyphen,
1912 UnknownValue(r#type::UnknownValue),
1917 }
1918
1919 #[doc(hidden)]
1920 pub mod r#type {
1921 #[allow(unused_imports)]
1922 use super::*;
1923 #[derive(Clone, Debug, PartialEq)]
1924 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1925 }
1926
1927 impl Type {
1928 pub fn value(&self) -> std::option::Option<i32> {
1933 match self {
1934 Self::Unspecified => std::option::Option::Some(0),
1935 Self::Space => std::option::Option::Some(1),
1936 Self::WideSpace => std::option::Option::Some(2),
1937 Self::Hyphen => std::option::Option::Some(3),
1938 Self::UnknownValue(u) => u.0.value(),
1939 }
1940 }
1941
1942 pub fn name(&self) -> std::option::Option<&str> {
1947 match self {
1948 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
1949 Self::Space => std::option::Option::Some("SPACE"),
1950 Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
1951 Self::Hyphen => std::option::Option::Some("HYPHEN"),
1952 Self::UnknownValue(u) => u.0.name(),
1953 }
1954 }
1955 }
1956
1957 impl std::default::Default for Type {
1958 fn default() -> Self {
1959 use std::convert::From;
1960 Self::from(0)
1961 }
1962 }
1963
1964 impl std::fmt::Display for Type {
1965 fn fmt(
1966 &self,
1967 f: &mut std::fmt::Formatter<'_>,
1968 ) -> std::result::Result<(), std::fmt::Error> {
1969 wkt::internal::display_enum(f, self.name(), self.value())
1970 }
1971 }
1972
1973 impl std::convert::From<i32> for Type {
1974 fn from(value: i32) -> Self {
1975 match value {
1976 0 => Self::Unspecified,
1977 1 => Self::Space,
1978 2 => Self::WideSpace,
1979 3 => Self::Hyphen,
1980 _ => Self::UnknownValue(r#type::UnknownValue(
1981 wkt::internal::UnknownEnumValue::Integer(value),
1982 )),
1983 }
1984 }
1985 }
1986
1987 impl std::convert::From<&str> for Type {
1988 fn from(value: &str) -> Self {
1989 use std::string::ToString;
1990 match value {
1991 "TYPE_UNSPECIFIED" => Self::Unspecified,
1992 "SPACE" => Self::Space,
1993 "WIDE_SPACE" => Self::WideSpace,
1994 "HYPHEN" => Self::Hyphen,
1995 _ => Self::UnknownValue(r#type::UnknownValue(
1996 wkt::internal::UnknownEnumValue::String(value.to_string()),
1997 )),
1998 }
1999 }
2000 }
2001
2002 impl serde::ser::Serialize for Type {
2003 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2004 where
2005 S: serde::Serializer,
2006 {
2007 match self {
2008 Self::Unspecified => serializer.serialize_i32(0),
2009 Self::Space => serializer.serialize_i32(1),
2010 Self::WideSpace => serializer.serialize_i32(2),
2011 Self::Hyphen => serializer.serialize_i32(3),
2012 Self::UnknownValue(u) => u.0.serialize(serializer),
2013 }
2014 }
2015 }
2016
2017 impl<'de> serde::de::Deserialize<'de> for Type {
2018 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2019 where
2020 D: serde::Deserializer<'de>,
2021 {
2022 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2023 ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2024 ))
2025 }
2026 }
2027 }
2028
2029 #[derive(Clone, Default, PartialEq)]
2031 #[non_exhaustive]
2032 pub struct StyleInfo {
2033 pub font_size: i32,
2035
2036 pub pixel_font_size: f64,
2043
2044 pub letter_spacing: f64,
2046
2047 pub font_type: std::string::String,
2049
2050 pub bold: bool,
2056
2057 pub italic: bool,
2059
2060 pub underlined: bool,
2062
2063 pub strikeout: bool,
2065
2066 pub subscript: bool,
2068
2069 pub superscript: bool,
2071
2072 pub smallcaps: bool,
2074
2075 pub font_weight: i32,
2078
2079 pub handwritten: bool,
2081
2082 pub text_color: std::option::Option<gtype::model::Color>,
2084
2085 pub background_color: std::option::Option<gtype::model::Color>,
2087
2088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2089 }
2090
2091 impl StyleInfo {
2092 pub fn new() -> Self {
2093 std::default::Default::default()
2094 }
2095
2096 pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2098 self.font_size = v.into();
2099 self
2100 }
2101
2102 pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2104 self.pixel_font_size = v.into();
2105 self
2106 }
2107
2108 pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2110 self.letter_spacing = v.into();
2111 self
2112 }
2113
2114 pub fn set_font_type<T: std::convert::Into<std::string::String>>(
2116 mut self,
2117 v: T,
2118 ) -> Self {
2119 self.font_type = v.into();
2120 self
2121 }
2122
2123 pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2125 self.bold = v.into();
2126 self
2127 }
2128
2129 pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2131 self.italic = v.into();
2132 self
2133 }
2134
2135 pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2137 self.underlined = v.into();
2138 self
2139 }
2140
2141 pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2143 self.strikeout = v.into();
2144 self
2145 }
2146
2147 pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2149 self.subscript = v.into();
2150 self
2151 }
2152
2153 pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2155 self.superscript = v.into();
2156 self
2157 }
2158
2159 pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2161 self.smallcaps = v.into();
2162 self
2163 }
2164
2165 pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2167 self.font_weight = v.into();
2168 self
2169 }
2170
2171 pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2173 self.handwritten = v.into();
2174 self
2175 }
2176
2177 pub fn set_text_color<T>(mut self, v: T) -> Self
2179 where
2180 T: std::convert::Into<gtype::model::Color>,
2181 {
2182 self.text_color = std::option::Option::Some(v.into());
2183 self
2184 }
2185
2186 pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
2188 where
2189 T: std::convert::Into<gtype::model::Color>,
2190 {
2191 self.text_color = v.map(|x| x.into());
2192 self
2193 }
2194
2195 pub fn set_background_color<T>(mut self, v: T) -> Self
2197 where
2198 T: std::convert::Into<gtype::model::Color>,
2199 {
2200 self.background_color = std::option::Option::Some(v.into());
2201 self
2202 }
2203
2204 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
2206 where
2207 T: std::convert::Into<gtype::model::Color>,
2208 {
2209 self.background_color = v.map(|x| x.into());
2210 self
2211 }
2212 }
2213
2214 impl wkt::message::Message for StyleInfo {
2215 fn typename() -> &'static str {
2216 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
2217 }
2218 }
2219 }
2220
2221 #[derive(Clone, Default, PartialEq)]
2223 #[non_exhaustive]
2224 pub struct Symbol {
2225 pub layout: std::option::Option<crate::model::document::page::Layout>,
2231
2232 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2234
2235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2236 }
2237
2238 impl Symbol {
2239 pub fn new() -> Self {
2240 std::default::Default::default()
2241 }
2242
2243 pub fn set_layout<T>(mut self, v: T) -> Self
2245 where
2246 T: std::convert::Into<crate::model::document::page::Layout>,
2247 {
2248 self.layout = std::option::Option::Some(v.into());
2249 self
2250 }
2251
2252 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2254 where
2255 T: std::convert::Into<crate::model::document::page::Layout>,
2256 {
2257 self.layout = v.map(|x| x.into());
2258 self
2259 }
2260
2261 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2263 where
2264 T: std::iter::IntoIterator<Item = V>,
2265 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2266 {
2267 use std::iter::Iterator;
2268 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2269 self
2270 }
2271 }
2272
2273 impl wkt::message::Message for Symbol {
2274 fn typename() -> &'static str {
2275 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
2276 }
2277 }
2278
2279 #[derive(Clone, Default, PartialEq)]
2282 #[non_exhaustive]
2283 pub struct VisualElement {
2284 pub layout: std::option::Option<crate::model::document::page::Layout>,
2290
2291 pub r#type: std::string::String,
2296
2297 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2299
2300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2301 }
2302
2303 impl VisualElement {
2304 pub fn new() -> Self {
2305 std::default::Default::default()
2306 }
2307
2308 pub fn set_layout<T>(mut self, v: T) -> Self
2310 where
2311 T: std::convert::Into<crate::model::document::page::Layout>,
2312 {
2313 self.layout = std::option::Option::Some(v.into());
2314 self
2315 }
2316
2317 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2319 where
2320 T: std::convert::Into<crate::model::document::page::Layout>,
2321 {
2322 self.layout = v.map(|x| x.into());
2323 self
2324 }
2325
2326 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2328 self.r#type = v.into();
2329 self
2330 }
2331
2332 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2334 where
2335 T: std::iter::IntoIterator<Item = V>,
2336 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2337 {
2338 use std::iter::Iterator;
2339 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2340 self
2341 }
2342 }
2343
2344 impl wkt::message::Message for VisualElement {
2345 fn typename() -> &'static str {
2346 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
2347 }
2348 }
2349
2350 #[derive(Clone, Default, PartialEq)]
2352 #[non_exhaustive]
2353 pub struct Table {
2354 pub layout: std::option::Option<crate::model::document::page::Layout>,
2360
2361 pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
2363
2364 pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
2366
2367 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2369
2370 #[deprecated]
2372 pub provenance: std::option::Option<crate::model::document::Provenance>,
2373
2374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2375 }
2376
2377 impl Table {
2378 pub fn new() -> Self {
2379 std::default::Default::default()
2380 }
2381
2382 pub fn set_layout<T>(mut self, v: T) -> Self
2384 where
2385 T: std::convert::Into<crate::model::document::page::Layout>,
2386 {
2387 self.layout = std::option::Option::Some(v.into());
2388 self
2389 }
2390
2391 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2393 where
2394 T: std::convert::Into<crate::model::document::page::Layout>,
2395 {
2396 self.layout = v.map(|x| x.into());
2397 self
2398 }
2399
2400 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
2402 where
2403 T: std::iter::IntoIterator<Item = V>,
2404 V: std::convert::Into<crate::model::document::page::table::TableRow>,
2405 {
2406 use std::iter::Iterator;
2407 self.header_rows = v.into_iter().map(|i| i.into()).collect();
2408 self
2409 }
2410
2411 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
2413 where
2414 T: std::iter::IntoIterator<Item = V>,
2415 V: std::convert::Into<crate::model::document::page::table::TableRow>,
2416 {
2417 use std::iter::Iterator;
2418 self.body_rows = v.into_iter().map(|i| i.into()).collect();
2419 self
2420 }
2421
2422 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2424 where
2425 T: std::iter::IntoIterator<Item = V>,
2426 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2427 {
2428 use std::iter::Iterator;
2429 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2430 self
2431 }
2432
2433 #[deprecated]
2435 pub fn set_provenance<T>(mut self, v: T) -> Self
2436 where
2437 T: std::convert::Into<crate::model::document::Provenance>,
2438 {
2439 self.provenance = std::option::Option::Some(v.into());
2440 self
2441 }
2442
2443 #[deprecated]
2445 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2446 where
2447 T: std::convert::Into<crate::model::document::Provenance>,
2448 {
2449 self.provenance = v.map(|x| x.into());
2450 self
2451 }
2452 }
2453
2454 impl wkt::message::Message for Table {
2455 fn typename() -> &'static str {
2456 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
2457 }
2458 }
2459
2460 pub mod table {
2462 #[allow(unused_imports)]
2463 use super::*;
2464
2465 #[derive(Clone, Default, PartialEq)]
2467 #[non_exhaustive]
2468 pub struct TableRow {
2469 pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
2471
2472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2473 }
2474
2475 impl TableRow {
2476 pub fn new() -> Self {
2477 std::default::Default::default()
2478 }
2479
2480 pub fn set_cells<T, V>(mut self, v: T) -> Self
2482 where
2483 T: std::iter::IntoIterator<Item = V>,
2484 V: std::convert::Into<crate::model::document::page::table::TableCell>,
2485 {
2486 use std::iter::Iterator;
2487 self.cells = v.into_iter().map(|i| i.into()).collect();
2488 self
2489 }
2490 }
2491
2492 impl wkt::message::Message for TableRow {
2493 fn typename() -> &'static str {
2494 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
2495 }
2496 }
2497
2498 #[derive(Clone, Default, PartialEq)]
2500 #[non_exhaustive]
2501 pub struct TableCell {
2502 pub layout: std::option::Option<crate::model::document::page::Layout>,
2508
2509 pub row_span: i32,
2511
2512 pub col_span: i32,
2514
2515 pub detected_languages:
2517 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2518
2519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2520 }
2521
2522 impl TableCell {
2523 pub fn new() -> Self {
2524 std::default::Default::default()
2525 }
2526
2527 pub fn set_layout<T>(mut self, v: T) -> Self
2529 where
2530 T: std::convert::Into<crate::model::document::page::Layout>,
2531 {
2532 self.layout = std::option::Option::Some(v.into());
2533 self
2534 }
2535
2536 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2538 where
2539 T: std::convert::Into<crate::model::document::page::Layout>,
2540 {
2541 self.layout = v.map(|x| x.into());
2542 self
2543 }
2544
2545 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2547 self.row_span = v.into();
2548 self
2549 }
2550
2551 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2553 self.col_span = v.into();
2554 self
2555 }
2556
2557 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2559 where
2560 T: std::iter::IntoIterator<Item = V>,
2561 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2562 {
2563 use std::iter::Iterator;
2564 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2565 self
2566 }
2567 }
2568
2569 impl wkt::message::Message for TableCell {
2570 fn typename() -> &'static str {
2571 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
2572 }
2573 }
2574 }
2575
2576 #[derive(Clone, Default, PartialEq)]
2578 #[non_exhaustive]
2579 pub struct FormField {
2580 pub field_name: std::option::Option<crate::model::document::page::Layout>,
2587
2588 pub field_value: std::option::Option<crate::model::document::page::Layout>,
2594
2595 pub name_detected_languages:
2597 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2598
2599 pub value_detected_languages:
2601 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2602
2603 pub value_type: std::string::String,
2610
2611 pub corrected_key_text: std::string::String,
2615
2616 pub corrected_value_text: std::string::String,
2620
2621 pub provenance: std::option::Option<crate::model::document::Provenance>,
2623
2624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2625 }
2626
2627 impl FormField {
2628 pub fn new() -> Self {
2629 std::default::Default::default()
2630 }
2631
2632 pub fn set_field_name<T>(mut self, v: T) -> Self
2634 where
2635 T: std::convert::Into<crate::model::document::page::Layout>,
2636 {
2637 self.field_name = std::option::Option::Some(v.into());
2638 self
2639 }
2640
2641 pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
2643 where
2644 T: std::convert::Into<crate::model::document::page::Layout>,
2645 {
2646 self.field_name = v.map(|x| x.into());
2647 self
2648 }
2649
2650 pub fn set_field_value<T>(mut self, v: T) -> Self
2652 where
2653 T: std::convert::Into<crate::model::document::page::Layout>,
2654 {
2655 self.field_value = std::option::Option::Some(v.into());
2656 self
2657 }
2658
2659 pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
2661 where
2662 T: std::convert::Into<crate::model::document::page::Layout>,
2663 {
2664 self.field_value = v.map(|x| x.into());
2665 self
2666 }
2667
2668 pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
2670 where
2671 T: std::iter::IntoIterator<Item = V>,
2672 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2673 {
2674 use std::iter::Iterator;
2675 self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
2676 self
2677 }
2678
2679 pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
2681 where
2682 T: std::iter::IntoIterator<Item = V>,
2683 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2684 {
2685 use std::iter::Iterator;
2686 self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
2687 self
2688 }
2689
2690 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
2692 mut self,
2693 v: T,
2694 ) -> Self {
2695 self.value_type = v.into();
2696 self
2697 }
2698
2699 pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
2701 mut self,
2702 v: T,
2703 ) -> Self {
2704 self.corrected_key_text = v.into();
2705 self
2706 }
2707
2708 pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
2710 mut self,
2711 v: T,
2712 ) -> Self {
2713 self.corrected_value_text = v.into();
2714 self
2715 }
2716
2717 pub fn set_provenance<T>(mut self, v: T) -> Self
2719 where
2720 T: std::convert::Into<crate::model::document::Provenance>,
2721 {
2722 self.provenance = std::option::Option::Some(v.into());
2723 self
2724 }
2725
2726 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2728 where
2729 T: std::convert::Into<crate::model::document::Provenance>,
2730 {
2731 self.provenance = v.map(|x| x.into());
2732 self
2733 }
2734 }
2735
2736 impl wkt::message::Message for FormField {
2737 fn typename() -> &'static str {
2738 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
2739 }
2740 }
2741
2742 #[derive(Clone, Default, PartialEq)]
2744 #[non_exhaustive]
2745 pub struct DetectedBarcode {
2746 pub layout: std::option::Option<crate::model::document::page::Layout>,
2752
2753 pub barcode: std::option::Option<crate::model::Barcode>,
2758
2759 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2760 }
2761
2762 impl DetectedBarcode {
2763 pub fn new() -> Self {
2764 std::default::Default::default()
2765 }
2766
2767 pub fn set_layout<T>(mut self, v: T) -> Self
2769 where
2770 T: std::convert::Into<crate::model::document::page::Layout>,
2771 {
2772 self.layout = std::option::Option::Some(v.into());
2773 self
2774 }
2775
2776 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2778 where
2779 T: std::convert::Into<crate::model::document::page::Layout>,
2780 {
2781 self.layout = v.map(|x| x.into());
2782 self
2783 }
2784
2785 pub fn set_barcode<T>(mut self, v: T) -> Self
2787 where
2788 T: std::convert::Into<crate::model::Barcode>,
2789 {
2790 self.barcode = std::option::Option::Some(v.into());
2791 self
2792 }
2793
2794 pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
2796 where
2797 T: std::convert::Into<crate::model::Barcode>,
2798 {
2799 self.barcode = v.map(|x| x.into());
2800 self
2801 }
2802 }
2803
2804 impl wkt::message::Message for DetectedBarcode {
2805 fn typename() -> &'static str {
2806 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
2807 }
2808 }
2809
2810 #[derive(Clone, Default, PartialEq)]
2812 #[non_exhaustive]
2813 pub struct DetectedLanguage {
2814 pub language_code: std::string::String,
2818
2819 pub confidence: f32,
2821
2822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2823 }
2824
2825 impl DetectedLanguage {
2826 pub fn new() -> Self {
2827 std::default::Default::default()
2828 }
2829
2830 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
2832 mut self,
2833 v: T,
2834 ) -> Self {
2835 self.language_code = v.into();
2836 self
2837 }
2838
2839 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2841 self.confidence = v.into();
2842 self
2843 }
2844 }
2845
2846 impl wkt::message::Message for DetectedLanguage {
2847 fn typename() -> &'static str {
2848 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
2849 }
2850 }
2851
2852 #[derive(Clone, Default, PartialEq)]
2854 #[non_exhaustive]
2855 pub struct ImageQualityScores {
2856 pub quality_score: f32,
2858
2859 pub detected_defects:
2861 std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
2862
2863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2864 }
2865
2866 impl ImageQualityScores {
2867 pub fn new() -> Self {
2868 std::default::Default::default()
2869 }
2870
2871 pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2873 self.quality_score = v.into();
2874 self
2875 }
2876
2877 pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
2879 where
2880 T: std::iter::IntoIterator<Item = V>,
2881 V: std::convert::Into<
2882 crate::model::document::page::image_quality_scores::DetectedDefect,
2883 >,
2884 {
2885 use std::iter::Iterator;
2886 self.detected_defects = v.into_iter().map(|i| i.into()).collect();
2887 self
2888 }
2889 }
2890
2891 impl wkt::message::Message for ImageQualityScores {
2892 fn typename() -> &'static str {
2893 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
2894 }
2895 }
2896
2897 pub mod image_quality_scores {
2899 #[allow(unused_imports)]
2900 use super::*;
2901
2902 #[derive(Clone, Default, PartialEq)]
2904 #[non_exhaustive]
2905 pub struct DetectedDefect {
2906 pub r#type: std::string::String,
2917
2918 pub confidence: f32,
2921
2922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2923 }
2924
2925 impl DetectedDefect {
2926 pub fn new() -> Self {
2927 std::default::Default::default()
2928 }
2929
2930 pub fn set_type<T: std::convert::Into<std::string::String>>(
2932 mut self,
2933 v: T,
2934 ) -> Self {
2935 self.r#type = v.into();
2936 self
2937 }
2938
2939 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2941 self.confidence = v.into();
2942 self
2943 }
2944 }
2945
2946 impl wkt::message::Message for DetectedDefect {
2947 fn typename() -> &'static str {
2948 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
2949 }
2950 }
2951 }
2952 }
2953
2954 #[derive(Clone, Default, PartialEq)]
2958 #[non_exhaustive]
2959 pub struct Entity {
2960 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
2966
2967 pub r#type: std::string::String,
2969
2970 pub mention_text: std::string::String,
2972
2973 pub mention_id: std::string::String,
2975
2976 pub confidence: f32,
2978
2979 pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
2982
2983 pub id: std::string::String,
2986
2987 pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
2992
2993 pub properties: std::vec::Vec<crate::model::document::Entity>,
2996
2997 pub provenance: std::option::Option<crate::model::document::Provenance>,
2999
3000 pub redacted: bool,
3003
3004 pub method: crate::model::document::entity::Method,
3006
3007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3008 }
3009
3010 impl Entity {
3011 pub fn new() -> Self {
3012 std::default::Default::default()
3013 }
3014
3015 pub fn set_text_anchor<T>(mut self, v: T) -> Self
3017 where
3018 T: std::convert::Into<crate::model::document::TextAnchor>,
3019 {
3020 self.text_anchor = std::option::Option::Some(v.into());
3021 self
3022 }
3023
3024 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
3026 where
3027 T: std::convert::Into<crate::model::document::TextAnchor>,
3028 {
3029 self.text_anchor = v.map(|x| x.into());
3030 self
3031 }
3032
3033 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3035 self.r#type = v.into();
3036 self
3037 }
3038
3039 pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
3041 mut self,
3042 v: T,
3043 ) -> Self {
3044 self.mention_text = v.into();
3045 self
3046 }
3047
3048 pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3050 self.mention_id = v.into();
3051 self
3052 }
3053
3054 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3056 self.confidence = v.into();
3057 self
3058 }
3059
3060 pub fn set_page_anchor<T>(mut self, v: T) -> Self
3062 where
3063 T: std::convert::Into<crate::model::document::PageAnchor>,
3064 {
3065 self.page_anchor = std::option::Option::Some(v.into());
3066 self
3067 }
3068
3069 pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
3071 where
3072 T: std::convert::Into<crate::model::document::PageAnchor>,
3073 {
3074 self.page_anchor = v.map(|x| x.into());
3075 self
3076 }
3077
3078 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3080 self.id = v.into();
3081 self
3082 }
3083
3084 pub fn set_normalized_value<T>(mut self, v: T) -> Self
3086 where
3087 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
3088 {
3089 self.normalized_value = std::option::Option::Some(v.into());
3090 self
3091 }
3092
3093 pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
3095 where
3096 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
3097 {
3098 self.normalized_value = v.map(|x| x.into());
3099 self
3100 }
3101
3102 pub fn set_properties<T, V>(mut self, v: T) -> Self
3104 where
3105 T: std::iter::IntoIterator<Item = V>,
3106 V: std::convert::Into<crate::model::document::Entity>,
3107 {
3108 use std::iter::Iterator;
3109 self.properties = v.into_iter().map(|i| i.into()).collect();
3110 self
3111 }
3112
3113 pub fn set_provenance<T>(mut self, v: T) -> Self
3115 where
3116 T: std::convert::Into<crate::model::document::Provenance>,
3117 {
3118 self.provenance = std::option::Option::Some(v.into());
3119 self
3120 }
3121
3122 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3124 where
3125 T: std::convert::Into<crate::model::document::Provenance>,
3126 {
3127 self.provenance = v.map(|x| x.into());
3128 self
3129 }
3130
3131 pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3133 self.redacted = v.into();
3134 self
3135 }
3136
3137 pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
3139 mut self,
3140 v: T,
3141 ) -> Self {
3142 self.method = v.into();
3143 self
3144 }
3145 }
3146
3147 impl wkt::message::Message for Entity {
3148 fn typename() -> &'static str {
3149 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
3150 }
3151 }
3152
3153 pub mod entity {
3155 #[allow(unused_imports)]
3156 use super::*;
3157
3158 #[derive(Clone, Default, PartialEq)]
3160 #[non_exhaustive]
3161 pub struct NormalizedValue {
3162 pub text: std::string::String,
3174
3175 pub structured_value: std::option::Option<
3180 crate::model::document::entity::normalized_value::StructuredValue,
3181 >,
3182
3183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3184 }
3185
3186 impl NormalizedValue {
3187 pub fn new() -> Self {
3188 std::default::Default::default()
3189 }
3190
3191 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3193 self.text = v.into();
3194 self
3195 }
3196
3197 pub fn set_structured_value<
3202 T: std::convert::Into<
3203 std::option::Option<
3204 crate::model::document::entity::normalized_value::StructuredValue,
3205 >,
3206 >,
3207 >(
3208 mut self,
3209 v: T,
3210 ) -> Self {
3211 self.structured_value = v.into();
3212 self
3213 }
3214
3215 pub fn money_value(
3219 &self,
3220 ) -> std::option::Option<&std::boxed::Box<gtype::model::Money>> {
3221 #[allow(unreachable_patterns)]
3222 self.structured_value.as_ref().and_then(|v| match v {
3223 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
3224 _ => std::option::Option::None,
3225 })
3226 }
3227
3228 pub fn set_money_value<T: std::convert::Into<std::boxed::Box<gtype::model::Money>>>(
3234 mut self,
3235 v: T,
3236 ) -> Self {
3237 self.structured_value = std::option::Option::Some(
3238 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
3239 v.into(),
3240 ),
3241 );
3242 self
3243 }
3244
3245 pub fn date_value(&self) -> std::option::Option<&std::boxed::Box<gtype::model::Date>> {
3249 #[allow(unreachable_patterns)]
3250 self.structured_value.as_ref().and_then(|v| match v {
3251 crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
3252 _ => std::option::Option::None,
3253 })
3254 }
3255
3256 pub fn set_date_value<T: std::convert::Into<std::boxed::Box<gtype::model::Date>>>(
3262 mut self,
3263 v: T,
3264 ) -> Self {
3265 self.structured_value = std::option::Option::Some(
3266 crate::model::document::entity::normalized_value::StructuredValue::DateValue(
3267 v.into(),
3268 ),
3269 );
3270 self
3271 }
3272
3273 pub fn datetime_value(
3277 &self,
3278 ) -> std::option::Option<&std::boxed::Box<gtype::model::DateTime>> {
3279 #[allow(unreachable_patterns)]
3280 self.structured_value.as_ref().and_then(|v| match v {
3281 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
3282 _ => std::option::Option::None,
3283 })
3284 }
3285
3286 pub fn set_datetime_value<
3292 T: std::convert::Into<std::boxed::Box<gtype::model::DateTime>>,
3293 >(
3294 mut self,
3295 v: T,
3296 ) -> Self {
3297 self.structured_value = std::option::Option::Some(
3298 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
3299 v.into()
3300 )
3301 );
3302 self
3303 }
3304
3305 pub fn address_value(
3309 &self,
3310 ) -> std::option::Option<&std::boxed::Box<gtype::model::PostalAddress>> {
3311 #[allow(unreachable_patterns)]
3312 self.structured_value.as_ref().and_then(|v| match v {
3313 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
3314 _ => std::option::Option::None,
3315 })
3316 }
3317
3318 pub fn set_address_value<
3324 T: std::convert::Into<std::boxed::Box<gtype::model::PostalAddress>>,
3325 >(
3326 mut self,
3327 v: T,
3328 ) -> Self {
3329 self.structured_value = std::option::Option::Some(
3330 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
3331 v.into(),
3332 ),
3333 );
3334 self
3335 }
3336
3337 pub fn boolean_value(&self) -> std::option::Option<&bool> {
3341 #[allow(unreachable_patterns)]
3342 self.structured_value.as_ref().and_then(|v| match v {
3343 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
3344 _ => std::option::Option::None,
3345 })
3346 }
3347
3348 pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3354 self.structured_value = std::option::Option::Some(
3355 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
3356 v.into(),
3357 ),
3358 );
3359 self
3360 }
3361
3362 pub fn integer_value(&self) -> std::option::Option<&i32> {
3366 #[allow(unreachable_patterns)]
3367 self.structured_value.as_ref().and_then(|v| match v {
3368 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
3369 _ => std::option::Option::None,
3370 })
3371 }
3372
3373 pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3379 self.structured_value = std::option::Option::Some(
3380 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
3381 v.into(),
3382 ),
3383 );
3384 self
3385 }
3386
3387 pub fn float_value(&self) -> std::option::Option<&f32> {
3391 #[allow(unreachable_patterns)]
3392 self.structured_value.as_ref().and_then(|v| match v {
3393 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
3394 _ => std::option::Option::None,
3395 })
3396 }
3397
3398 pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3404 self.structured_value = std::option::Option::Some(
3405 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
3406 v.into(),
3407 ),
3408 );
3409 self
3410 }
3411
3412 pub fn signature_value(&self) -> std::option::Option<&bool> {
3416 #[allow(unreachable_patterns)]
3417 self.structured_value.as_ref().and_then(|v| match v {
3418 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
3419 _ => std::option::Option::None,
3420 })
3421 }
3422
3423 pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3429 self.structured_value = std::option::Option::Some(
3430 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
3431 v.into()
3432 )
3433 );
3434 self
3435 }
3436 }
3437
3438 impl wkt::message::Message for NormalizedValue {
3439 fn typename() -> &'static str {
3440 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
3441 }
3442 }
3443
3444 pub mod normalized_value {
3446 #[allow(unused_imports)]
3447 use super::*;
3448
3449 #[derive(Clone, Debug, PartialEq)]
3454 #[non_exhaustive]
3455 pub enum StructuredValue {
3456 MoneyValue(std::boxed::Box<gtype::model::Money>),
3459 DateValue(std::boxed::Box<gtype::model::Date>),
3462 DatetimeValue(std::boxed::Box<gtype::model::DateTime>),
3465 AddressValue(std::boxed::Box<gtype::model::PostalAddress>),
3468 BooleanValue(bool),
3471 IntegerValue(i32),
3473 FloatValue(f32),
3475 SignatureValue(bool),
3476 }
3477 }
3478
3479 #[derive(Clone, Debug, PartialEq)]
3495 #[non_exhaustive]
3496 pub enum Method {
3497 Unspecified,
3499 Extract,
3502 Derive,
3505 UnknownValue(method::UnknownValue),
3510 }
3511
3512 #[doc(hidden)]
3513 pub mod method {
3514 #[allow(unused_imports)]
3515 use super::*;
3516 #[derive(Clone, Debug, PartialEq)]
3517 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3518 }
3519
3520 impl Method {
3521 pub fn value(&self) -> std::option::Option<i32> {
3526 match self {
3527 Self::Unspecified => std::option::Option::Some(0),
3528 Self::Extract => std::option::Option::Some(1),
3529 Self::Derive => std::option::Option::Some(2),
3530 Self::UnknownValue(u) => u.0.value(),
3531 }
3532 }
3533
3534 pub fn name(&self) -> std::option::Option<&str> {
3539 match self {
3540 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
3541 Self::Extract => std::option::Option::Some("EXTRACT"),
3542 Self::Derive => std::option::Option::Some("DERIVE"),
3543 Self::UnknownValue(u) => u.0.name(),
3544 }
3545 }
3546 }
3547
3548 impl std::default::Default for Method {
3549 fn default() -> Self {
3550 use std::convert::From;
3551 Self::from(0)
3552 }
3553 }
3554
3555 impl std::fmt::Display for Method {
3556 fn fmt(
3557 &self,
3558 f: &mut std::fmt::Formatter<'_>,
3559 ) -> std::result::Result<(), std::fmt::Error> {
3560 wkt::internal::display_enum(f, self.name(), self.value())
3561 }
3562 }
3563
3564 impl std::convert::From<i32> for Method {
3565 fn from(value: i32) -> Self {
3566 match value {
3567 0 => Self::Unspecified,
3568 1 => Self::Extract,
3569 2 => Self::Derive,
3570 _ => Self::UnknownValue(method::UnknownValue(
3571 wkt::internal::UnknownEnumValue::Integer(value),
3572 )),
3573 }
3574 }
3575 }
3576
3577 impl std::convert::From<&str> for Method {
3578 fn from(value: &str) -> Self {
3579 use std::string::ToString;
3580 match value {
3581 "METHOD_UNSPECIFIED" => Self::Unspecified,
3582 "EXTRACT" => Self::Extract,
3583 "DERIVE" => Self::Derive,
3584 _ => Self::UnknownValue(method::UnknownValue(
3585 wkt::internal::UnknownEnumValue::String(value.to_string()),
3586 )),
3587 }
3588 }
3589 }
3590
3591 impl serde::ser::Serialize for Method {
3592 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3593 where
3594 S: serde::Serializer,
3595 {
3596 match self {
3597 Self::Unspecified => serializer.serialize_i32(0),
3598 Self::Extract => serializer.serialize_i32(1),
3599 Self::Derive => serializer.serialize_i32(2),
3600 Self::UnknownValue(u) => u.0.serialize(serializer),
3601 }
3602 }
3603 }
3604
3605 impl<'de> serde::de::Deserialize<'de> for Method {
3606 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3607 where
3608 D: serde::Deserializer<'de>,
3609 {
3610 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
3611 ".google.cloud.documentai.v1.Document.Entity.Method",
3612 ))
3613 }
3614 }
3615 }
3616
3617 #[derive(Clone, Default, PartialEq)]
3622 #[non_exhaustive]
3623 pub struct EntityRelation {
3624 pub subject_id: std::string::String,
3626
3627 pub object_id: std::string::String,
3629
3630 pub relation: std::string::String,
3632
3633 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3634 }
3635
3636 impl EntityRelation {
3637 pub fn new() -> Self {
3638 std::default::Default::default()
3639 }
3640
3641 pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3643 self.subject_id = v.into();
3644 self
3645 }
3646
3647 pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3649 self.object_id = v.into();
3650 self
3651 }
3652
3653 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3655 self.relation = v.into();
3656 self
3657 }
3658 }
3659
3660 impl wkt::message::Message for EntityRelation {
3661 fn typename() -> &'static str {
3662 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
3663 }
3664 }
3665
3666 #[derive(Clone, Default, PartialEq)]
3671 #[non_exhaustive]
3672 pub struct TextAnchor {
3673 pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
3678
3679 pub content: std::string::String,
3683
3684 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3685 }
3686
3687 impl TextAnchor {
3688 pub fn new() -> Self {
3689 std::default::Default::default()
3690 }
3691
3692 pub fn set_text_segments<T, V>(mut self, v: T) -> Self
3694 where
3695 T: std::iter::IntoIterator<Item = V>,
3696 V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
3697 {
3698 use std::iter::Iterator;
3699 self.text_segments = v.into_iter().map(|i| i.into()).collect();
3700 self
3701 }
3702
3703 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3705 self.content = v.into();
3706 self
3707 }
3708 }
3709
3710 impl wkt::message::Message for TextAnchor {
3711 fn typename() -> &'static str {
3712 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
3713 }
3714 }
3715
3716 pub mod text_anchor {
3718 #[allow(unused_imports)]
3719 use super::*;
3720
3721 #[derive(Clone, Default, PartialEq)]
3730 #[non_exhaustive]
3731 pub struct TextSegment {
3732 pub start_index: i64,
3739
3740 pub end_index: i64,
3747
3748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3749 }
3750
3751 impl TextSegment {
3752 pub fn new() -> Self {
3753 std::default::Default::default()
3754 }
3755
3756 pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3758 self.start_index = v.into();
3759 self
3760 }
3761
3762 pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3764 self.end_index = v.into();
3765 self
3766 }
3767 }
3768
3769 impl wkt::message::Message for TextSegment {
3770 fn typename() -> &'static str {
3771 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
3772 }
3773 }
3774 }
3775
3776 #[derive(Clone, Default, PartialEq)]
3783 #[non_exhaustive]
3784 pub struct PageAnchor {
3785 pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
3787
3788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3789 }
3790
3791 impl PageAnchor {
3792 pub fn new() -> Self {
3793 std::default::Default::default()
3794 }
3795
3796 pub fn set_page_refs<T, V>(mut self, v: T) -> Self
3798 where
3799 T: std::iter::IntoIterator<Item = V>,
3800 V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
3801 {
3802 use std::iter::Iterator;
3803 self.page_refs = v.into_iter().map(|i| i.into()).collect();
3804 self
3805 }
3806 }
3807
3808 impl wkt::message::Message for PageAnchor {
3809 fn typename() -> &'static str {
3810 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
3811 }
3812 }
3813
3814 pub mod page_anchor {
3816 #[allow(unused_imports)]
3817 use super::*;
3818
3819 #[derive(Clone, Default, PartialEq)]
3821 #[non_exhaustive]
3822 pub struct PageRef {
3823 pub page: i64,
3832
3833 pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
3836
3837 #[deprecated]
3843 pub layout_id: std::string::String,
3844
3845 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
3849
3850 pub confidence: f32,
3853
3854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3855 }
3856
3857 impl PageRef {
3858 pub fn new() -> Self {
3859 std::default::Default::default()
3860 }
3861
3862 pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3864 self.page = v.into();
3865 self
3866 }
3867
3868 pub fn set_layout_type<
3870 T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
3871 >(
3872 mut self,
3873 v: T,
3874 ) -> Self {
3875 self.layout_type = v.into();
3876 self
3877 }
3878
3879 #[deprecated]
3881 pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
3882 mut self,
3883 v: T,
3884 ) -> Self {
3885 self.layout_id = v.into();
3886 self
3887 }
3888
3889 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
3891 where
3892 T: std::convert::Into<crate::model::BoundingPoly>,
3893 {
3894 self.bounding_poly = std::option::Option::Some(v.into());
3895 self
3896 }
3897
3898 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
3900 where
3901 T: std::convert::Into<crate::model::BoundingPoly>,
3902 {
3903 self.bounding_poly = v.map(|x| x.into());
3904 self
3905 }
3906
3907 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3909 self.confidence = v.into();
3910 self
3911 }
3912 }
3913
3914 impl wkt::message::Message for PageRef {
3915 fn typename() -> &'static str {
3916 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
3917 }
3918 }
3919
3920 pub mod page_ref {
3922 #[allow(unused_imports)]
3923 use super::*;
3924
3925 #[derive(Clone, Debug, PartialEq)]
3941 #[non_exhaustive]
3942 pub enum LayoutType {
3943 Unspecified,
3945 Block,
3951 Paragraph,
3957 Line,
3962 Token,
3968 VisualElement,
3974 Table,
3980 FormField,
3986 UnknownValue(layout_type::UnknownValue),
3991 }
3992
3993 #[doc(hidden)]
3994 pub mod layout_type {
3995 #[allow(unused_imports)]
3996 use super::*;
3997 #[derive(Clone, Debug, PartialEq)]
3998 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3999 }
4000
4001 impl LayoutType {
4002 pub fn value(&self) -> std::option::Option<i32> {
4007 match self {
4008 Self::Unspecified => std::option::Option::Some(0),
4009 Self::Block => std::option::Option::Some(1),
4010 Self::Paragraph => std::option::Option::Some(2),
4011 Self::Line => std::option::Option::Some(3),
4012 Self::Token => std::option::Option::Some(4),
4013 Self::VisualElement => std::option::Option::Some(5),
4014 Self::Table => std::option::Option::Some(6),
4015 Self::FormField => std::option::Option::Some(7),
4016 Self::UnknownValue(u) => u.0.value(),
4017 }
4018 }
4019
4020 pub fn name(&self) -> std::option::Option<&str> {
4025 match self {
4026 Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
4027 Self::Block => std::option::Option::Some("BLOCK"),
4028 Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
4029 Self::Line => std::option::Option::Some("LINE"),
4030 Self::Token => std::option::Option::Some("TOKEN"),
4031 Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
4032 Self::Table => std::option::Option::Some("TABLE"),
4033 Self::FormField => std::option::Option::Some("FORM_FIELD"),
4034 Self::UnknownValue(u) => u.0.name(),
4035 }
4036 }
4037 }
4038
4039 impl std::default::Default for LayoutType {
4040 fn default() -> Self {
4041 use std::convert::From;
4042 Self::from(0)
4043 }
4044 }
4045
4046 impl std::fmt::Display for LayoutType {
4047 fn fmt(
4048 &self,
4049 f: &mut std::fmt::Formatter<'_>,
4050 ) -> std::result::Result<(), std::fmt::Error> {
4051 wkt::internal::display_enum(f, self.name(), self.value())
4052 }
4053 }
4054
4055 impl std::convert::From<i32> for LayoutType {
4056 fn from(value: i32) -> Self {
4057 match value {
4058 0 => Self::Unspecified,
4059 1 => Self::Block,
4060 2 => Self::Paragraph,
4061 3 => Self::Line,
4062 4 => Self::Token,
4063 5 => Self::VisualElement,
4064 6 => Self::Table,
4065 7 => Self::FormField,
4066 _ => Self::UnknownValue(layout_type::UnknownValue(
4067 wkt::internal::UnknownEnumValue::Integer(value),
4068 )),
4069 }
4070 }
4071 }
4072
4073 impl std::convert::From<&str> for LayoutType {
4074 fn from(value: &str) -> Self {
4075 use std::string::ToString;
4076 match value {
4077 "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
4078 "BLOCK" => Self::Block,
4079 "PARAGRAPH" => Self::Paragraph,
4080 "LINE" => Self::Line,
4081 "TOKEN" => Self::Token,
4082 "VISUAL_ELEMENT" => Self::VisualElement,
4083 "TABLE" => Self::Table,
4084 "FORM_FIELD" => Self::FormField,
4085 _ => Self::UnknownValue(layout_type::UnknownValue(
4086 wkt::internal::UnknownEnumValue::String(value.to_string()),
4087 )),
4088 }
4089 }
4090 }
4091
4092 impl serde::ser::Serialize for LayoutType {
4093 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4094 where
4095 S: serde::Serializer,
4096 {
4097 match self {
4098 Self::Unspecified => serializer.serialize_i32(0),
4099 Self::Block => serializer.serialize_i32(1),
4100 Self::Paragraph => serializer.serialize_i32(2),
4101 Self::Line => serializer.serialize_i32(3),
4102 Self::Token => serializer.serialize_i32(4),
4103 Self::VisualElement => serializer.serialize_i32(5),
4104 Self::Table => serializer.serialize_i32(6),
4105 Self::FormField => serializer.serialize_i32(7),
4106 Self::UnknownValue(u) => u.0.serialize(serializer),
4107 }
4108 }
4109 }
4110
4111 impl<'de> serde::de::Deserialize<'de> for LayoutType {
4112 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4113 where
4114 D: serde::Deserializer<'de>,
4115 {
4116 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
4117 ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
4118 ))
4119 }
4120 }
4121 }
4122 }
4123
4124 #[derive(Clone, Default, PartialEq)]
4127 #[non_exhaustive]
4128 pub struct Provenance {
4129 #[deprecated]
4131 pub revision: i32,
4132
4133 #[deprecated]
4136 pub id: i32,
4137
4138 pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
4140
4141 pub r#type: crate::model::document::provenance::OperationType,
4143
4144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4145 }
4146
4147 impl Provenance {
4148 pub fn new() -> Self {
4149 std::default::Default::default()
4150 }
4151
4152 #[deprecated]
4154 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4155 self.revision = v.into();
4156 self
4157 }
4158
4159 #[deprecated]
4161 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4162 self.id = v.into();
4163 self
4164 }
4165
4166 pub fn set_parents<T, V>(mut self, v: T) -> Self
4168 where
4169 T: std::iter::IntoIterator<Item = V>,
4170 V: std::convert::Into<crate::model::document::provenance::Parent>,
4171 {
4172 use std::iter::Iterator;
4173 self.parents = v.into_iter().map(|i| i.into()).collect();
4174 self
4175 }
4176
4177 pub fn set_type<
4179 T: std::convert::Into<crate::model::document::provenance::OperationType>,
4180 >(
4181 mut self,
4182 v: T,
4183 ) -> Self {
4184 self.r#type = v.into();
4185 self
4186 }
4187 }
4188
4189 impl wkt::message::Message for Provenance {
4190 fn typename() -> &'static str {
4191 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
4192 }
4193 }
4194
4195 pub mod provenance {
4197 #[allow(unused_imports)]
4198 use super::*;
4199
4200 #[derive(Clone, Default, PartialEq)]
4203 #[non_exhaustive]
4204 pub struct Parent {
4205 pub revision: i32,
4207
4208 pub index: i32,
4211
4212 #[deprecated]
4214 pub id: i32,
4215
4216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4217 }
4218
4219 impl Parent {
4220 pub fn new() -> Self {
4221 std::default::Default::default()
4222 }
4223
4224 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4226 self.revision = v.into();
4227 self
4228 }
4229
4230 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4232 self.index = v.into();
4233 self
4234 }
4235
4236 #[deprecated]
4238 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4239 self.id = v.into();
4240 self
4241 }
4242 }
4243
4244 impl wkt::message::Message for Parent {
4245 fn typename() -> &'static str {
4246 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
4247 }
4248 }
4249
4250 #[derive(Clone, Debug, PartialEq)]
4266 #[non_exhaustive]
4267 pub enum OperationType {
4268 Unspecified,
4271 Add,
4273 Remove,
4275 Update,
4280 Replace,
4282 #[deprecated]
4285 EvalRequested,
4286 #[deprecated]
4289 EvalApproved,
4290 #[deprecated]
4292 EvalSkipped,
4293 UnknownValue(operation_type::UnknownValue),
4298 }
4299
4300 #[doc(hidden)]
4301 pub mod operation_type {
4302 #[allow(unused_imports)]
4303 use super::*;
4304 #[derive(Clone, Debug, PartialEq)]
4305 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4306 }
4307
4308 impl OperationType {
4309 pub fn value(&self) -> std::option::Option<i32> {
4314 match self {
4315 Self::Unspecified => std::option::Option::Some(0),
4316 Self::Add => std::option::Option::Some(1),
4317 Self::Remove => std::option::Option::Some(2),
4318 Self::Update => std::option::Option::Some(7),
4319 Self::Replace => std::option::Option::Some(3),
4320 Self::EvalRequested => std::option::Option::Some(4),
4321 Self::EvalApproved => std::option::Option::Some(5),
4322 Self::EvalSkipped => std::option::Option::Some(6),
4323 Self::UnknownValue(u) => u.0.value(),
4324 }
4325 }
4326
4327 pub fn name(&self) -> std::option::Option<&str> {
4332 match self {
4333 Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
4334 Self::Add => std::option::Option::Some("ADD"),
4335 Self::Remove => std::option::Option::Some("REMOVE"),
4336 Self::Update => std::option::Option::Some("UPDATE"),
4337 Self::Replace => std::option::Option::Some("REPLACE"),
4338 Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
4339 Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
4340 Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
4341 Self::UnknownValue(u) => u.0.name(),
4342 }
4343 }
4344 }
4345
4346 impl std::default::Default for OperationType {
4347 fn default() -> Self {
4348 use std::convert::From;
4349 Self::from(0)
4350 }
4351 }
4352
4353 impl std::fmt::Display for OperationType {
4354 fn fmt(
4355 &self,
4356 f: &mut std::fmt::Formatter<'_>,
4357 ) -> std::result::Result<(), std::fmt::Error> {
4358 wkt::internal::display_enum(f, self.name(), self.value())
4359 }
4360 }
4361
4362 impl std::convert::From<i32> for OperationType {
4363 fn from(value: i32) -> Self {
4364 match value {
4365 0 => Self::Unspecified,
4366 1 => Self::Add,
4367 2 => Self::Remove,
4368 3 => Self::Replace,
4369 4 => Self::EvalRequested,
4370 5 => Self::EvalApproved,
4371 6 => Self::EvalSkipped,
4372 7 => Self::Update,
4373 _ => Self::UnknownValue(operation_type::UnknownValue(
4374 wkt::internal::UnknownEnumValue::Integer(value),
4375 )),
4376 }
4377 }
4378 }
4379
4380 impl std::convert::From<&str> for OperationType {
4381 fn from(value: &str) -> Self {
4382 use std::string::ToString;
4383 match value {
4384 "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
4385 "ADD" => Self::Add,
4386 "REMOVE" => Self::Remove,
4387 "UPDATE" => Self::Update,
4388 "REPLACE" => Self::Replace,
4389 "EVAL_REQUESTED" => Self::EvalRequested,
4390 "EVAL_APPROVED" => Self::EvalApproved,
4391 "EVAL_SKIPPED" => Self::EvalSkipped,
4392 _ => Self::UnknownValue(operation_type::UnknownValue(
4393 wkt::internal::UnknownEnumValue::String(value.to_string()),
4394 )),
4395 }
4396 }
4397 }
4398
4399 impl serde::ser::Serialize for OperationType {
4400 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4401 where
4402 S: serde::Serializer,
4403 {
4404 match self {
4405 Self::Unspecified => serializer.serialize_i32(0),
4406 Self::Add => serializer.serialize_i32(1),
4407 Self::Remove => serializer.serialize_i32(2),
4408 Self::Update => serializer.serialize_i32(7),
4409 Self::Replace => serializer.serialize_i32(3),
4410 Self::EvalRequested => serializer.serialize_i32(4),
4411 Self::EvalApproved => serializer.serialize_i32(5),
4412 Self::EvalSkipped => serializer.serialize_i32(6),
4413 Self::UnknownValue(u) => u.0.serialize(serializer),
4414 }
4415 }
4416 }
4417
4418 impl<'de> serde::de::Deserialize<'de> for OperationType {
4419 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4420 where
4421 D: serde::Deserializer<'de>,
4422 {
4423 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
4424 ".google.cloud.documentai.v1.Document.Provenance.OperationType",
4425 ))
4426 }
4427 }
4428 }
4429
4430 #[derive(Clone, Default, PartialEq)]
4432 #[non_exhaustive]
4433 pub struct Revision {
4434 pub id: std::string::String,
4437
4438 #[deprecated]
4442 pub parent: std::vec::Vec<i32>,
4443
4444 pub parent_ids: std::vec::Vec<std::string::String>,
4448
4449 pub create_time: std::option::Option<wkt::Timestamp>,
4452
4453 pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
4455
4456 pub source: std::option::Option<crate::model::document::revision::Source>,
4458
4459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4460 }
4461
4462 impl Revision {
4463 pub fn new() -> Self {
4464 std::default::Default::default()
4465 }
4466
4467 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4469 self.id = v.into();
4470 self
4471 }
4472
4473 #[deprecated]
4475 pub fn set_parent<T, V>(mut self, v: T) -> Self
4476 where
4477 T: std::iter::IntoIterator<Item = V>,
4478 V: std::convert::Into<i32>,
4479 {
4480 use std::iter::Iterator;
4481 self.parent = v.into_iter().map(|i| i.into()).collect();
4482 self
4483 }
4484
4485 pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
4487 where
4488 T: std::iter::IntoIterator<Item = V>,
4489 V: std::convert::Into<std::string::String>,
4490 {
4491 use std::iter::Iterator;
4492 self.parent_ids = v.into_iter().map(|i| i.into()).collect();
4493 self
4494 }
4495
4496 pub fn set_create_time<T>(mut self, v: T) -> Self
4498 where
4499 T: std::convert::Into<wkt::Timestamp>,
4500 {
4501 self.create_time = std::option::Option::Some(v.into());
4502 self
4503 }
4504
4505 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4507 where
4508 T: std::convert::Into<wkt::Timestamp>,
4509 {
4510 self.create_time = v.map(|x| x.into());
4511 self
4512 }
4513
4514 pub fn set_human_review<T>(mut self, v: T) -> Self
4516 where
4517 T: std::convert::Into<crate::model::document::revision::HumanReview>,
4518 {
4519 self.human_review = std::option::Option::Some(v.into());
4520 self
4521 }
4522
4523 pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
4525 where
4526 T: std::convert::Into<crate::model::document::revision::HumanReview>,
4527 {
4528 self.human_review = v.map(|x| x.into());
4529 self
4530 }
4531
4532 pub fn set_source<
4537 T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
4538 >(
4539 mut self,
4540 v: T,
4541 ) -> Self {
4542 self.source = v.into();
4543 self
4544 }
4545
4546 pub fn agent(&self) -> std::option::Option<&std::string::String> {
4550 #[allow(unreachable_patterns)]
4551 self.source.as_ref().and_then(|v| match v {
4552 crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
4553 _ => std::option::Option::None,
4554 })
4555 }
4556
4557 pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4563 self.source = std::option::Option::Some(
4564 crate::model::document::revision::Source::Agent(v.into()),
4565 );
4566 self
4567 }
4568
4569 pub fn processor(&self) -> std::option::Option<&std::string::String> {
4573 #[allow(unreachable_patterns)]
4574 self.source.as_ref().and_then(|v| match v {
4575 crate::model::document::revision::Source::Processor(v) => {
4576 std::option::Option::Some(v)
4577 }
4578 _ => std::option::Option::None,
4579 })
4580 }
4581
4582 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4588 self.source = std::option::Option::Some(
4589 crate::model::document::revision::Source::Processor(v.into()),
4590 );
4591 self
4592 }
4593 }
4594
4595 impl wkt::message::Message for Revision {
4596 fn typename() -> &'static str {
4597 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
4598 }
4599 }
4600
4601 pub mod revision {
4603 #[allow(unused_imports)]
4604 use super::*;
4605
4606 #[derive(Clone, Default, PartialEq)]
4608 #[non_exhaustive]
4609 pub struct HumanReview {
4610 pub state: std::string::String,
4612
4613 pub state_message: std::string::String,
4616
4617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4618 }
4619
4620 impl HumanReview {
4621 pub fn new() -> Self {
4622 std::default::Default::default()
4623 }
4624
4625 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4627 self.state = v.into();
4628 self
4629 }
4630
4631 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
4633 mut self,
4634 v: T,
4635 ) -> Self {
4636 self.state_message = v.into();
4637 self
4638 }
4639 }
4640
4641 impl wkt::message::Message for HumanReview {
4642 fn typename() -> &'static str {
4643 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
4644 }
4645 }
4646
4647 #[derive(Clone, Debug, PartialEq)]
4649 #[non_exhaustive]
4650 pub enum Source {
4651 Agent(std::string::String),
4654 Processor(std::string::String),
4657 }
4658 }
4659
4660 #[derive(Clone, Default, PartialEq)]
4662 #[non_exhaustive]
4663 pub struct TextChange {
4664 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4673
4674 pub changed_text: std::string::String,
4676
4677 #[deprecated]
4679 pub provenance: std::vec::Vec<crate::model::document::Provenance>,
4680
4681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4682 }
4683
4684 impl TextChange {
4685 pub fn new() -> Self {
4686 std::default::Default::default()
4687 }
4688
4689 pub fn set_text_anchor<T>(mut self, v: T) -> Self
4691 where
4692 T: std::convert::Into<crate::model::document::TextAnchor>,
4693 {
4694 self.text_anchor = std::option::Option::Some(v.into());
4695 self
4696 }
4697
4698 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4700 where
4701 T: std::convert::Into<crate::model::document::TextAnchor>,
4702 {
4703 self.text_anchor = v.map(|x| x.into());
4704 self
4705 }
4706
4707 pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
4709 mut self,
4710 v: T,
4711 ) -> Self {
4712 self.changed_text = v.into();
4713 self
4714 }
4715
4716 #[deprecated]
4718 pub fn set_provenance<T, V>(mut self, v: T) -> Self
4719 where
4720 T: std::iter::IntoIterator<Item = V>,
4721 V: std::convert::Into<crate::model::document::Provenance>,
4722 {
4723 use std::iter::Iterator;
4724 self.provenance = v.into_iter().map(|i| i.into()).collect();
4725 self
4726 }
4727 }
4728
4729 impl wkt::message::Message for TextChange {
4730 fn typename() -> &'static str {
4731 "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
4732 }
4733 }
4734
4735 #[derive(Clone, Default, PartialEq)]
4738 #[non_exhaustive]
4739 pub struct DocumentLayout {
4740 pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
4742
4743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4744 }
4745
4746 impl DocumentLayout {
4747 pub fn new() -> Self {
4748 std::default::Default::default()
4749 }
4750
4751 pub fn set_blocks<T, V>(mut self, v: T) -> Self
4753 where
4754 T: std::iter::IntoIterator<Item = V>,
4755 V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
4756 {
4757 use std::iter::Iterator;
4758 self.blocks = v.into_iter().map(|i| i.into()).collect();
4759 self
4760 }
4761 }
4762
4763 impl wkt::message::Message for DocumentLayout {
4764 fn typename() -> &'static str {
4765 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
4766 }
4767 }
4768
4769 pub mod document_layout {
4771 #[allow(unused_imports)]
4772 use super::*;
4773
4774 #[derive(Clone, Default, PartialEq)]
4777 #[non_exhaustive]
4778 pub struct DocumentLayoutBlock {
4779 pub block_id: std::string::String,
4781
4782 pub page_span: std::option::Option<
4784 crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
4785 >,
4786
4787 pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
4789
4790 pub block: std::option::Option<
4791 crate::model::document::document_layout::document_layout_block::Block,
4792 >,
4793
4794 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4795 }
4796
4797 impl DocumentLayoutBlock {
4798 pub fn new() -> Self {
4799 std::default::Default::default()
4800 }
4801
4802 pub fn set_block_id<T: std::convert::Into<std::string::String>>(
4804 mut self,
4805 v: T,
4806 ) -> Self {
4807 self.block_id = v.into();
4808 self
4809 }
4810
4811 pub fn set_page_span<T>(mut self, v: T) -> Self
4813 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
4814 {
4815 self.page_span = std::option::Option::Some(v.into());
4816 self
4817 }
4818
4819 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
4821 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
4822 {
4823 self.page_span = v.map(|x| x.into());
4824 self
4825 }
4826
4827 pub fn set_bounding_box<T>(mut self, v: T) -> Self
4829 where
4830 T: std::convert::Into<crate::model::BoundingPoly>,
4831 {
4832 self.bounding_box = std::option::Option::Some(v.into());
4833 self
4834 }
4835
4836 pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
4838 where
4839 T: std::convert::Into<crate::model::BoundingPoly>,
4840 {
4841 self.bounding_box = v.map(|x| x.into());
4842 self
4843 }
4844
4845 pub fn set_block<
4850 T: std::convert::Into<
4851 std::option::Option<
4852 crate::model::document::document_layout::document_layout_block::Block,
4853 >,
4854 >,
4855 >(
4856 mut self,
4857 v: T,
4858 ) -> Self {
4859 self.block = v.into();
4860 self
4861 }
4862
4863 pub fn text_block(
4867 &self,
4868 ) -> std::option::Option<
4869 &std::boxed::Box<
4870 crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
4871 >,
4872 > {
4873 #[allow(unreachable_patterns)]
4874 self.block.as_ref().and_then(|v| match v {
4875 crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
4876 _ => std::option::Option::None,
4877 })
4878 }
4879
4880 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{
4886 self.block = std::option::Option::Some(
4887 crate::model::document::document_layout::document_layout_block::Block::TextBlock(
4888 v.into()
4889 )
4890 );
4891 self
4892 }
4893
4894 pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
4898 #[allow(unreachable_patterns)]
4899 self.block.as_ref().and_then(|v| match v {
4900 crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
4901 _ => std::option::Option::None,
4902 })
4903 }
4904
4905 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{
4911 self.block = std::option::Option::Some(
4912 crate::model::document::document_layout::document_layout_block::Block::TableBlock(
4913 v.into()
4914 )
4915 );
4916 self
4917 }
4918
4919 pub fn list_block(
4923 &self,
4924 ) -> std::option::Option<
4925 &std::boxed::Box<
4926 crate::model::document::document_layout::document_layout_block::LayoutListBlock,
4927 >,
4928 > {
4929 #[allow(unreachable_patterns)]
4930 self.block.as_ref().and_then(|v| match v {
4931 crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
4932 _ => std::option::Option::None,
4933 })
4934 }
4935
4936 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{
4942 self.block = std::option::Option::Some(
4943 crate::model::document::document_layout::document_layout_block::Block::ListBlock(
4944 v.into()
4945 )
4946 );
4947 self
4948 }
4949 }
4950
4951 impl wkt::message::Message for DocumentLayoutBlock {
4952 fn typename() -> &'static str {
4953 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
4954 }
4955 }
4956
4957 pub mod document_layout_block {
4959 #[allow(unused_imports)]
4960 use super::*;
4961
4962 #[derive(Clone, Default, PartialEq)]
4964 #[non_exhaustive]
4965 pub struct LayoutPageSpan {
4966 pub page_start: i32,
4968
4969 pub page_end: i32,
4971
4972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4973 }
4974
4975 impl LayoutPageSpan {
4976 pub fn new() -> Self {
4977 std::default::Default::default()
4978 }
4979
4980 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4982 self.page_start = v.into();
4983 self
4984 }
4985
4986 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4988 self.page_end = v.into();
4989 self
4990 }
4991 }
4992
4993 impl wkt::message::Message for LayoutPageSpan {
4994 fn typename() -> &'static str {
4995 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
4996 }
4997 }
4998
4999 #[derive(Clone, Default, PartialEq)]
5001 #[non_exhaustive]
5002 pub struct LayoutTextBlock {
5003 pub text: std::string::String,
5005
5006 pub r#type: std::string::String,
5010
5011 pub blocks:
5014 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
5015
5016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5017 }
5018
5019 impl LayoutTextBlock {
5020 pub fn new() -> Self {
5021 std::default::Default::default()
5022 }
5023
5024 pub fn set_text<T: std::convert::Into<std::string::String>>(
5026 mut self,
5027 v: T,
5028 ) -> Self {
5029 self.text = v.into();
5030 self
5031 }
5032
5033 pub fn set_type<T: std::convert::Into<std::string::String>>(
5035 mut self,
5036 v: T,
5037 ) -> Self {
5038 self.r#type = v.into();
5039 self
5040 }
5041
5042 pub fn set_blocks<T, V>(mut self, v: T) -> Self
5044 where
5045 T: std::iter::IntoIterator<Item = V>,
5046 V: std::convert::Into<
5047 crate::model::document::document_layout::DocumentLayoutBlock,
5048 >,
5049 {
5050 use std::iter::Iterator;
5051 self.blocks = v.into_iter().map(|i| i.into()).collect();
5052 self
5053 }
5054 }
5055
5056 impl wkt::message::Message for LayoutTextBlock {
5057 fn typename() -> &'static str {
5058 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
5059 }
5060 }
5061
5062 #[derive(Clone, Default, PartialEq)]
5064 #[non_exhaustive]
5065 pub struct LayoutTableBlock {
5066 pub header_rows: std::vec::Vec<
5068 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
5069 >,
5070
5071 pub body_rows: std::vec::Vec<
5073 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
5074 >,
5075
5076 pub caption: std::string::String,
5078
5079 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5080 }
5081
5082 impl LayoutTableBlock {
5083 pub fn new() -> Self {
5084 std::default::Default::default()
5085 }
5086
5087 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
5089 where
5090 T: std::iter::IntoIterator<Item = V>,
5091 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
5092 {
5093 use std::iter::Iterator;
5094 self.header_rows = v.into_iter().map(|i| i.into()).collect();
5095 self
5096 }
5097
5098 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
5100 where
5101 T: std::iter::IntoIterator<Item = V>,
5102 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
5103 {
5104 use std::iter::Iterator;
5105 self.body_rows = v.into_iter().map(|i| i.into()).collect();
5106 self
5107 }
5108
5109 pub fn set_caption<T: std::convert::Into<std::string::String>>(
5111 mut self,
5112 v: T,
5113 ) -> Self {
5114 self.caption = v.into();
5115 self
5116 }
5117 }
5118
5119 impl wkt::message::Message for LayoutTableBlock {
5120 fn typename() -> &'static str {
5121 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
5122 }
5123 }
5124
5125 #[derive(Clone, Default, PartialEq)]
5127 #[non_exhaustive]
5128 pub struct LayoutTableRow {
5129 pub cells: std::vec::Vec<
5131 crate::model::document::document_layout::document_layout_block::LayoutTableCell,
5132 >,
5133
5134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5135 }
5136
5137 impl LayoutTableRow {
5138 pub fn new() -> Self {
5139 std::default::Default::default()
5140 }
5141
5142 pub fn set_cells<T, V>(mut self, v: T) -> Self
5144 where
5145 T: std::iter::IntoIterator<Item = V>,
5146 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
5147 {
5148 use std::iter::Iterator;
5149 self.cells = v.into_iter().map(|i| i.into()).collect();
5150 self
5151 }
5152 }
5153
5154 impl wkt::message::Message for LayoutTableRow {
5155 fn typename() -> &'static str {
5156 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
5157 }
5158 }
5159
5160 #[derive(Clone, Default, PartialEq)]
5162 #[non_exhaustive]
5163 pub struct LayoutTableCell {
5164 pub blocks:
5167 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
5168
5169 pub row_span: i32,
5171
5172 pub col_span: i32,
5174
5175 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5176 }
5177
5178 impl LayoutTableCell {
5179 pub fn new() -> Self {
5180 std::default::Default::default()
5181 }
5182
5183 pub fn set_blocks<T, V>(mut self, v: T) -> Self
5185 where
5186 T: std::iter::IntoIterator<Item = V>,
5187 V: std::convert::Into<
5188 crate::model::document::document_layout::DocumentLayoutBlock,
5189 >,
5190 {
5191 use std::iter::Iterator;
5192 self.blocks = v.into_iter().map(|i| i.into()).collect();
5193 self
5194 }
5195
5196 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5198 self.row_span = v.into();
5199 self
5200 }
5201
5202 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5204 self.col_span = v.into();
5205 self
5206 }
5207 }
5208
5209 impl wkt::message::Message for LayoutTableCell {
5210 fn typename() -> &'static str {
5211 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
5212 }
5213 }
5214
5215 #[derive(Clone, Default, PartialEq)]
5217 #[non_exhaustive]
5218 pub struct LayoutListBlock {
5219 pub list_entries: std::vec::Vec<
5221 crate::model::document::document_layout::document_layout_block::LayoutListEntry,
5222 >,
5223
5224 pub r#type: std::string::String,
5227
5228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5229 }
5230
5231 impl LayoutListBlock {
5232 pub fn new() -> Self {
5233 std::default::Default::default()
5234 }
5235
5236 pub fn set_list_entries<T, V>(mut self, v: T) -> Self
5238 where
5239 T: std::iter::IntoIterator<Item = V>,
5240 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
5241 {
5242 use std::iter::Iterator;
5243 self.list_entries = v.into_iter().map(|i| i.into()).collect();
5244 self
5245 }
5246
5247 pub fn set_type<T: std::convert::Into<std::string::String>>(
5249 mut self,
5250 v: T,
5251 ) -> Self {
5252 self.r#type = v.into();
5253 self
5254 }
5255 }
5256
5257 impl wkt::message::Message for LayoutListBlock {
5258 fn typename() -> &'static str {
5259 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
5260 }
5261 }
5262
5263 #[derive(Clone, Default, PartialEq)]
5265 #[non_exhaustive]
5266 pub struct LayoutListEntry {
5267 pub blocks:
5270 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
5271
5272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5273 }
5274
5275 impl LayoutListEntry {
5276 pub fn new() -> Self {
5277 std::default::Default::default()
5278 }
5279
5280 pub fn set_blocks<T, V>(mut self, v: T) -> Self
5282 where
5283 T: std::iter::IntoIterator<Item = V>,
5284 V: std::convert::Into<
5285 crate::model::document::document_layout::DocumentLayoutBlock,
5286 >,
5287 {
5288 use std::iter::Iterator;
5289 self.blocks = v.into_iter().map(|i| i.into()).collect();
5290 self
5291 }
5292 }
5293
5294 impl wkt::message::Message for LayoutListEntry {
5295 fn typename() -> &'static str {
5296 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
5297 }
5298 }
5299
5300 #[derive(Clone, Debug, PartialEq)]
5301 #[non_exhaustive]
5302 pub enum Block {
5303 TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
5305 TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
5307 ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
5309 }
5310 }
5311 }
5312
5313 #[derive(Clone, Default, PartialEq)]
5315 #[non_exhaustive]
5316 pub struct ChunkedDocument {
5317 pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
5319
5320 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5321 }
5322
5323 impl ChunkedDocument {
5324 pub fn new() -> Self {
5325 std::default::Default::default()
5326 }
5327
5328 pub fn set_chunks<T, V>(mut self, v: T) -> Self
5330 where
5331 T: std::iter::IntoIterator<Item = V>,
5332 V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
5333 {
5334 use std::iter::Iterator;
5335 self.chunks = v.into_iter().map(|i| i.into()).collect();
5336 self
5337 }
5338 }
5339
5340 impl wkt::message::Message for ChunkedDocument {
5341 fn typename() -> &'static str {
5342 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
5343 }
5344 }
5345
5346 pub mod chunked_document {
5348 #[allow(unused_imports)]
5349 use super::*;
5350
5351 #[derive(Clone, Default, PartialEq)]
5353 #[non_exhaustive]
5354 pub struct Chunk {
5355 pub chunk_id: std::string::String,
5357
5358 pub source_block_ids: std::vec::Vec<std::string::String>,
5360
5361 pub content: std::string::String,
5363
5364 pub page_span:
5366 std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
5367
5368 pub page_headers:
5370 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
5371
5372 pub page_footers:
5374 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
5375
5376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5377 }
5378
5379 impl Chunk {
5380 pub fn new() -> Self {
5381 std::default::Default::default()
5382 }
5383
5384 pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
5386 mut self,
5387 v: T,
5388 ) -> Self {
5389 self.chunk_id = v.into();
5390 self
5391 }
5392
5393 pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
5395 where
5396 T: std::iter::IntoIterator<Item = V>,
5397 V: std::convert::Into<std::string::String>,
5398 {
5399 use std::iter::Iterator;
5400 self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
5401 self
5402 }
5403
5404 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5406 self.content = v.into();
5407 self
5408 }
5409
5410 pub fn set_page_span<T>(mut self, v: T) -> Self
5412 where
5413 T: std::convert::Into<
5414 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5415 >,
5416 {
5417 self.page_span = std::option::Option::Some(v.into());
5418 self
5419 }
5420
5421 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
5423 where
5424 T: std::convert::Into<
5425 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5426 >,
5427 {
5428 self.page_span = v.map(|x| x.into());
5429 self
5430 }
5431
5432 pub fn set_page_headers<T, V>(mut self, v: T) -> Self
5434 where
5435 T: std::iter::IntoIterator<Item = V>,
5436 V: std::convert::Into<
5437 crate::model::document::chunked_document::chunk::ChunkPageHeader,
5438 >,
5439 {
5440 use std::iter::Iterator;
5441 self.page_headers = v.into_iter().map(|i| i.into()).collect();
5442 self
5443 }
5444
5445 pub fn set_page_footers<T, V>(mut self, v: T) -> Self
5447 where
5448 T: std::iter::IntoIterator<Item = V>,
5449 V: std::convert::Into<
5450 crate::model::document::chunked_document::chunk::ChunkPageFooter,
5451 >,
5452 {
5453 use std::iter::Iterator;
5454 self.page_footers = v.into_iter().map(|i| i.into()).collect();
5455 self
5456 }
5457 }
5458
5459 impl wkt::message::Message for Chunk {
5460 fn typename() -> &'static str {
5461 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
5462 }
5463 }
5464
5465 pub mod chunk {
5467 #[allow(unused_imports)]
5468 use super::*;
5469
5470 #[derive(Clone, Default, PartialEq)]
5472 #[non_exhaustive]
5473 pub struct ChunkPageSpan {
5474 pub page_start: i32,
5476
5477 pub page_end: i32,
5479
5480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5481 }
5482
5483 impl ChunkPageSpan {
5484 pub fn new() -> Self {
5485 std::default::Default::default()
5486 }
5487
5488 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5490 self.page_start = v.into();
5491 self
5492 }
5493
5494 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5496 self.page_end = v.into();
5497 self
5498 }
5499 }
5500
5501 impl wkt::message::Message for ChunkPageSpan {
5502 fn typename() -> &'static str {
5503 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
5504 }
5505 }
5506
5507 #[derive(Clone, Default, PartialEq)]
5509 #[non_exhaustive]
5510 pub struct ChunkPageHeader {
5511 pub text: std::string::String,
5513
5514 pub page_span: std::option::Option<
5516 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5517 >,
5518
5519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5520 }
5521
5522 impl ChunkPageHeader {
5523 pub fn new() -> Self {
5524 std::default::Default::default()
5525 }
5526
5527 pub fn set_text<T: std::convert::Into<std::string::String>>(
5529 mut self,
5530 v: T,
5531 ) -> Self {
5532 self.text = v.into();
5533 self
5534 }
5535
5536 pub fn set_page_span<T>(mut self, v: T) -> Self
5538 where
5539 T: std::convert::Into<
5540 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5541 >,
5542 {
5543 self.page_span = std::option::Option::Some(v.into());
5544 self
5545 }
5546
5547 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
5549 where
5550 T: std::convert::Into<
5551 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5552 >,
5553 {
5554 self.page_span = v.map(|x| x.into());
5555 self
5556 }
5557 }
5558
5559 impl wkt::message::Message for ChunkPageHeader {
5560 fn typename() -> &'static str {
5561 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
5562 }
5563 }
5564
5565 #[derive(Clone, Default, PartialEq)]
5567 #[non_exhaustive]
5568 pub struct ChunkPageFooter {
5569 pub text: std::string::String,
5571
5572 pub page_span: std::option::Option<
5574 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5575 >,
5576
5577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5578 }
5579
5580 impl ChunkPageFooter {
5581 pub fn new() -> Self {
5582 std::default::Default::default()
5583 }
5584
5585 pub fn set_text<T: std::convert::Into<std::string::String>>(
5587 mut self,
5588 v: T,
5589 ) -> Self {
5590 self.text = v.into();
5591 self
5592 }
5593
5594 pub fn set_page_span<T>(mut self, v: T) -> Self
5596 where
5597 T: std::convert::Into<
5598 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5599 >,
5600 {
5601 self.page_span = std::option::Option::Some(v.into());
5602 self
5603 }
5604
5605 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
5607 where
5608 T: std::convert::Into<
5609 crate::model::document::chunked_document::chunk::ChunkPageSpan,
5610 >,
5611 {
5612 self.page_span = v.map(|x| x.into());
5613 self
5614 }
5615 }
5616
5617 impl wkt::message::Message for ChunkPageFooter {
5618 fn typename() -> &'static str {
5619 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
5620 }
5621 }
5622 }
5623 }
5624
5625 #[derive(Clone, Default, PartialEq)]
5627 #[non_exhaustive]
5628 pub struct EntityValidationOutput {
5629 pub validation_results:
5631 std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
5632
5633 pub pass_all_rules: bool,
5636
5637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5638 }
5639
5640 impl EntityValidationOutput {
5641 pub fn new() -> Self {
5642 std::default::Default::default()
5643 }
5644
5645 pub fn set_validation_results<T, V>(mut self, v: T) -> Self
5647 where
5648 T: std::iter::IntoIterator<Item = V>,
5649 V: std::convert::Into<
5650 crate::model::document::entity_validation_output::ValidationResult,
5651 >,
5652 {
5653 use std::iter::Iterator;
5654 self.validation_results = v.into_iter().map(|i| i.into()).collect();
5655 self
5656 }
5657
5658 pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5660 self.pass_all_rules = v.into();
5661 self
5662 }
5663 }
5664
5665 impl wkt::message::Message for EntityValidationOutput {
5666 fn typename() -> &'static str {
5667 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
5668 }
5669 }
5670
5671 pub mod entity_validation_output {
5673 #[allow(unused_imports)]
5674 use super::*;
5675
5676 #[derive(Clone, Default, PartialEq)]
5678 #[non_exhaustive]
5679 pub struct ValidationResult {
5680
5681 pub rule_name: std::string::String,
5683
5684 pub rule_description: std::string::String,
5686
5687 pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
5689
5690 pub validation_details: std::string::String,
5693
5694 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5695 }
5696
5697 impl ValidationResult {
5698 pub fn new() -> Self {
5699 std::default::Default::default()
5700 }
5701
5702 pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
5704 mut self,
5705 v: T,
5706 ) -> Self {
5707 self.rule_name = v.into();
5708 self
5709 }
5710
5711 pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
5713 mut self,
5714 v: T,
5715 ) -> Self {
5716 self.rule_description = v.into();
5717 self
5718 }
5719
5720 pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
5722 self.validation_result_type = v.into();
5723 self
5724 }
5725
5726 pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
5728 mut self,
5729 v: T,
5730 ) -> Self {
5731 self.validation_details = v.into();
5732 self
5733 }
5734 }
5735
5736 impl wkt::message::Message for ValidationResult {
5737 fn typename() -> &'static str {
5738 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
5739 }
5740 }
5741
5742 pub mod validation_result {
5744 #[allow(unused_imports)]
5745 use super::*;
5746
5747 #[derive(Clone, Debug, PartialEq)]
5763 #[non_exhaustive]
5764 pub enum ValidationResultType {
5765 Unspecified,
5767 Valid,
5769 Invalid,
5771 Skipped,
5773 NotApplicable,
5775 UnknownValue(validation_result_type::UnknownValue),
5780 }
5781
5782 #[doc(hidden)]
5783 pub mod validation_result_type {
5784 #[allow(unused_imports)]
5785 use super::*;
5786 #[derive(Clone, Debug, PartialEq)]
5787 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5788 }
5789
5790 impl ValidationResultType {
5791 pub fn value(&self) -> std::option::Option<i32> {
5796 match self {
5797 Self::Unspecified => std::option::Option::Some(0),
5798 Self::Valid => std::option::Option::Some(1),
5799 Self::Invalid => std::option::Option::Some(2),
5800 Self::Skipped => std::option::Option::Some(3),
5801 Self::NotApplicable => std::option::Option::Some(4),
5802 Self::UnknownValue(u) => u.0.value(),
5803 }
5804 }
5805
5806 pub fn name(&self) -> std::option::Option<&str> {
5811 match self {
5812 Self::Unspecified => {
5813 std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
5814 }
5815 Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
5816 Self::Invalid => {
5817 std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
5818 }
5819 Self::Skipped => {
5820 std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
5821 }
5822 Self::NotApplicable => {
5823 std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
5824 }
5825 Self::UnknownValue(u) => u.0.name(),
5826 }
5827 }
5828 }
5829
5830 impl std::default::Default for ValidationResultType {
5831 fn default() -> Self {
5832 use std::convert::From;
5833 Self::from(0)
5834 }
5835 }
5836
5837 impl std::fmt::Display for ValidationResultType {
5838 fn fmt(
5839 &self,
5840 f: &mut std::fmt::Formatter<'_>,
5841 ) -> std::result::Result<(), std::fmt::Error> {
5842 wkt::internal::display_enum(f, self.name(), self.value())
5843 }
5844 }
5845
5846 impl std::convert::From<i32> for ValidationResultType {
5847 fn from(value: i32) -> Self {
5848 match value {
5849 0 => Self::Unspecified,
5850 1 => Self::Valid,
5851 2 => Self::Invalid,
5852 3 => Self::Skipped,
5853 4 => Self::NotApplicable,
5854 _ => Self::UnknownValue(validation_result_type::UnknownValue(
5855 wkt::internal::UnknownEnumValue::Integer(value),
5856 )),
5857 }
5858 }
5859 }
5860
5861 impl std::convert::From<&str> for ValidationResultType {
5862 fn from(value: &str) -> Self {
5863 use std::string::ToString;
5864 match value {
5865 "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
5866 "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
5867 "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
5868 "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
5869 "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
5870 _ => Self::UnknownValue(validation_result_type::UnknownValue(
5871 wkt::internal::UnknownEnumValue::String(value.to_string()),
5872 )),
5873 }
5874 }
5875 }
5876
5877 impl serde::ser::Serialize for ValidationResultType {
5878 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5879 where
5880 S: serde::Serializer,
5881 {
5882 match self {
5883 Self::Unspecified => serializer.serialize_i32(0),
5884 Self::Valid => serializer.serialize_i32(1),
5885 Self::Invalid => serializer.serialize_i32(2),
5886 Self::Skipped => serializer.serialize_i32(3),
5887 Self::NotApplicable => serializer.serialize_i32(4),
5888 Self::UnknownValue(u) => u.0.serialize(serializer),
5889 }
5890 }
5891 }
5892
5893 impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
5894 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5895 where
5896 D: serde::Deserializer<'de>,
5897 {
5898 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
5899 ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
5900 }
5901 }
5902 }
5903 }
5904
5905 #[derive(Clone, Default, PartialEq)]
5907 #[non_exhaustive]
5908 pub struct EntitiesRevision {
5909 pub revision_id: std::string::String,
5911
5912 pub entities: std::vec::Vec<crate::model::document::Entity>,
5914
5915 pub entity_validation_output:
5917 std::option::Option<crate::model::document::EntityValidationOutput>,
5918
5919 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5920 }
5921
5922 impl EntitiesRevision {
5923 pub fn new() -> Self {
5924 std::default::Default::default()
5925 }
5926
5927 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5929 self.revision_id = v.into();
5930 self
5931 }
5932
5933 pub fn set_entities<T, V>(mut self, v: T) -> Self
5935 where
5936 T: std::iter::IntoIterator<Item = V>,
5937 V: std::convert::Into<crate::model::document::Entity>,
5938 {
5939 use std::iter::Iterator;
5940 self.entities = v.into_iter().map(|i| i.into()).collect();
5941 self
5942 }
5943
5944 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
5946 where
5947 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
5948 {
5949 self.entity_validation_output = std::option::Option::Some(v.into());
5950 self
5951 }
5952
5953 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
5955 where
5956 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
5957 {
5958 self.entity_validation_output = v.map(|x| x.into());
5959 self
5960 }
5961 }
5962
5963 impl wkt::message::Message for EntitiesRevision {
5964 fn typename() -> &'static str {
5965 "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
5966 }
5967 }
5968
5969 #[derive(Clone, Debug, PartialEq)]
5971 #[non_exhaustive]
5972 pub enum Source {
5973 Uri(std::string::String),
5978 Content(::bytes::Bytes),
5982 }
5983}
5984
5985#[derive(Clone, Default, PartialEq)]
5987#[non_exhaustive]
5988pub struct RawDocument {
5989 pub content: ::bytes::Bytes,
5991
5992 pub mime_type: std::string::String,
5997
5998 pub display_name: std::string::String,
6004
6005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6006}
6007
6008impl RawDocument {
6009 pub fn new() -> Self {
6010 std::default::Default::default()
6011 }
6012
6013 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6015 self.content = v.into();
6016 self
6017 }
6018
6019 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6021 self.mime_type = v.into();
6022 self
6023 }
6024
6025 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6027 self.display_name = v.into();
6028 self
6029 }
6030}
6031
6032impl wkt::message::Message for RawDocument {
6033 fn typename() -> &'static str {
6034 "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
6035 }
6036}
6037
6038#[derive(Clone, Default, PartialEq)]
6040#[non_exhaustive]
6041pub struct GcsDocument {
6042 pub gcs_uri: std::string::String,
6044
6045 pub mime_type: std::string::String,
6047
6048 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6049}
6050
6051impl GcsDocument {
6052 pub fn new() -> Self {
6053 std::default::Default::default()
6054 }
6055
6056 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6058 self.gcs_uri = v.into();
6059 self
6060 }
6061
6062 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6064 self.mime_type = v.into();
6065 self
6066 }
6067}
6068
6069impl wkt::message::Message for GcsDocument {
6070 fn typename() -> &'static str {
6071 "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
6072 }
6073}
6074
6075#[derive(Clone, Default, PartialEq)]
6077#[non_exhaustive]
6078pub struct GcsDocuments {
6079 pub documents: std::vec::Vec<crate::model::GcsDocument>,
6081
6082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6083}
6084
6085impl GcsDocuments {
6086 pub fn new() -> Self {
6087 std::default::Default::default()
6088 }
6089
6090 pub fn set_documents<T, V>(mut self, v: T) -> Self
6092 where
6093 T: std::iter::IntoIterator<Item = V>,
6094 V: std::convert::Into<crate::model::GcsDocument>,
6095 {
6096 use std::iter::Iterator;
6097 self.documents = v.into_iter().map(|i| i.into()).collect();
6098 self
6099 }
6100}
6101
6102impl wkt::message::Message for GcsDocuments {
6103 fn typename() -> &'static str {
6104 "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
6105 }
6106}
6107
6108#[derive(Clone, Default, PartialEq)]
6110#[non_exhaustive]
6111pub struct GcsPrefix {
6112 pub gcs_uri_prefix: std::string::String,
6114
6115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6116}
6117
6118impl GcsPrefix {
6119 pub fn new() -> Self {
6120 std::default::Default::default()
6121 }
6122
6123 pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6125 self.gcs_uri_prefix = v.into();
6126 self
6127 }
6128}
6129
6130impl wkt::message::Message for GcsPrefix {
6131 fn typename() -> &'static str {
6132 "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
6133 }
6134}
6135
6136#[derive(Clone, Default, PartialEq)]
6138#[non_exhaustive]
6139pub struct BatchDocumentsInputConfig {
6140 pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
6143
6144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6145}
6146
6147impl BatchDocumentsInputConfig {
6148 pub fn new() -> Self {
6149 std::default::Default::default()
6150 }
6151
6152 pub fn set_source<
6157 T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
6158 >(
6159 mut self,
6160 v: T,
6161 ) -> Self {
6162 self.source = v.into();
6163 self
6164 }
6165
6166 pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
6170 #[allow(unreachable_patterns)]
6171 self.source.as_ref().and_then(|v| match v {
6172 crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
6173 std::option::Option::Some(v)
6174 }
6175 _ => std::option::Option::None,
6176 })
6177 }
6178
6179 pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
6185 mut self,
6186 v: T,
6187 ) -> Self {
6188 self.source = std::option::Option::Some(
6189 crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
6190 );
6191 self
6192 }
6193
6194 pub fn gcs_documents(
6198 &self,
6199 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
6200 #[allow(unreachable_patterns)]
6201 self.source.as_ref().and_then(|v| match v {
6202 crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
6203 std::option::Option::Some(v)
6204 }
6205 _ => std::option::Option::None,
6206 })
6207 }
6208
6209 pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
6215 mut self,
6216 v: T,
6217 ) -> Self {
6218 self.source = std::option::Option::Some(
6219 crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
6220 );
6221 self
6222 }
6223}
6224
6225impl wkt::message::Message for BatchDocumentsInputConfig {
6226 fn typename() -> &'static str {
6227 "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
6228 }
6229}
6230
6231pub mod batch_documents_input_config {
6233 #[allow(unused_imports)]
6234 use super::*;
6235
6236 #[derive(Clone, Debug, PartialEq)]
6239 #[non_exhaustive]
6240 pub enum Source {
6241 GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
6243 GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
6245 }
6246}
6247
6248#[derive(Clone, Default, PartialEq)]
6251#[non_exhaustive]
6252pub struct DocumentOutputConfig {
6253 pub destination: std::option::Option<crate::model::document_output_config::Destination>,
6255
6256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6257}
6258
6259impl DocumentOutputConfig {
6260 pub fn new() -> Self {
6261 std::default::Default::default()
6262 }
6263
6264 pub fn set_destination<
6269 T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
6270 >(
6271 mut self,
6272 v: T,
6273 ) -> Self {
6274 self.destination = v.into();
6275 self
6276 }
6277
6278 pub fn gcs_output_config(
6282 &self,
6283 ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
6284 {
6285 #[allow(unreachable_patterns)]
6286 self.destination.as_ref().and_then(|v| match v {
6287 crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
6288 std::option::Option::Some(v)
6289 }
6290 _ => std::option::Option::None,
6291 })
6292 }
6293
6294 pub fn set_gcs_output_config<
6300 T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
6301 >(
6302 mut self,
6303 v: T,
6304 ) -> Self {
6305 self.destination = std::option::Option::Some(
6306 crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
6307 );
6308 self
6309 }
6310}
6311
6312impl wkt::message::Message for DocumentOutputConfig {
6313 fn typename() -> &'static str {
6314 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
6315 }
6316}
6317
6318pub mod document_output_config {
6320 #[allow(unused_imports)]
6321 use super::*;
6322
6323 #[derive(Clone, Default, PartialEq)]
6325 #[non_exhaustive]
6326 pub struct GcsOutputConfig {
6327 pub gcs_uri: std::string::String,
6329
6330 pub field_mask: std::option::Option<wkt::FieldMask>,
6334
6335 pub sharding_config: std::option::Option<
6337 crate::model::document_output_config::gcs_output_config::ShardingConfig,
6338 >,
6339
6340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6341 }
6342
6343 impl GcsOutputConfig {
6344 pub fn new() -> Self {
6345 std::default::Default::default()
6346 }
6347
6348 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6350 self.gcs_uri = v.into();
6351 self
6352 }
6353
6354 pub fn set_field_mask<T>(mut self, v: T) -> Self
6356 where
6357 T: std::convert::Into<wkt::FieldMask>,
6358 {
6359 self.field_mask = std::option::Option::Some(v.into());
6360 self
6361 }
6362
6363 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
6365 where
6366 T: std::convert::Into<wkt::FieldMask>,
6367 {
6368 self.field_mask = v.map(|x| x.into());
6369 self
6370 }
6371
6372 pub fn set_sharding_config<T>(mut self, v: T) -> Self
6374 where
6375 T: std::convert::Into<
6376 crate::model::document_output_config::gcs_output_config::ShardingConfig,
6377 >,
6378 {
6379 self.sharding_config = std::option::Option::Some(v.into());
6380 self
6381 }
6382
6383 pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
6385 where
6386 T: std::convert::Into<
6387 crate::model::document_output_config::gcs_output_config::ShardingConfig,
6388 >,
6389 {
6390 self.sharding_config = v.map(|x| x.into());
6391 self
6392 }
6393 }
6394
6395 impl wkt::message::Message for GcsOutputConfig {
6396 fn typename() -> &'static str {
6397 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
6398 }
6399 }
6400
6401 pub mod gcs_output_config {
6403 #[allow(unused_imports)]
6404 use super::*;
6405
6406 #[derive(Clone, Default, PartialEq)]
6408 #[non_exhaustive]
6409 pub struct ShardingConfig {
6410 pub pages_per_shard: i32,
6412
6413 pub pages_overlap: i32,
6415
6416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6417 }
6418
6419 impl ShardingConfig {
6420 pub fn new() -> Self {
6421 std::default::Default::default()
6422 }
6423
6424 pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6426 self.pages_per_shard = v.into();
6427 self
6428 }
6429
6430 pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6432 self.pages_overlap = v.into();
6433 self
6434 }
6435 }
6436
6437 impl wkt::message::Message for ShardingConfig {
6438 fn typename() -> &'static str {
6439 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
6440 }
6441 }
6442 }
6443
6444 #[derive(Clone, Debug, PartialEq)]
6446 #[non_exhaustive]
6447 pub enum Destination {
6448 GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
6450 }
6451}
6452
6453#[derive(Clone, Default, PartialEq)]
6455#[non_exhaustive]
6456pub struct OcrConfig {
6457 pub hints: std::option::Option<crate::model::ocr_config::Hints>,
6459
6460 pub enable_native_pdf_parsing: bool,
6463
6464 pub enable_image_quality_scores: bool,
6468
6469 pub advanced_ocr_options: std::vec::Vec<std::string::String>,
6477
6478 pub enable_symbol: bool,
6480
6481 #[deprecated]
6488 pub compute_style_info: bool,
6489
6490 pub disable_character_boxes_detection: bool,
6493
6494 pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
6496
6497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6498}
6499
6500impl OcrConfig {
6501 pub fn new() -> Self {
6502 std::default::Default::default()
6503 }
6504
6505 pub fn set_hints<T>(mut self, v: T) -> Self
6507 where
6508 T: std::convert::Into<crate::model::ocr_config::Hints>,
6509 {
6510 self.hints = std::option::Option::Some(v.into());
6511 self
6512 }
6513
6514 pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
6516 where
6517 T: std::convert::Into<crate::model::ocr_config::Hints>,
6518 {
6519 self.hints = v.map(|x| x.into());
6520 self
6521 }
6522
6523 pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6525 self.enable_native_pdf_parsing = v.into();
6526 self
6527 }
6528
6529 pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6531 self.enable_image_quality_scores = v.into();
6532 self
6533 }
6534
6535 pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
6537 where
6538 T: std::iter::IntoIterator<Item = V>,
6539 V: std::convert::Into<std::string::String>,
6540 {
6541 use std::iter::Iterator;
6542 self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
6543 self
6544 }
6545
6546 pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6548 self.enable_symbol = v.into();
6549 self
6550 }
6551
6552 #[deprecated]
6554 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6555 self.compute_style_info = v.into();
6556 self
6557 }
6558
6559 pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
6561 mut self,
6562 v: T,
6563 ) -> Self {
6564 self.disable_character_boxes_detection = v.into();
6565 self
6566 }
6567
6568 pub fn set_premium_features<T>(mut self, v: T) -> Self
6570 where
6571 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
6572 {
6573 self.premium_features = std::option::Option::Some(v.into());
6574 self
6575 }
6576
6577 pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
6579 where
6580 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
6581 {
6582 self.premium_features = v.map(|x| x.into());
6583 self
6584 }
6585}
6586
6587impl wkt::message::Message for OcrConfig {
6588 fn typename() -> &'static str {
6589 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
6590 }
6591}
6592
6593pub mod ocr_config {
6595 #[allow(unused_imports)]
6596 use super::*;
6597
6598 #[derive(Clone, Default, PartialEq)]
6600 #[non_exhaustive]
6601 pub struct Hints {
6602 pub language_hints: std::vec::Vec<std::string::String>,
6609
6610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6611 }
6612
6613 impl Hints {
6614 pub fn new() -> Self {
6615 std::default::Default::default()
6616 }
6617
6618 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
6620 where
6621 T: std::iter::IntoIterator<Item = V>,
6622 V: std::convert::Into<std::string::String>,
6623 {
6624 use std::iter::Iterator;
6625 self.language_hints = v.into_iter().map(|i| i.into()).collect();
6626 self
6627 }
6628 }
6629
6630 impl wkt::message::Message for Hints {
6631 fn typename() -> &'static str {
6632 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
6633 }
6634 }
6635
6636 #[derive(Clone, Default, PartialEq)]
6638 #[non_exhaustive]
6639 pub struct PremiumFeatures {
6640 pub enable_selection_mark_detection: bool,
6643
6644 pub compute_style_info: bool,
6646
6647 pub enable_math_ocr: bool,
6649
6650 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6651 }
6652
6653 impl PremiumFeatures {
6654 pub fn new() -> Self {
6655 std::default::Default::default()
6656 }
6657
6658 pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
6660 mut self,
6661 v: T,
6662 ) -> Self {
6663 self.enable_selection_mark_detection = v.into();
6664 self
6665 }
6666
6667 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6669 self.compute_style_info = v.into();
6670 self
6671 }
6672
6673 pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6675 self.enable_math_ocr = v.into();
6676 self
6677 }
6678 }
6679
6680 impl wkt::message::Message for PremiumFeatures {
6681 fn typename() -> &'static str {
6682 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
6683 }
6684 }
6685}
6686
6687#[derive(Clone, Default, PartialEq)]
6689#[non_exhaustive]
6690pub struct ProcessOptions {
6691 pub ocr_config: std::option::Option<crate::model::OcrConfig>,
6694
6695 pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
6698
6699 pub schema_override: std::option::Option<crate::model::DocumentSchema>,
6707
6708 pub page_range: std::option::Option<crate::model::process_options::PageRange>,
6719
6720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6721}
6722
6723impl ProcessOptions {
6724 pub fn new() -> Self {
6725 std::default::Default::default()
6726 }
6727
6728 pub fn set_ocr_config<T>(mut self, v: T) -> Self
6730 where
6731 T: std::convert::Into<crate::model::OcrConfig>,
6732 {
6733 self.ocr_config = std::option::Option::Some(v.into());
6734 self
6735 }
6736
6737 pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
6739 where
6740 T: std::convert::Into<crate::model::OcrConfig>,
6741 {
6742 self.ocr_config = v.map(|x| x.into());
6743 self
6744 }
6745
6746 pub fn set_layout_config<T>(mut self, v: T) -> Self
6748 where
6749 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
6750 {
6751 self.layout_config = std::option::Option::Some(v.into());
6752 self
6753 }
6754
6755 pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
6757 where
6758 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
6759 {
6760 self.layout_config = v.map(|x| x.into());
6761 self
6762 }
6763
6764 pub fn set_schema_override<T>(mut self, v: T) -> Self
6766 where
6767 T: std::convert::Into<crate::model::DocumentSchema>,
6768 {
6769 self.schema_override = std::option::Option::Some(v.into());
6770 self
6771 }
6772
6773 pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
6775 where
6776 T: std::convert::Into<crate::model::DocumentSchema>,
6777 {
6778 self.schema_override = v.map(|x| x.into());
6779 self
6780 }
6781
6782 pub fn set_page_range<
6787 T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
6788 >(
6789 mut self,
6790 v: T,
6791 ) -> Self {
6792 self.page_range = v.into();
6793 self
6794 }
6795
6796 pub fn individual_page_selector(
6800 &self,
6801 ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
6802 {
6803 #[allow(unreachable_patterns)]
6804 self.page_range.as_ref().and_then(|v| match v {
6805 crate::model::process_options::PageRange::IndividualPageSelector(v) => {
6806 std::option::Option::Some(v)
6807 }
6808 _ => std::option::Option::None,
6809 })
6810 }
6811
6812 pub fn set_individual_page_selector<
6818 T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
6819 >(
6820 mut self,
6821 v: T,
6822 ) -> Self {
6823 self.page_range = std::option::Option::Some(
6824 crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
6825 );
6826 self
6827 }
6828
6829 pub fn from_start(&self) -> std::option::Option<&i32> {
6833 #[allow(unreachable_patterns)]
6834 self.page_range.as_ref().and_then(|v| match v {
6835 crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
6836 _ => std::option::Option::None,
6837 })
6838 }
6839
6840 pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6846 self.page_range = std::option::Option::Some(
6847 crate::model::process_options::PageRange::FromStart(v.into()),
6848 );
6849 self
6850 }
6851
6852 pub fn from_end(&self) -> std::option::Option<&i32> {
6856 #[allow(unreachable_patterns)]
6857 self.page_range.as_ref().and_then(|v| match v {
6858 crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
6859 _ => std::option::Option::None,
6860 })
6861 }
6862
6863 pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6869 self.page_range =
6870 std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
6871 self
6872 }
6873}
6874
6875impl wkt::message::Message for ProcessOptions {
6876 fn typename() -> &'static str {
6877 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
6878 }
6879}
6880
6881pub mod process_options {
6883 #[allow(unused_imports)]
6884 use super::*;
6885
6886 #[derive(Clone, Default, PartialEq)]
6888 #[non_exhaustive]
6889 pub struct LayoutConfig {
6890 pub chunking_config:
6892 std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
6893
6894 pub return_images: bool,
6896
6897 pub return_bounding_boxes: bool,
6900
6901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6902 }
6903
6904 impl LayoutConfig {
6905 pub fn new() -> Self {
6906 std::default::Default::default()
6907 }
6908
6909 pub fn set_chunking_config<T>(mut self, v: T) -> Self
6911 where
6912 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
6913 {
6914 self.chunking_config = std::option::Option::Some(v.into());
6915 self
6916 }
6917
6918 pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
6920 where
6921 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
6922 {
6923 self.chunking_config = v.map(|x| x.into());
6924 self
6925 }
6926
6927 pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6929 self.return_images = v.into();
6930 self
6931 }
6932
6933 pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6935 self.return_bounding_boxes = v.into();
6936 self
6937 }
6938 }
6939
6940 impl wkt::message::Message for LayoutConfig {
6941 fn typename() -> &'static str {
6942 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
6943 }
6944 }
6945
6946 pub mod layout_config {
6948 #[allow(unused_imports)]
6949 use super::*;
6950
6951 #[derive(Clone, Default, PartialEq)]
6953 #[non_exhaustive]
6954 pub struct ChunkingConfig {
6955 pub chunk_size: i32,
6958
6959 pub include_ancestor_headings: bool,
6961
6962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6963 }
6964
6965 impl ChunkingConfig {
6966 pub fn new() -> Self {
6967 std::default::Default::default()
6968 }
6969
6970 pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6972 self.chunk_size = v.into();
6973 self
6974 }
6975
6976 pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
6978 mut self,
6979 v: T,
6980 ) -> Self {
6981 self.include_ancestor_headings = v.into();
6982 self
6983 }
6984 }
6985
6986 impl wkt::message::Message for ChunkingConfig {
6987 fn typename() -> &'static str {
6988 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
6989 }
6990 }
6991 }
6992
6993 #[derive(Clone, Default, PartialEq)]
6995 #[non_exhaustive]
6996 pub struct IndividualPageSelector {
6997 pub pages: std::vec::Vec<i32>,
6999
7000 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7001 }
7002
7003 impl IndividualPageSelector {
7004 pub fn new() -> Self {
7005 std::default::Default::default()
7006 }
7007
7008 pub fn set_pages<T, V>(mut self, v: T) -> Self
7010 where
7011 T: std::iter::IntoIterator<Item = V>,
7012 V: std::convert::Into<i32>,
7013 {
7014 use std::iter::Iterator;
7015 self.pages = v.into_iter().map(|i| i.into()).collect();
7016 self
7017 }
7018 }
7019
7020 impl wkt::message::Message for IndividualPageSelector {
7021 fn typename() -> &'static str {
7022 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
7023 }
7024 }
7025
7026 #[derive(Clone, Debug, PartialEq)]
7037 #[non_exhaustive]
7038 pub enum PageRange {
7039 IndividualPageSelector(
7041 std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
7042 ),
7043 FromStart(i32),
7046 FromEnd(i32),
7048 }
7049}
7050
7051#[derive(Clone, Default, PartialEq)]
7057#[non_exhaustive]
7058pub struct ProcessRequest {
7059 pub name: std::string::String,
7074
7075 pub skip_human_review: bool,
7078
7079 pub field_mask: std::option::Option<wkt::FieldMask>,
7086
7087 pub process_options: std::option::Option<crate::model::ProcessOptions>,
7089
7090 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7097
7098 pub imageless_mode: bool,
7100
7101 pub source: std::option::Option<crate::model::process_request::Source>,
7103
7104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7105}
7106
7107impl ProcessRequest {
7108 pub fn new() -> Self {
7109 std::default::Default::default()
7110 }
7111
7112 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7114 self.name = v.into();
7115 self
7116 }
7117
7118 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7120 self.skip_human_review = v.into();
7121 self
7122 }
7123
7124 pub fn set_field_mask<T>(mut self, v: T) -> Self
7126 where
7127 T: std::convert::Into<wkt::FieldMask>,
7128 {
7129 self.field_mask = std::option::Option::Some(v.into());
7130 self
7131 }
7132
7133 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
7135 where
7136 T: std::convert::Into<wkt::FieldMask>,
7137 {
7138 self.field_mask = v.map(|x| x.into());
7139 self
7140 }
7141
7142 pub fn set_process_options<T>(mut self, v: T) -> Self
7144 where
7145 T: std::convert::Into<crate::model::ProcessOptions>,
7146 {
7147 self.process_options = std::option::Option::Some(v.into());
7148 self
7149 }
7150
7151 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
7153 where
7154 T: std::convert::Into<crate::model::ProcessOptions>,
7155 {
7156 self.process_options = v.map(|x| x.into());
7157 self
7158 }
7159
7160 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7162 where
7163 T: std::iter::IntoIterator<Item = (K, V)>,
7164 K: std::convert::Into<std::string::String>,
7165 V: std::convert::Into<std::string::String>,
7166 {
7167 use std::iter::Iterator;
7168 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7169 self
7170 }
7171
7172 pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7174 self.imageless_mode = v.into();
7175 self
7176 }
7177
7178 pub fn set_source<
7183 T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
7184 >(
7185 mut self,
7186 v: T,
7187 ) -> Self {
7188 self.source = v.into();
7189 self
7190 }
7191
7192 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
7196 #[allow(unreachable_patterns)]
7197 self.source.as_ref().and_then(|v| match v {
7198 crate::model::process_request::Source::InlineDocument(v) => {
7199 std::option::Option::Some(v)
7200 }
7201 _ => std::option::Option::None,
7202 })
7203 }
7204
7205 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
7211 mut self,
7212 v: T,
7213 ) -> Self {
7214 self.source = std::option::Option::Some(
7215 crate::model::process_request::Source::InlineDocument(v.into()),
7216 );
7217 self
7218 }
7219
7220 pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
7224 #[allow(unreachable_patterns)]
7225 self.source.as_ref().and_then(|v| match v {
7226 crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
7227 _ => std::option::Option::None,
7228 })
7229 }
7230
7231 pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
7237 mut self,
7238 v: T,
7239 ) -> Self {
7240 self.source =
7241 std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
7242 self
7243 }
7244
7245 pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
7249 #[allow(unreachable_patterns)]
7250 self.source.as_ref().and_then(|v| match v {
7251 crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
7252 _ => std::option::Option::None,
7253 })
7254 }
7255
7256 pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
7262 mut self,
7263 v: T,
7264 ) -> Self {
7265 self.source =
7266 std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
7267 self
7268 }
7269}
7270
7271impl wkt::message::Message for ProcessRequest {
7272 fn typename() -> &'static str {
7273 "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
7274 }
7275}
7276
7277pub mod process_request {
7279 #[allow(unused_imports)]
7280 use super::*;
7281
7282 #[derive(Clone, Debug, PartialEq)]
7284 #[non_exhaustive]
7285 pub enum Source {
7286 InlineDocument(std::boxed::Box<crate::model::Document>),
7288 RawDocument(std::boxed::Box<crate::model::RawDocument>),
7290 GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
7292 }
7293}
7294
7295#[derive(Clone, Default, PartialEq)]
7297#[non_exhaustive]
7298pub struct HumanReviewStatus {
7299 pub state: crate::model::human_review_status::State,
7301
7302 pub state_message: std::string::String,
7304
7305 pub human_review_operation: std::string::String,
7315
7316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7317}
7318
7319impl HumanReviewStatus {
7320 pub fn new() -> Self {
7321 std::default::Default::default()
7322 }
7323
7324 pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
7326 mut self,
7327 v: T,
7328 ) -> Self {
7329 self.state = v.into();
7330 self
7331 }
7332
7333 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7335 self.state_message = v.into();
7336 self
7337 }
7338
7339 pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
7341 mut self,
7342 v: T,
7343 ) -> Self {
7344 self.human_review_operation = v.into();
7345 self
7346 }
7347}
7348
7349impl wkt::message::Message for HumanReviewStatus {
7350 fn typename() -> &'static str {
7351 "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
7352 }
7353}
7354
7355pub mod human_review_status {
7357 #[allow(unused_imports)]
7358 use super::*;
7359
7360 #[derive(Clone, Debug, PartialEq)]
7376 #[non_exhaustive]
7377 pub enum State {
7378 Unspecified,
7380 Skipped,
7384 ValidationPassed,
7386 InProgress,
7388 Error,
7394 UnknownValue(state::UnknownValue),
7399 }
7400
7401 #[doc(hidden)]
7402 pub mod state {
7403 #[allow(unused_imports)]
7404 use super::*;
7405 #[derive(Clone, Debug, PartialEq)]
7406 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7407 }
7408
7409 impl State {
7410 pub fn value(&self) -> std::option::Option<i32> {
7415 match self {
7416 Self::Unspecified => std::option::Option::Some(0),
7417 Self::Skipped => std::option::Option::Some(1),
7418 Self::ValidationPassed => std::option::Option::Some(2),
7419 Self::InProgress => std::option::Option::Some(3),
7420 Self::Error => std::option::Option::Some(4),
7421 Self::UnknownValue(u) => u.0.value(),
7422 }
7423 }
7424
7425 pub fn name(&self) -> std::option::Option<&str> {
7430 match self {
7431 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7432 Self::Skipped => std::option::Option::Some("SKIPPED"),
7433 Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
7434 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
7435 Self::Error => std::option::Option::Some("ERROR"),
7436 Self::UnknownValue(u) => u.0.name(),
7437 }
7438 }
7439 }
7440
7441 impl std::default::Default for State {
7442 fn default() -> Self {
7443 use std::convert::From;
7444 Self::from(0)
7445 }
7446 }
7447
7448 impl std::fmt::Display for State {
7449 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7450 wkt::internal::display_enum(f, self.name(), self.value())
7451 }
7452 }
7453
7454 impl std::convert::From<i32> for State {
7455 fn from(value: i32) -> Self {
7456 match value {
7457 0 => Self::Unspecified,
7458 1 => Self::Skipped,
7459 2 => Self::ValidationPassed,
7460 3 => Self::InProgress,
7461 4 => Self::Error,
7462 _ => Self::UnknownValue(state::UnknownValue(
7463 wkt::internal::UnknownEnumValue::Integer(value),
7464 )),
7465 }
7466 }
7467 }
7468
7469 impl std::convert::From<&str> for State {
7470 fn from(value: &str) -> Self {
7471 use std::string::ToString;
7472 match value {
7473 "STATE_UNSPECIFIED" => Self::Unspecified,
7474 "SKIPPED" => Self::Skipped,
7475 "VALIDATION_PASSED" => Self::ValidationPassed,
7476 "IN_PROGRESS" => Self::InProgress,
7477 "ERROR" => Self::Error,
7478 _ => Self::UnknownValue(state::UnknownValue(
7479 wkt::internal::UnknownEnumValue::String(value.to_string()),
7480 )),
7481 }
7482 }
7483 }
7484
7485 impl serde::ser::Serialize for State {
7486 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7487 where
7488 S: serde::Serializer,
7489 {
7490 match self {
7491 Self::Unspecified => serializer.serialize_i32(0),
7492 Self::Skipped => serializer.serialize_i32(1),
7493 Self::ValidationPassed => serializer.serialize_i32(2),
7494 Self::InProgress => serializer.serialize_i32(3),
7495 Self::Error => serializer.serialize_i32(4),
7496 Self::UnknownValue(u) => u.0.serialize(serializer),
7497 }
7498 }
7499 }
7500
7501 impl<'de> serde::de::Deserialize<'de> for State {
7502 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7503 where
7504 D: serde::Deserializer<'de>,
7505 {
7506 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7507 ".google.cloud.documentai.v1.HumanReviewStatus.State",
7508 ))
7509 }
7510 }
7511}
7512
7513#[derive(Clone, Default, PartialEq)]
7519#[non_exhaustive]
7520pub struct ProcessResponse {
7521 pub document: std::option::Option<crate::model::Document>,
7524
7525 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
7527
7528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7529}
7530
7531impl ProcessResponse {
7532 pub fn new() -> Self {
7533 std::default::Default::default()
7534 }
7535
7536 pub fn set_document<T>(mut self, v: T) -> Self
7538 where
7539 T: std::convert::Into<crate::model::Document>,
7540 {
7541 self.document = std::option::Option::Some(v.into());
7542 self
7543 }
7544
7545 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
7547 where
7548 T: std::convert::Into<crate::model::Document>,
7549 {
7550 self.document = v.map(|x| x.into());
7551 self
7552 }
7553
7554 pub fn set_human_review_status<T>(mut self, v: T) -> Self
7556 where
7557 T: std::convert::Into<crate::model::HumanReviewStatus>,
7558 {
7559 self.human_review_status = std::option::Option::Some(v.into());
7560 self
7561 }
7562
7563 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
7565 where
7566 T: std::convert::Into<crate::model::HumanReviewStatus>,
7567 {
7568 self.human_review_status = v.map(|x| x.into());
7569 self
7570 }
7571}
7572
7573impl wkt::message::Message for ProcessResponse {
7574 fn typename() -> &'static str {
7575 "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
7576 }
7577}
7578
7579#[derive(Clone, Default, PartialEq)]
7584#[non_exhaustive]
7585pub struct BatchProcessRequest {
7586 pub name: std::string::String,
7596
7597 pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
7603
7604 pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
7610
7611 pub skip_human_review: bool,
7614
7615 pub process_options: std::option::Option<crate::model::ProcessOptions>,
7617
7618 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7625
7626 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7627}
7628
7629impl BatchProcessRequest {
7630 pub fn new() -> Self {
7631 std::default::Default::default()
7632 }
7633
7634 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7636 self.name = v.into();
7637 self
7638 }
7639
7640 pub fn set_input_documents<T>(mut self, v: T) -> Self
7642 where
7643 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
7644 {
7645 self.input_documents = std::option::Option::Some(v.into());
7646 self
7647 }
7648
7649 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
7651 where
7652 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
7653 {
7654 self.input_documents = v.map(|x| x.into());
7655 self
7656 }
7657
7658 pub fn set_document_output_config<T>(mut self, v: T) -> Self
7660 where
7661 T: std::convert::Into<crate::model::DocumentOutputConfig>,
7662 {
7663 self.document_output_config = std::option::Option::Some(v.into());
7664 self
7665 }
7666
7667 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
7669 where
7670 T: std::convert::Into<crate::model::DocumentOutputConfig>,
7671 {
7672 self.document_output_config = v.map(|x| x.into());
7673 self
7674 }
7675
7676 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7678 self.skip_human_review = v.into();
7679 self
7680 }
7681
7682 pub fn set_process_options<T>(mut self, v: T) -> Self
7684 where
7685 T: std::convert::Into<crate::model::ProcessOptions>,
7686 {
7687 self.process_options = std::option::Option::Some(v.into());
7688 self
7689 }
7690
7691 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
7693 where
7694 T: std::convert::Into<crate::model::ProcessOptions>,
7695 {
7696 self.process_options = v.map(|x| x.into());
7697 self
7698 }
7699
7700 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7702 where
7703 T: std::iter::IntoIterator<Item = (K, V)>,
7704 K: std::convert::Into<std::string::String>,
7705 V: std::convert::Into<std::string::String>,
7706 {
7707 use std::iter::Iterator;
7708 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7709 self
7710 }
7711}
7712
7713impl wkt::message::Message for BatchProcessRequest {
7714 fn typename() -> &'static str {
7715 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
7716 }
7717}
7718
7719#[derive(Clone, Default, PartialEq)]
7724#[non_exhaustive]
7725pub struct BatchProcessResponse {
7726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7727}
7728
7729impl BatchProcessResponse {
7730 pub fn new() -> Self {
7731 std::default::Default::default()
7732 }
7733}
7734
7735impl wkt::message::Message for BatchProcessResponse {
7736 fn typename() -> &'static str {
7737 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
7738 }
7739}
7740
7741#[derive(Clone, Default, PartialEq)]
7746#[non_exhaustive]
7747pub struct BatchProcessMetadata {
7748 pub state: crate::model::batch_process_metadata::State,
7750
7751 pub state_message: std::string::String,
7754
7755 pub create_time: std::option::Option<wkt::Timestamp>,
7757
7758 pub update_time: std::option::Option<wkt::Timestamp>,
7760
7761 pub individual_process_statuses:
7763 std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
7764
7765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7766}
7767
7768impl BatchProcessMetadata {
7769 pub fn new() -> Self {
7770 std::default::Default::default()
7771 }
7772
7773 pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
7775 mut self,
7776 v: T,
7777 ) -> Self {
7778 self.state = v.into();
7779 self
7780 }
7781
7782 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7784 self.state_message = v.into();
7785 self
7786 }
7787
7788 pub fn set_create_time<T>(mut self, v: T) -> Self
7790 where
7791 T: std::convert::Into<wkt::Timestamp>,
7792 {
7793 self.create_time = std::option::Option::Some(v.into());
7794 self
7795 }
7796
7797 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7799 where
7800 T: std::convert::Into<wkt::Timestamp>,
7801 {
7802 self.create_time = v.map(|x| x.into());
7803 self
7804 }
7805
7806 pub fn set_update_time<T>(mut self, v: T) -> Self
7808 where
7809 T: std::convert::Into<wkt::Timestamp>,
7810 {
7811 self.update_time = std::option::Option::Some(v.into());
7812 self
7813 }
7814
7815 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7817 where
7818 T: std::convert::Into<wkt::Timestamp>,
7819 {
7820 self.update_time = v.map(|x| x.into());
7821 self
7822 }
7823
7824 pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
7826 where
7827 T: std::iter::IntoIterator<Item = V>,
7828 V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
7829 {
7830 use std::iter::Iterator;
7831 self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
7832 self
7833 }
7834}
7835
7836impl wkt::message::Message for BatchProcessMetadata {
7837 fn typename() -> &'static str {
7838 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
7839 }
7840}
7841
7842pub mod batch_process_metadata {
7844 #[allow(unused_imports)]
7845 use super::*;
7846
7847 #[derive(Clone, Default, PartialEq)]
7849 #[non_exhaustive]
7850 pub struct IndividualProcessStatus {
7851 pub input_gcs_source: std::string::String,
7857
7858 pub status: std::option::Option<rpc::model::Status>,
7860
7861 pub output_gcs_destination: std::string::String,
7867
7868 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
7870
7871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7872 }
7873
7874 impl IndividualProcessStatus {
7875 pub fn new() -> Self {
7876 std::default::Default::default()
7877 }
7878
7879 pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
7881 mut self,
7882 v: T,
7883 ) -> Self {
7884 self.input_gcs_source = v.into();
7885 self
7886 }
7887
7888 pub fn set_status<T>(mut self, v: T) -> Self
7890 where
7891 T: std::convert::Into<rpc::model::Status>,
7892 {
7893 self.status = std::option::Option::Some(v.into());
7894 self
7895 }
7896
7897 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
7899 where
7900 T: std::convert::Into<rpc::model::Status>,
7901 {
7902 self.status = v.map(|x| x.into());
7903 self
7904 }
7905
7906 pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
7908 mut self,
7909 v: T,
7910 ) -> Self {
7911 self.output_gcs_destination = v.into();
7912 self
7913 }
7914
7915 pub fn set_human_review_status<T>(mut self, v: T) -> Self
7917 where
7918 T: std::convert::Into<crate::model::HumanReviewStatus>,
7919 {
7920 self.human_review_status = std::option::Option::Some(v.into());
7921 self
7922 }
7923
7924 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
7926 where
7927 T: std::convert::Into<crate::model::HumanReviewStatus>,
7928 {
7929 self.human_review_status = v.map(|x| x.into());
7930 self
7931 }
7932 }
7933
7934 impl wkt::message::Message for IndividualProcessStatus {
7935 fn typename() -> &'static str {
7936 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
7937 }
7938 }
7939
7940 #[derive(Clone, Debug, PartialEq)]
7956 #[non_exhaustive]
7957 pub enum State {
7958 Unspecified,
7960 Waiting,
7962 Running,
7964 Succeeded,
7966 Cancelling,
7968 Cancelled,
7970 Failed,
7972 UnknownValue(state::UnknownValue),
7977 }
7978
7979 #[doc(hidden)]
7980 pub mod state {
7981 #[allow(unused_imports)]
7982 use super::*;
7983 #[derive(Clone, Debug, PartialEq)]
7984 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7985 }
7986
7987 impl State {
7988 pub fn value(&self) -> std::option::Option<i32> {
7993 match self {
7994 Self::Unspecified => std::option::Option::Some(0),
7995 Self::Waiting => std::option::Option::Some(1),
7996 Self::Running => std::option::Option::Some(2),
7997 Self::Succeeded => std::option::Option::Some(3),
7998 Self::Cancelling => std::option::Option::Some(4),
7999 Self::Cancelled => std::option::Option::Some(5),
8000 Self::Failed => std::option::Option::Some(6),
8001 Self::UnknownValue(u) => u.0.value(),
8002 }
8003 }
8004
8005 pub fn name(&self) -> std::option::Option<&str> {
8010 match self {
8011 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8012 Self::Waiting => std::option::Option::Some("WAITING"),
8013 Self::Running => std::option::Option::Some("RUNNING"),
8014 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
8015 Self::Cancelling => std::option::Option::Some("CANCELLING"),
8016 Self::Cancelled => std::option::Option::Some("CANCELLED"),
8017 Self::Failed => std::option::Option::Some("FAILED"),
8018 Self::UnknownValue(u) => u.0.name(),
8019 }
8020 }
8021 }
8022
8023 impl std::default::Default for State {
8024 fn default() -> Self {
8025 use std::convert::From;
8026 Self::from(0)
8027 }
8028 }
8029
8030 impl std::fmt::Display for State {
8031 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8032 wkt::internal::display_enum(f, self.name(), self.value())
8033 }
8034 }
8035
8036 impl std::convert::From<i32> for State {
8037 fn from(value: i32) -> Self {
8038 match value {
8039 0 => Self::Unspecified,
8040 1 => Self::Waiting,
8041 2 => Self::Running,
8042 3 => Self::Succeeded,
8043 4 => Self::Cancelling,
8044 5 => Self::Cancelled,
8045 6 => Self::Failed,
8046 _ => Self::UnknownValue(state::UnknownValue(
8047 wkt::internal::UnknownEnumValue::Integer(value),
8048 )),
8049 }
8050 }
8051 }
8052
8053 impl std::convert::From<&str> for State {
8054 fn from(value: &str) -> Self {
8055 use std::string::ToString;
8056 match value {
8057 "STATE_UNSPECIFIED" => Self::Unspecified,
8058 "WAITING" => Self::Waiting,
8059 "RUNNING" => Self::Running,
8060 "SUCCEEDED" => Self::Succeeded,
8061 "CANCELLING" => Self::Cancelling,
8062 "CANCELLED" => Self::Cancelled,
8063 "FAILED" => Self::Failed,
8064 _ => Self::UnknownValue(state::UnknownValue(
8065 wkt::internal::UnknownEnumValue::String(value.to_string()),
8066 )),
8067 }
8068 }
8069 }
8070
8071 impl serde::ser::Serialize for State {
8072 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8073 where
8074 S: serde::Serializer,
8075 {
8076 match self {
8077 Self::Unspecified => serializer.serialize_i32(0),
8078 Self::Waiting => serializer.serialize_i32(1),
8079 Self::Running => serializer.serialize_i32(2),
8080 Self::Succeeded => serializer.serialize_i32(3),
8081 Self::Cancelling => serializer.serialize_i32(4),
8082 Self::Cancelled => serializer.serialize_i32(5),
8083 Self::Failed => serializer.serialize_i32(6),
8084 Self::UnknownValue(u) => u.0.serialize(serializer),
8085 }
8086 }
8087 }
8088
8089 impl<'de> serde::de::Deserialize<'de> for State {
8090 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8091 where
8092 D: serde::Deserializer<'de>,
8093 {
8094 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8095 ".google.cloud.documentai.v1.BatchProcessMetadata.State",
8096 ))
8097 }
8098 }
8099}
8100
8101#[derive(Clone, Default, PartialEq)]
8108#[non_exhaustive]
8109pub struct FetchProcessorTypesRequest {
8110 pub parent: std::string::String,
8113
8114 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8115}
8116
8117impl FetchProcessorTypesRequest {
8118 pub fn new() -> Self {
8119 std::default::Default::default()
8120 }
8121
8122 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8124 self.parent = v.into();
8125 self
8126 }
8127}
8128
8129impl wkt::message::Message for FetchProcessorTypesRequest {
8130 fn typename() -> &'static str {
8131 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
8132 }
8133}
8134
8135#[derive(Clone, Default, PartialEq)]
8141#[non_exhaustive]
8142pub struct FetchProcessorTypesResponse {
8143 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
8145
8146 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8147}
8148
8149impl FetchProcessorTypesResponse {
8150 pub fn new() -> Self {
8151 std::default::Default::default()
8152 }
8153
8154 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
8156 where
8157 T: std::iter::IntoIterator<Item = V>,
8158 V: std::convert::Into<crate::model::ProcessorType>,
8159 {
8160 use std::iter::Iterator;
8161 self.processor_types = v.into_iter().map(|i| i.into()).collect();
8162 self
8163 }
8164}
8165
8166impl wkt::message::Message for FetchProcessorTypesResponse {
8167 fn typename() -> &'static str {
8168 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
8169 }
8170}
8171
8172#[derive(Clone, Default, PartialEq)]
8179#[non_exhaustive]
8180pub struct ListProcessorTypesRequest {
8181 pub parent: std::string::String,
8184
8185 pub page_size: i32,
8189
8190 pub page_token: std::string::String,
8192
8193 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8194}
8195
8196impl ListProcessorTypesRequest {
8197 pub fn new() -> Self {
8198 std::default::Default::default()
8199 }
8200
8201 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8203 self.parent = v.into();
8204 self
8205 }
8206
8207 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8209 self.page_size = v.into();
8210 self
8211 }
8212
8213 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8215 self.page_token = v.into();
8216 self
8217 }
8218}
8219
8220impl wkt::message::Message for ListProcessorTypesRequest {
8221 fn typename() -> &'static str {
8222 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
8223 }
8224}
8225
8226#[derive(Clone, Default, PartialEq)]
8232#[non_exhaustive]
8233pub struct ListProcessorTypesResponse {
8234 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
8236
8237 pub next_page_token: std::string::String,
8239
8240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8241}
8242
8243impl ListProcessorTypesResponse {
8244 pub fn new() -> Self {
8245 std::default::Default::default()
8246 }
8247
8248 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
8250 where
8251 T: std::iter::IntoIterator<Item = V>,
8252 V: std::convert::Into<crate::model::ProcessorType>,
8253 {
8254 use std::iter::Iterator;
8255 self.processor_types = v.into_iter().map(|i| i.into()).collect();
8256 self
8257 }
8258
8259 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8261 self.next_page_token = v.into();
8262 self
8263 }
8264}
8265
8266impl wkt::message::Message for ListProcessorTypesResponse {
8267 fn typename() -> &'static str {
8268 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
8269 }
8270}
8271
8272#[doc(hidden)]
8273impl gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
8274 type PageItem = crate::model::ProcessorType;
8275
8276 fn items(self) -> std::vec::Vec<Self::PageItem> {
8277 self.processor_types
8278 }
8279
8280 fn next_page_token(&self) -> std::string::String {
8281 use std::clone::Clone;
8282 self.next_page_token.clone()
8283 }
8284}
8285
8286#[derive(Clone, Default, PartialEq)]
8288#[non_exhaustive]
8289pub struct ListProcessorsRequest {
8290 pub parent: std::string::String,
8293
8294 pub page_size: i32,
8298
8299 pub page_token: std::string::String,
8302
8303 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8304}
8305
8306impl ListProcessorsRequest {
8307 pub fn new() -> Self {
8308 std::default::Default::default()
8309 }
8310
8311 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8313 self.parent = v.into();
8314 self
8315 }
8316
8317 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8319 self.page_size = v.into();
8320 self
8321 }
8322
8323 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8325 self.page_token = v.into();
8326 self
8327 }
8328}
8329
8330impl wkt::message::Message for ListProcessorsRequest {
8331 fn typename() -> &'static str {
8332 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
8333 }
8334}
8335
8336#[derive(Clone, Default, PartialEq)]
8342#[non_exhaustive]
8343pub struct ListProcessorsResponse {
8344 pub processors: std::vec::Vec<crate::model::Processor>,
8346
8347 pub next_page_token: std::string::String,
8349
8350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8351}
8352
8353impl ListProcessorsResponse {
8354 pub fn new() -> Self {
8355 std::default::Default::default()
8356 }
8357
8358 pub fn set_processors<T, V>(mut self, v: T) -> Self
8360 where
8361 T: std::iter::IntoIterator<Item = V>,
8362 V: std::convert::Into<crate::model::Processor>,
8363 {
8364 use std::iter::Iterator;
8365 self.processors = v.into_iter().map(|i| i.into()).collect();
8366 self
8367 }
8368
8369 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8371 self.next_page_token = v.into();
8372 self
8373 }
8374}
8375
8376impl wkt::message::Message for ListProcessorsResponse {
8377 fn typename() -> &'static str {
8378 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
8379 }
8380}
8381
8382#[doc(hidden)]
8383impl gax::paginator::internal::PageableResponse for ListProcessorsResponse {
8384 type PageItem = crate::model::Processor;
8385
8386 fn items(self) -> std::vec::Vec<Self::PageItem> {
8387 self.processors
8388 }
8389
8390 fn next_page_token(&self) -> std::string::String {
8391 use std::clone::Clone;
8392 self.next_page_token.clone()
8393 }
8394}
8395
8396#[derive(Clone, Default, PartialEq)]
8402#[non_exhaustive]
8403pub struct GetProcessorTypeRequest {
8404 pub name: std::string::String,
8406
8407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8408}
8409
8410impl GetProcessorTypeRequest {
8411 pub fn new() -> Self {
8412 std::default::Default::default()
8413 }
8414
8415 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8417 self.name = v.into();
8418 self
8419 }
8420}
8421
8422impl wkt::message::Message for GetProcessorTypeRequest {
8423 fn typename() -> &'static str {
8424 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
8425 }
8426}
8427
8428#[derive(Clone, Default, PartialEq)]
8434#[non_exhaustive]
8435pub struct GetProcessorRequest {
8436 pub name: std::string::String,
8438
8439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8440}
8441
8442impl GetProcessorRequest {
8443 pub fn new() -> Self {
8444 std::default::Default::default()
8445 }
8446
8447 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8449 self.name = v.into();
8450 self
8451 }
8452}
8453
8454impl wkt::message::Message for GetProcessorRequest {
8455 fn typename() -> &'static str {
8456 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
8457 }
8458}
8459
8460#[derive(Clone, Default, PartialEq)]
8466#[non_exhaustive]
8467pub struct GetProcessorVersionRequest {
8468 pub name: std::string::String,
8470
8471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8472}
8473
8474impl GetProcessorVersionRequest {
8475 pub fn new() -> Self {
8476 std::default::Default::default()
8477 }
8478
8479 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8481 self.name = v.into();
8482 self
8483 }
8484}
8485
8486impl wkt::message::Message for GetProcessorVersionRequest {
8487 fn typename() -> &'static str {
8488 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
8489 }
8490}
8491
8492#[derive(Clone, Default, PartialEq)]
8494#[non_exhaustive]
8495pub struct ListProcessorVersionsRequest {
8496 pub parent: std::string::String,
8500
8501 pub page_size: i32,
8505
8506 pub page_token: std::string::String,
8509
8510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8511}
8512
8513impl ListProcessorVersionsRequest {
8514 pub fn new() -> Self {
8515 std::default::Default::default()
8516 }
8517
8518 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8520 self.parent = v.into();
8521 self
8522 }
8523
8524 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8526 self.page_size = v.into();
8527 self
8528 }
8529
8530 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8532 self.page_token = v.into();
8533 self
8534 }
8535}
8536
8537impl wkt::message::Message for ListProcessorVersionsRequest {
8538 fn typename() -> &'static str {
8539 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
8540 }
8541}
8542
8543#[derive(Clone, Default, PartialEq)]
8549#[non_exhaustive]
8550pub struct ListProcessorVersionsResponse {
8551 pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
8553
8554 pub next_page_token: std::string::String,
8556
8557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8558}
8559
8560impl ListProcessorVersionsResponse {
8561 pub fn new() -> Self {
8562 std::default::Default::default()
8563 }
8564
8565 pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
8567 where
8568 T: std::iter::IntoIterator<Item = V>,
8569 V: std::convert::Into<crate::model::ProcessorVersion>,
8570 {
8571 use std::iter::Iterator;
8572 self.processor_versions = v.into_iter().map(|i| i.into()).collect();
8573 self
8574 }
8575
8576 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8578 self.next_page_token = v.into();
8579 self
8580 }
8581}
8582
8583impl wkt::message::Message for ListProcessorVersionsResponse {
8584 fn typename() -> &'static str {
8585 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
8586 }
8587}
8588
8589#[doc(hidden)]
8590impl gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
8591 type PageItem = crate::model::ProcessorVersion;
8592
8593 fn items(self) -> std::vec::Vec<Self::PageItem> {
8594 self.processor_versions
8595 }
8596
8597 fn next_page_token(&self) -> std::string::String {
8598 use std::clone::Clone;
8599 self.next_page_token.clone()
8600 }
8601}
8602
8603#[derive(Clone, Default, PartialEq)]
8609#[non_exhaustive]
8610pub struct DeleteProcessorVersionRequest {
8611 pub name: std::string::String,
8613
8614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8615}
8616
8617impl DeleteProcessorVersionRequest {
8618 pub fn new() -> Self {
8619 std::default::Default::default()
8620 }
8621
8622 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8624 self.name = v.into();
8625 self
8626 }
8627}
8628
8629impl wkt::message::Message for DeleteProcessorVersionRequest {
8630 fn typename() -> &'static str {
8631 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
8632 }
8633}
8634
8635#[derive(Clone, Default, PartialEq)]
8641#[non_exhaustive]
8642pub struct DeleteProcessorVersionMetadata {
8643 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
8645
8646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8647}
8648
8649impl DeleteProcessorVersionMetadata {
8650 pub fn new() -> Self {
8651 std::default::Default::default()
8652 }
8653
8654 pub fn set_common_metadata<T>(mut self, v: T) -> Self
8656 where
8657 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8658 {
8659 self.common_metadata = std::option::Option::Some(v.into());
8660 self
8661 }
8662
8663 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
8665 where
8666 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8667 {
8668 self.common_metadata = v.map(|x| x.into());
8669 self
8670 }
8671}
8672
8673impl wkt::message::Message for DeleteProcessorVersionMetadata {
8674 fn typename() -> &'static str {
8675 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
8676 }
8677}
8678
8679#[derive(Clone, Default, PartialEq)]
8685#[non_exhaustive]
8686pub struct DeployProcessorVersionRequest {
8687 pub name: std::string::String,
8689
8690 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8691}
8692
8693impl DeployProcessorVersionRequest {
8694 pub fn new() -> Self {
8695 std::default::Default::default()
8696 }
8697
8698 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8700 self.name = v.into();
8701 self
8702 }
8703}
8704
8705impl wkt::message::Message for DeployProcessorVersionRequest {
8706 fn typename() -> &'static str {
8707 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
8708 }
8709}
8710
8711#[derive(Clone, Default, PartialEq)]
8717#[non_exhaustive]
8718pub struct DeployProcessorVersionResponse {
8719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8720}
8721
8722impl DeployProcessorVersionResponse {
8723 pub fn new() -> Self {
8724 std::default::Default::default()
8725 }
8726}
8727
8728impl wkt::message::Message for DeployProcessorVersionResponse {
8729 fn typename() -> &'static str {
8730 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
8731 }
8732}
8733
8734#[derive(Clone, Default, PartialEq)]
8740#[non_exhaustive]
8741pub struct DeployProcessorVersionMetadata {
8742 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
8744
8745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8746}
8747
8748impl DeployProcessorVersionMetadata {
8749 pub fn new() -> Self {
8750 std::default::Default::default()
8751 }
8752
8753 pub fn set_common_metadata<T>(mut self, v: T) -> Self
8755 where
8756 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8757 {
8758 self.common_metadata = std::option::Option::Some(v.into());
8759 self
8760 }
8761
8762 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
8764 where
8765 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8766 {
8767 self.common_metadata = v.map(|x| x.into());
8768 self
8769 }
8770}
8771
8772impl wkt::message::Message for DeployProcessorVersionMetadata {
8773 fn typename() -> &'static str {
8774 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
8775 }
8776}
8777
8778#[derive(Clone, Default, PartialEq)]
8784#[non_exhaustive]
8785pub struct UndeployProcessorVersionRequest {
8786 pub name: std::string::String,
8788
8789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8790}
8791
8792impl UndeployProcessorVersionRequest {
8793 pub fn new() -> Self {
8794 std::default::Default::default()
8795 }
8796
8797 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8799 self.name = v.into();
8800 self
8801 }
8802}
8803
8804impl wkt::message::Message for UndeployProcessorVersionRequest {
8805 fn typename() -> &'static str {
8806 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
8807 }
8808}
8809
8810#[derive(Clone, Default, PartialEq)]
8816#[non_exhaustive]
8817pub struct UndeployProcessorVersionResponse {
8818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8819}
8820
8821impl UndeployProcessorVersionResponse {
8822 pub fn new() -> Self {
8823 std::default::Default::default()
8824 }
8825}
8826
8827impl wkt::message::Message for UndeployProcessorVersionResponse {
8828 fn typename() -> &'static str {
8829 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
8830 }
8831}
8832
8833#[derive(Clone, Default, PartialEq)]
8839#[non_exhaustive]
8840pub struct UndeployProcessorVersionMetadata {
8841 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
8843
8844 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8845}
8846
8847impl UndeployProcessorVersionMetadata {
8848 pub fn new() -> Self {
8849 std::default::Default::default()
8850 }
8851
8852 pub fn set_common_metadata<T>(mut self, v: T) -> Self
8854 where
8855 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8856 {
8857 self.common_metadata = std::option::Option::Some(v.into());
8858 self
8859 }
8860
8861 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
8863 where
8864 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8865 {
8866 self.common_metadata = v.map(|x| x.into());
8867 self
8868 }
8869}
8870
8871impl wkt::message::Message for UndeployProcessorVersionMetadata {
8872 fn typename() -> &'static str {
8873 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
8874 }
8875}
8876
8877#[derive(Clone, Default, PartialEq)]
8886#[non_exhaustive]
8887pub struct CreateProcessorRequest {
8888 pub parent: std::string::String,
8891
8892 pub processor: std::option::Option<crate::model::Processor>,
8903
8904 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8905}
8906
8907impl CreateProcessorRequest {
8908 pub fn new() -> Self {
8909 std::default::Default::default()
8910 }
8911
8912 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8914 self.parent = v.into();
8915 self
8916 }
8917
8918 pub fn set_processor<T>(mut self, v: T) -> Self
8920 where
8921 T: std::convert::Into<crate::model::Processor>,
8922 {
8923 self.processor = std::option::Option::Some(v.into());
8924 self
8925 }
8926
8927 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
8929 where
8930 T: std::convert::Into<crate::model::Processor>,
8931 {
8932 self.processor = v.map(|x| x.into());
8933 self
8934 }
8935}
8936
8937impl wkt::message::Message for CreateProcessorRequest {
8938 fn typename() -> &'static str {
8939 "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
8940 }
8941}
8942
8943#[derive(Clone, Default, PartialEq)]
8949#[non_exhaustive]
8950pub struct DeleteProcessorRequest {
8951 pub name: std::string::String,
8953
8954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8955}
8956
8957impl DeleteProcessorRequest {
8958 pub fn new() -> Self {
8959 std::default::Default::default()
8960 }
8961
8962 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8964 self.name = v.into();
8965 self
8966 }
8967}
8968
8969impl wkt::message::Message for DeleteProcessorRequest {
8970 fn typename() -> &'static str {
8971 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
8972 }
8973}
8974
8975#[derive(Clone, Default, PartialEq)]
8981#[non_exhaustive]
8982pub struct DeleteProcessorMetadata {
8983 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
8985
8986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8987}
8988
8989impl DeleteProcessorMetadata {
8990 pub fn new() -> Self {
8991 std::default::Default::default()
8992 }
8993
8994 pub fn set_common_metadata<T>(mut self, v: T) -> Self
8996 where
8997 T: std::convert::Into<crate::model::CommonOperationMetadata>,
8998 {
8999 self.common_metadata = std::option::Option::Some(v.into());
9000 self
9001 }
9002
9003 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9005 where
9006 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9007 {
9008 self.common_metadata = v.map(|x| x.into());
9009 self
9010 }
9011}
9012
9013impl wkt::message::Message for DeleteProcessorMetadata {
9014 fn typename() -> &'static str {
9015 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
9016 }
9017}
9018
9019#[derive(Clone, Default, PartialEq)]
9025#[non_exhaustive]
9026pub struct EnableProcessorRequest {
9027 pub name: std::string::String,
9029
9030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9031}
9032
9033impl EnableProcessorRequest {
9034 pub fn new() -> Self {
9035 std::default::Default::default()
9036 }
9037
9038 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9040 self.name = v.into();
9041 self
9042 }
9043}
9044
9045impl wkt::message::Message for EnableProcessorRequest {
9046 fn typename() -> &'static str {
9047 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
9048 }
9049}
9050
9051#[derive(Clone, Default, PartialEq)]
9057#[non_exhaustive]
9058pub struct EnableProcessorResponse {
9059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9060}
9061
9062impl EnableProcessorResponse {
9063 pub fn new() -> Self {
9064 std::default::Default::default()
9065 }
9066}
9067
9068impl wkt::message::Message for EnableProcessorResponse {
9069 fn typename() -> &'static str {
9070 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
9071 }
9072}
9073
9074#[derive(Clone, Default, PartialEq)]
9080#[non_exhaustive]
9081pub struct EnableProcessorMetadata {
9082 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
9084
9085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9086}
9087
9088impl EnableProcessorMetadata {
9089 pub fn new() -> Self {
9090 std::default::Default::default()
9091 }
9092
9093 pub fn set_common_metadata<T>(mut self, v: T) -> Self
9095 where
9096 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9097 {
9098 self.common_metadata = std::option::Option::Some(v.into());
9099 self
9100 }
9101
9102 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9104 where
9105 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9106 {
9107 self.common_metadata = v.map(|x| x.into());
9108 self
9109 }
9110}
9111
9112impl wkt::message::Message for EnableProcessorMetadata {
9113 fn typename() -> &'static str {
9114 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
9115 }
9116}
9117
9118#[derive(Clone, Default, PartialEq)]
9124#[non_exhaustive]
9125pub struct DisableProcessorRequest {
9126 pub name: std::string::String,
9128
9129 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9130}
9131
9132impl DisableProcessorRequest {
9133 pub fn new() -> Self {
9134 std::default::Default::default()
9135 }
9136
9137 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9139 self.name = v.into();
9140 self
9141 }
9142}
9143
9144impl wkt::message::Message for DisableProcessorRequest {
9145 fn typename() -> &'static str {
9146 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
9147 }
9148}
9149
9150#[derive(Clone, Default, PartialEq)]
9156#[non_exhaustive]
9157pub struct DisableProcessorResponse {
9158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9159}
9160
9161impl DisableProcessorResponse {
9162 pub fn new() -> Self {
9163 std::default::Default::default()
9164 }
9165}
9166
9167impl wkt::message::Message for DisableProcessorResponse {
9168 fn typename() -> &'static str {
9169 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
9170 }
9171}
9172
9173#[derive(Clone, Default, PartialEq)]
9179#[non_exhaustive]
9180pub struct DisableProcessorMetadata {
9181 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
9183
9184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9185}
9186
9187impl DisableProcessorMetadata {
9188 pub fn new() -> Self {
9189 std::default::Default::default()
9190 }
9191
9192 pub fn set_common_metadata<T>(mut self, v: T) -> Self
9194 where
9195 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9196 {
9197 self.common_metadata = std::option::Option::Some(v.into());
9198 self
9199 }
9200
9201 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9203 where
9204 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9205 {
9206 self.common_metadata = v.map(|x| x.into());
9207 self
9208 }
9209}
9210
9211impl wkt::message::Message for DisableProcessorMetadata {
9212 fn typename() -> &'static str {
9213 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
9214 }
9215}
9216
9217#[derive(Clone, Default, PartialEq)]
9223#[non_exhaustive]
9224pub struct SetDefaultProcessorVersionRequest {
9225 pub processor: std::string::String,
9231
9232 pub default_processor_version: std::string::String,
9239
9240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9241}
9242
9243impl SetDefaultProcessorVersionRequest {
9244 pub fn new() -> Self {
9245 std::default::Default::default()
9246 }
9247
9248 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9250 self.processor = v.into();
9251 self
9252 }
9253
9254 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
9256 mut self,
9257 v: T,
9258 ) -> Self {
9259 self.default_processor_version = v.into();
9260 self
9261 }
9262}
9263
9264impl wkt::message::Message for SetDefaultProcessorVersionRequest {
9265 fn typename() -> &'static str {
9266 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
9267 }
9268}
9269
9270#[derive(Clone, Default, PartialEq)]
9276#[non_exhaustive]
9277pub struct SetDefaultProcessorVersionResponse {
9278 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9279}
9280
9281impl SetDefaultProcessorVersionResponse {
9282 pub fn new() -> Self {
9283 std::default::Default::default()
9284 }
9285}
9286
9287impl wkt::message::Message for SetDefaultProcessorVersionResponse {
9288 fn typename() -> &'static str {
9289 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
9290 }
9291}
9292
9293#[derive(Clone, Default, PartialEq)]
9299#[non_exhaustive]
9300pub struct SetDefaultProcessorVersionMetadata {
9301 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
9303
9304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9305}
9306
9307impl SetDefaultProcessorVersionMetadata {
9308 pub fn new() -> Self {
9309 std::default::Default::default()
9310 }
9311
9312 pub fn set_common_metadata<T>(mut self, v: T) -> Self
9314 where
9315 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9316 {
9317 self.common_metadata = std::option::Option::Some(v.into());
9318 self
9319 }
9320
9321 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9323 where
9324 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9325 {
9326 self.common_metadata = v.map(|x| x.into());
9327 self
9328 }
9329}
9330
9331impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
9332 fn typename() -> &'static str {
9333 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
9334 }
9335}
9336
9337#[derive(Clone, Default, PartialEq)]
9343#[non_exhaustive]
9344pub struct TrainProcessorVersionRequest {
9345 pub parent: std::string::String,
9349
9350 pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
9352
9353 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
9355
9356 pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
9361
9362 pub base_processor_version: std::string::String,
9366
9367 pub processor_flags:
9368 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
9369
9370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9371}
9372
9373impl TrainProcessorVersionRequest {
9374 pub fn new() -> Self {
9375 std::default::Default::default()
9376 }
9377
9378 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9380 self.parent = v.into();
9381 self
9382 }
9383
9384 pub fn set_processor_version<T>(mut self, v: T) -> Self
9386 where
9387 T: std::convert::Into<crate::model::ProcessorVersion>,
9388 {
9389 self.processor_version = std::option::Option::Some(v.into());
9390 self
9391 }
9392
9393 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
9395 where
9396 T: std::convert::Into<crate::model::ProcessorVersion>,
9397 {
9398 self.processor_version = v.map(|x| x.into());
9399 self
9400 }
9401
9402 pub fn set_document_schema<T>(mut self, v: T) -> Self
9404 where
9405 T: std::convert::Into<crate::model::DocumentSchema>,
9406 {
9407 self.document_schema = std::option::Option::Some(v.into());
9408 self
9409 }
9410
9411 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
9413 where
9414 T: std::convert::Into<crate::model::DocumentSchema>,
9415 {
9416 self.document_schema = v.map(|x| x.into());
9417 self
9418 }
9419
9420 pub fn set_input_data<T>(mut self, v: T) -> Self
9422 where
9423 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
9424 {
9425 self.input_data = std::option::Option::Some(v.into());
9426 self
9427 }
9428
9429 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
9431 where
9432 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
9433 {
9434 self.input_data = v.map(|x| x.into());
9435 self
9436 }
9437
9438 pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
9440 mut self,
9441 v: T,
9442 ) -> Self {
9443 self.base_processor_version = v.into();
9444 self
9445 }
9446
9447 pub fn set_processor_flags<
9452 T: std::convert::Into<
9453 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
9454 >,
9455 >(
9456 mut self,
9457 v: T,
9458 ) -> Self {
9459 self.processor_flags = v.into();
9460 self
9461 }
9462
9463 pub fn custom_document_extraction_options(
9467 &self,
9468 ) -> std::option::Option<
9469 &std::boxed::Box<
9470 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
9471 >,
9472 > {
9473 #[allow(unreachable_patterns)]
9474 self.processor_flags.as_ref().and_then(|v| match v {
9475 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
9476 _ => std::option::Option::None,
9477 })
9478 }
9479
9480 pub fn set_custom_document_extraction_options<
9486 T: std::convert::Into<
9487 std::boxed::Box<
9488 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
9489 >,
9490 >,
9491 >(
9492 mut self,
9493 v: T,
9494 ) -> Self {
9495 self.processor_flags = std::option::Option::Some(
9496 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
9497 v.into()
9498 )
9499 );
9500 self
9501 }
9502
9503 pub fn foundation_model_tuning_options(
9507 &self,
9508 ) -> std::option::Option<
9509 &std::boxed::Box<
9510 crate::model::train_processor_version_request::FoundationModelTuningOptions,
9511 >,
9512 > {
9513 #[allow(unreachable_patterns)]
9514 self.processor_flags.as_ref().and_then(|v| match v {
9515 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
9516 _ => std::option::Option::None,
9517 })
9518 }
9519
9520 pub fn set_foundation_model_tuning_options<
9526 T: std::convert::Into<
9527 std::boxed::Box<
9528 crate::model::train_processor_version_request::FoundationModelTuningOptions,
9529 >,
9530 >,
9531 >(
9532 mut self,
9533 v: T,
9534 ) -> Self {
9535 self.processor_flags = std::option::Option::Some(
9536 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
9537 v.into()
9538 )
9539 );
9540 self
9541 }
9542}
9543
9544impl wkt::message::Message for TrainProcessorVersionRequest {
9545 fn typename() -> &'static str {
9546 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
9547 }
9548}
9549
9550pub mod train_processor_version_request {
9552 #[allow(unused_imports)]
9553 use super::*;
9554
9555 #[derive(Clone, Default, PartialEq)]
9560 #[non_exhaustive]
9561 pub struct InputData {
9562 pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
9564
9565 pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
9567
9568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9569 }
9570
9571 impl InputData {
9572 pub fn new() -> Self {
9573 std::default::Default::default()
9574 }
9575
9576 pub fn set_training_documents<T>(mut self, v: T) -> Self
9578 where
9579 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
9580 {
9581 self.training_documents = std::option::Option::Some(v.into());
9582 self
9583 }
9584
9585 pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
9587 where
9588 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
9589 {
9590 self.training_documents = v.map(|x| x.into());
9591 self
9592 }
9593
9594 pub fn set_test_documents<T>(mut self, v: T) -> Self
9596 where
9597 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
9598 {
9599 self.test_documents = std::option::Option::Some(v.into());
9600 self
9601 }
9602
9603 pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
9605 where
9606 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
9607 {
9608 self.test_documents = v.map(|x| x.into());
9609 self
9610 }
9611 }
9612
9613 impl wkt::message::Message for InputData {
9614 fn typename() -> &'static str {
9615 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
9616 }
9617 }
9618
9619 #[derive(Clone, Default, PartialEq)]
9622 #[non_exhaustive]
9623 pub struct CustomDocumentExtractionOptions {
9624
9625 pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
9627
9628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9629 }
9630
9631 impl CustomDocumentExtractionOptions {
9632 pub fn new() -> Self {
9633 std::default::Default::default()
9634 }
9635
9636 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{
9638 self.training_method = v.into();
9639 self
9640 }
9641 }
9642
9643 impl wkt::message::Message for CustomDocumentExtractionOptions {
9644 fn typename() -> &'static str {
9645 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
9646 }
9647 }
9648
9649 pub mod custom_document_extraction_options {
9651 #[allow(unused_imports)]
9652 use super::*;
9653
9654 #[derive(Clone, Debug, PartialEq)]
9671 #[non_exhaustive]
9672 pub enum TrainingMethod {
9673 Unspecified,
9674 ModelBased,
9675 TemplateBased,
9676 UnknownValue(training_method::UnknownValue),
9681 }
9682
9683 #[doc(hidden)]
9684 pub mod training_method {
9685 #[allow(unused_imports)]
9686 use super::*;
9687 #[derive(Clone, Debug, PartialEq)]
9688 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9689 }
9690
9691 impl TrainingMethod {
9692 pub fn value(&self) -> std::option::Option<i32> {
9697 match self {
9698 Self::Unspecified => std::option::Option::Some(0),
9699 Self::ModelBased => std::option::Option::Some(1),
9700 Self::TemplateBased => std::option::Option::Some(2),
9701 Self::UnknownValue(u) => u.0.value(),
9702 }
9703 }
9704
9705 pub fn name(&self) -> std::option::Option<&str> {
9710 match self {
9711 Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
9712 Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
9713 Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
9714 Self::UnknownValue(u) => u.0.name(),
9715 }
9716 }
9717 }
9718
9719 impl std::default::Default for TrainingMethod {
9720 fn default() -> Self {
9721 use std::convert::From;
9722 Self::from(0)
9723 }
9724 }
9725
9726 impl std::fmt::Display for TrainingMethod {
9727 fn fmt(
9728 &self,
9729 f: &mut std::fmt::Formatter<'_>,
9730 ) -> std::result::Result<(), std::fmt::Error> {
9731 wkt::internal::display_enum(f, self.name(), self.value())
9732 }
9733 }
9734
9735 impl std::convert::From<i32> for TrainingMethod {
9736 fn from(value: i32) -> Self {
9737 match value {
9738 0 => Self::Unspecified,
9739 1 => Self::ModelBased,
9740 2 => Self::TemplateBased,
9741 _ => Self::UnknownValue(training_method::UnknownValue(
9742 wkt::internal::UnknownEnumValue::Integer(value),
9743 )),
9744 }
9745 }
9746 }
9747
9748 impl std::convert::From<&str> for TrainingMethod {
9749 fn from(value: &str) -> Self {
9750 use std::string::ToString;
9751 match value {
9752 "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
9753 "MODEL_BASED" => Self::ModelBased,
9754 "TEMPLATE_BASED" => Self::TemplateBased,
9755 _ => Self::UnknownValue(training_method::UnknownValue(
9756 wkt::internal::UnknownEnumValue::String(value.to_string()),
9757 )),
9758 }
9759 }
9760 }
9761
9762 impl serde::ser::Serialize for TrainingMethod {
9763 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9764 where
9765 S: serde::Serializer,
9766 {
9767 match self {
9768 Self::Unspecified => serializer.serialize_i32(0),
9769 Self::ModelBased => serializer.serialize_i32(1),
9770 Self::TemplateBased => serializer.serialize_i32(2),
9771 Self::UnknownValue(u) => u.0.serialize(serializer),
9772 }
9773 }
9774 }
9775
9776 impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
9777 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9778 where
9779 D: serde::Deserializer<'de>,
9780 {
9781 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
9782 ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
9783 }
9784 }
9785 }
9786
9787 #[derive(Clone, Default, PartialEq)]
9789 #[non_exhaustive]
9790 pub struct FoundationModelTuningOptions {
9791 pub train_steps: i32,
9794
9795 pub learning_rate_multiplier: f32,
9799
9800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9801 }
9802
9803 impl FoundationModelTuningOptions {
9804 pub fn new() -> Self {
9805 std::default::Default::default()
9806 }
9807
9808 pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9810 self.train_steps = v.into();
9811 self
9812 }
9813
9814 pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
9816 self.learning_rate_multiplier = v.into();
9817 self
9818 }
9819 }
9820
9821 impl wkt::message::Message for FoundationModelTuningOptions {
9822 fn typename() -> &'static str {
9823 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
9824 }
9825 }
9826
9827 #[derive(Clone, Debug, PartialEq)]
9828 #[non_exhaustive]
9829 pub enum ProcessorFlags {
9830 CustomDocumentExtractionOptions(
9832 std::boxed::Box<
9833 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
9834 >,
9835 ),
9836 FoundationModelTuningOptions(
9838 std::boxed::Box<
9839 crate::model::train_processor_version_request::FoundationModelTuningOptions,
9840 >,
9841 ),
9842 }
9843}
9844
9845#[derive(Clone, Default, PartialEq)]
9850#[non_exhaustive]
9851pub struct TrainProcessorVersionResponse {
9852 pub processor_version: std::string::String,
9854
9855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9856}
9857
9858impl TrainProcessorVersionResponse {
9859 pub fn new() -> Self {
9860 std::default::Default::default()
9861 }
9862
9863 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
9865 mut self,
9866 v: T,
9867 ) -> Self {
9868 self.processor_version = v.into();
9869 self
9870 }
9871}
9872
9873impl wkt::message::Message for TrainProcessorVersionResponse {
9874 fn typename() -> &'static str {
9875 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
9876 }
9877}
9878
9879#[derive(Clone, Default, PartialEq)]
9881#[non_exhaustive]
9882pub struct TrainProcessorVersionMetadata {
9883 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
9885
9886 pub training_dataset_validation:
9888 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
9889
9890 pub test_dataset_validation:
9892 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
9893
9894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9895}
9896
9897impl TrainProcessorVersionMetadata {
9898 pub fn new() -> Self {
9899 std::default::Default::default()
9900 }
9901
9902 pub fn set_common_metadata<T>(mut self, v: T) -> Self
9904 where
9905 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9906 {
9907 self.common_metadata = std::option::Option::Some(v.into());
9908 self
9909 }
9910
9911 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9913 where
9914 T: std::convert::Into<crate::model::CommonOperationMetadata>,
9915 {
9916 self.common_metadata = v.map(|x| x.into());
9917 self
9918 }
9919
9920 pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
9922 where
9923 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
9924 {
9925 self.training_dataset_validation = std::option::Option::Some(v.into());
9926 self
9927 }
9928
9929 pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
9931 where
9932 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
9933 {
9934 self.training_dataset_validation = v.map(|x| x.into());
9935 self
9936 }
9937
9938 pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
9940 where
9941 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
9942 {
9943 self.test_dataset_validation = std::option::Option::Some(v.into());
9944 self
9945 }
9946
9947 pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
9949 where
9950 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
9951 {
9952 self.test_dataset_validation = v.map(|x| x.into());
9953 self
9954 }
9955}
9956
9957impl wkt::message::Message for TrainProcessorVersionMetadata {
9958 fn typename() -> &'static str {
9959 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
9960 }
9961}
9962
9963pub mod train_processor_version_metadata {
9965 #[allow(unused_imports)]
9966 use super::*;
9967
9968 #[derive(Clone, Default, PartialEq)]
9971 #[non_exhaustive]
9972 pub struct DatasetValidation {
9973 pub document_error_count: i32,
9975
9976 pub dataset_error_count: i32,
9978
9979 pub document_errors: std::vec::Vec<rpc::model::Status>,
9983
9984 pub dataset_errors: std::vec::Vec<rpc::model::Status>,
9988
9989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9990 }
9991
9992 impl DatasetValidation {
9993 pub fn new() -> Self {
9994 std::default::Default::default()
9995 }
9996
9997 pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9999 self.document_error_count = v.into();
10000 self
10001 }
10002
10003 pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10005 self.dataset_error_count = v.into();
10006 self
10007 }
10008
10009 pub fn set_document_errors<T, V>(mut self, v: T) -> Self
10011 where
10012 T: std::iter::IntoIterator<Item = V>,
10013 V: std::convert::Into<rpc::model::Status>,
10014 {
10015 use std::iter::Iterator;
10016 self.document_errors = v.into_iter().map(|i| i.into()).collect();
10017 self
10018 }
10019
10020 pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
10022 where
10023 T: std::iter::IntoIterator<Item = V>,
10024 V: std::convert::Into<rpc::model::Status>,
10025 {
10026 use std::iter::Iterator;
10027 self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
10028 self
10029 }
10030 }
10031
10032 impl wkt::message::Message for DatasetValidation {
10033 fn typename() -> &'static str {
10034 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
10035 }
10036 }
10037}
10038
10039#[derive(Clone, Default, PartialEq)]
10045#[non_exhaustive]
10046pub struct ReviewDocumentRequest {
10047 pub human_review_config: std::string::String,
10051
10052 pub enable_schema_validation: bool,
10054
10055 pub priority: crate::model::review_document_request::Priority,
10057
10058 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
10060
10061 pub source: std::option::Option<crate::model::review_document_request::Source>,
10063
10064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10065}
10066
10067impl ReviewDocumentRequest {
10068 pub fn new() -> Self {
10069 std::default::Default::default()
10070 }
10071
10072 pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
10074 mut self,
10075 v: T,
10076 ) -> Self {
10077 self.human_review_config = v.into();
10078 self
10079 }
10080
10081 pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10083 self.enable_schema_validation = v.into();
10084 self
10085 }
10086
10087 pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
10089 mut self,
10090 v: T,
10091 ) -> Self {
10092 self.priority = v.into();
10093 self
10094 }
10095
10096 pub fn set_document_schema<T>(mut self, v: T) -> Self
10098 where
10099 T: std::convert::Into<crate::model::DocumentSchema>,
10100 {
10101 self.document_schema = std::option::Option::Some(v.into());
10102 self
10103 }
10104
10105 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
10107 where
10108 T: std::convert::Into<crate::model::DocumentSchema>,
10109 {
10110 self.document_schema = v.map(|x| x.into());
10111 self
10112 }
10113
10114 pub fn set_source<
10119 T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
10120 >(
10121 mut self,
10122 v: T,
10123 ) -> Self {
10124 self.source = v.into();
10125 self
10126 }
10127
10128 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
10132 #[allow(unreachable_patterns)]
10133 self.source.as_ref().and_then(|v| match v {
10134 crate::model::review_document_request::Source::InlineDocument(v) => {
10135 std::option::Option::Some(v)
10136 }
10137 _ => std::option::Option::None,
10138 })
10139 }
10140
10141 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
10147 mut self,
10148 v: T,
10149 ) -> Self {
10150 self.source = std::option::Option::Some(
10151 crate::model::review_document_request::Source::InlineDocument(v.into()),
10152 );
10153 self
10154 }
10155}
10156
10157impl wkt::message::Message for ReviewDocumentRequest {
10158 fn typename() -> &'static str {
10159 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
10160 }
10161}
10162
10163pub mod review_document_request {
10165 #[allow(unused_imports)]
10166 use super::*;
10167
10168 #[derive(Clone, Debug, PartialEq)]
10184 #[non_exhaustive]
10185 pub enum Priority {
10186 Default,
10188 Urgent,
10191 UnknownValue(priority::UnknownValue),
10196 }
10197
10198 #[doc(hidden)]
10199 pub mod priority {
10200 #[allow(unused_imports)]
10201 use super::*;
10202 #[derive(Clone, Debug, PartialEq)]
10203 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10204 }
10205
10206 impl Priority {
10207 pub fn value(&self) -> std::option::Option<i32> {
10212 match self {
10213 Self::Default => std::option::Option::Some(0),
10214 Self::Urgent => std::option::Option::Some(1),
10215 Self::UnknownValue(u) => u.0.value(),
10216 }
10217 }
10218
10219 pub fn name(&self) -> std::option::Option<&str> {
10224 match self {
10225 Self::Default => std::option::Option::Some("DEFAULT"),
10226 Self::Urgent => std::option::Option::Some("URGENT"),
10227 Self::UnknownValue(u) => u.0.name(),
10228 }
10229 }
10230 }
10231
10232 impl std::default::Default for Priority {
10233 fn default() -> Self {
10234 use std::convert::From;
10235 Self::from(0)
10236 }
10237 }
10238
10239 impl std::fmt::Display for Priority {
10240 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10241 wkt::internal::display_enum(f, self.name(), self.value())
10242 }
10243 }
10244
10245 impl std::convert::From<i32> for Priority {
10246 fn from(value: i32) -> Self {
10247 match value {
10248 0 => Self::Default,
10249 1 => Self::Urgent,
10250 _ => Self::UnknownValue(priority::UnknownValue(
10251 wkt::internal::UnknownEnumValue::Integer(value),
10252 )),
10253 }
10254 }
10255 }
10256
10257 impl std::convert::From<&str> for Priority {
10258 fn from(value: &str) -> Self {
10259 use std::string::ToString;
10260 match value {
10261 "DEFAULT" => Self::Default,
10262 "URGENT" => Self::Urgent,
10263 _ => Self::UnknownValue(priority::UnknownValue(
10264 wkt::internal::UnknownEnumValue::String(value.to_string()),
10265 )),
10266 }
10267 }
10268 }
10269
10270 impl serde::ser::Serialize for Priority {
10271 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10272 where
10273 S: serde::Serializer,
10274 {
10275 match self {
10276 Self::Default => serializer.serialize_i32(0),
10277 Self::Urgent => serializer.serialize_i32(1),
10278 Self::UnknownValue(u) => u.0.serialize(serializer),
10279 }
10280 }
10281 }
10282
10283 impl<'de> serde::de::Deserialize<'de> for Priority {
10284 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10285 where
10286 D: serde::Deserializer<'de>,
10287 {
10288 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
10289 ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
10290 ))
10291 }
10292 }
10293
10294 #[derive(Clone, Debug, PartialEq)]
10296 #[non_exhaustive]
10297 pub enum Source {
10298 InlineDocument(std::boxed::Box<crate::model::Document>),
10300 }
10301}
10302
10303#[derive(Clone, Default, PartialEq)]
10309#[non_exhaustive]
10310pub struct ReviewDocumentResponse {
10311 pub gcs_destination: std::string::String,
10314
10315 pub state: crate::model::review_document_response::State,
10317
10318 pub rejection_reason: std::string::String,
10320
10321 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10322}
10323
10324impl ReviewDocumentResponse {
10325 pub fn new() -> Self {
10326 std::default::Default::default()
10327 }
10328
10329 pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10331 self.gcs_destination = v.into();
10332 self
10333 }
10334
10335 pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
10337 mut self,
10338 v: T,
10339 ) -> Self {
10340 self.state = v.into();
10341 self
10342 }
10343
10344 pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
10346 mut self,
10347 v: T,
10348 ) -> Self {
10349 self.rejection_reason = v.into();
10350 self
10351 }
10352}
10353
10354impl wkt::message::Message for ReviewDocumentResponse {
10355 fn typename() -> &'static str {
10356 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
10357 }
10358}
10359
10360pub mod review_document_response {
10362 #[allow(unused_imports)]
10363 use super::*;
10364
10365 #[derive(Clone, Debug, PartialEq)]
10381 #[non_exhaustive]
10382 pub enum State {
10383 Unspecified,
10385 Rejected,
10387 Succeeded,
10389 UnknownValue(state::UnknownValue),
10394 }
10395
10396 #[doc(hidden)]
10397 pub mod state {
10398 #[allow(unused_imports)]
10399 use super::*;
10400 #[derive(Clone, Debug, PartialEq)]
10401 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10402 }
10403
10404 impl State {
10405 pub fn value(&self) -> std::option::Option<i32> {
10410 match self {
10411 Self::Unspecified => std::option::Option::Some(0),
10412 Self::Rejected => std::option::Option::Some(1),
10413 Self::Succeeded => std::option::Option::Some(2),
10414 Self::UnknownValue(u) => u.0.value(),
10415 }
10416 }
10417
10418 pub fn name(&self) -> std::option::Option<&str> {
10423 match self {
10424 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10425 Self::Rejected => std::option::Option::Some("REJECTED"),
10426 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
10427 Self::UnknownValue(u) => u.0.name(),
10428 }
10429 }
10430 }
10431
10432 impl std::default::Default for State {
10433 fn default() -> Self {
10434 use std::convert::From;
10435 Self::from(0)
10436 }
10437 }
10438
10439 impl std::fmt::Display for State {
10440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10441 wkt::internal::display_enum(f, self.name(), self.value())
10442 }
10443 }
10444
10445 impl std::convert::From<i32> for State {
10446 fn from(value: i32) -> Self {
10447 match value {
10448 0 => Self::Unspecified,
10449 1 => Self::Rejected,
10450 2 => Self::Succeeded,
10451 _ => Self::UnknownValue(state::UnknownValue(
10452 wkt::internal::UnknownEnumValue::Integer(value),
10453 )),
10454 }
10455 }
10456 }
10457
10458 impl std::convert::From<&str> for State {
10459 fn from(value: &str) -> Self {
10460 use std::string::ToString;
10461 match value {
10462 "STATE_UNSPECIFIED" => Self::Unspecified,
10463 "REJECTED" => Self::Rejected,
10464 "SUCCEEDED" => Self::Succeeded,
10465 _ => Self::UnknownValue(state::UnknownValue(
10466 wkt::internal::UnknownEnumValue::String(value.to_string()),
10467 )),
10468 }
10469 }
10470 }
10471
10472 impl serde::ser::Serialize for State {
10473 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10474 where
10475 S: serde::Serializer,
10476 {
10477 match self {
10478 Self::Unspecified => serializer.serialize_i32(0),
10479 Self::Rejected => serializer.serialize_i32(1),
10480 Self::Succeeded => serializer.serialize_i32(2),
10481 Self::UnknownValue(u) => u.0.serialize(serializer),
10482 }
10483 }
10484 }
10485
10486 impl<'de> serde::de::Deserialize<'de> for State {
10487 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10488 where
10489 D: serde::Deserializer<'de>,
10490 {
10491 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10492 ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
10493 ))
10494 }
10495 }
10496}
10497
10498#[derive(Clone, Default, PartialEq)]
10504#[non_exhaustive]
10505pub struct ReviewDocumentOperationMetadata {
10506 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
10508
10509 pub question_id: std::string::String,
10511
10512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10513}
10514
10515impl ReviewDocumentOperationMetadata {
10516 pub fn new() -> Self {
10517 std::default::Default::default()
10518 }
10519
10520 pub fn set_common_metadata<T>(mut self, v: T) -> Self
10522 where
10523 T: std::convert::Into<crate::model::CommonOperationMetadata>,
10524 {
10525 self.common_metadata = std::option::Option::Some(v.into());
10526 self
10527 }
10528
10529 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
10531 where
10532 T: std::convert::Into<crate::model::CommonOperationMetadata>,
10533 {
10534 self.common_metadata = v.map(|x| x.into());
10535 self
10536 }
10537
10538 pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10540 self.question_id = v.into();
10541 self
10542 }
10543}
10544
10545impl wkt::message::Message for ReviewDocumentOperationMetadata {
10546 fn typename() -> &'static str {
10547 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
10548 }
10549}
10550
10551#[derive(Clone, Default, PartialEq)]
10557#[non_exhaustive]
10558pub struct EvaluateProcessorVersionRequest {
10559 pub processor_version: std::string::String,
10566
10567 pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
10570
10571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10572}
10573
10574impl EvaluateProcessorVersionRequest {
10575 pub fn new() -> Self {
10576 std::default::Default::default()
10577 }
10578
10579 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
10581 mut self,
10582 v: T,
10583 ) -> Self {
10584 self.processor_version = v.into();
10585 self
10586 }
10587
10588 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
10590 where
10591 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
10592 {
10593 self.evaluation_documents = std::option::Option::Some(v.into());
10594 self
10595 }
10596
10597 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
10599 where
10600 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
10601 {
10602 self.evaluation_documents = v.map(|x| x.into());
10603 self
10604 }
10605}
10606
10607impl wkt::message::Message for EvaluateProcessorVersionRequest {
10608 fn typename() -> &'static str {
10609 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
10610 }
10611}
10612
10613#[derive(Clone, Default, PartialEq)]
10619#[non_exhaustive]
10620pub struct EvaluateProcessorVersionMetadata {
10621 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
10623
10624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10625}
10626
10627impl EvaluateProcessorVersionMetadata {
10628 pub fn new() -> Self {
10629 std::default::Default::default()
10630 }
10631
10632 pub fn set_common_metadata<T>(mut self, v: T) -> Self
10634 where
10635 T: std::convert::Into<crate::model::CommonOperationMetadata>,
10636 {
10637 self.common_metadata = std::option::Option::Some(v.into());
10638 self
10639 }
10640
10641 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
10643 where
10644 T: std::convert::Into<crate::model::CommonOperationMetadata>,
10645 {
10646 self.common_metadata = v.map(|x| x.into());
10647 self
10648 }
10649}
10650
10651impl wkt::message::Message for EvaluateProcessorVersionMetadata {
10652 fn typename() -> &'static str {
10653 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
10654 }
10655}
10656
10657#[derive(Clone, Default, PartialEq)]
10663#[non_exhaustive]
10664pub struct EvaluateProcessorVersionResponse {
10665 pub evaluation: std::string::String,
10667
10668 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10669}
10670
10671impl EvaluateProcessorVersionResponse {
10672 pub fn new() -> Self {
10673 std::default::Default::default()
10674 }
10675
10676 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10678 self.evaluation = v.into();
10679 self
10680 }
10681}
10682
10683impl wkt::message::Message for EvaluateProcessorVersionResponse {
10684 fn typename() -> &'static str {
10685 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
10686 }
10687}
10688
10689#[derive(Clone, Default, PartialEq)]
10691#[non_exhaustive]
10692pub struct GetEvaluationRequest {
10693 pub name: std::string::String,
10699
10700 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10701}
10702
10703impl GetEvaluationRequest {
10704 pub fn new() -> Self {
10705 std::default::Default::default()
10706 }
10707
10708 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10710 self.name = v.into();
10711 self
10712 }
10713}
10714
10715impl wkt::message::Message for GetEvaluationRequest {
10716 fn typename() -> &'static str {
10717 "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
10718 }
10719}
10720
10721#[derive(Clone, Default, PartialEq)]
10726#[non_exhaustive]
10727pub struct ListEvaluationsRequest {
10728 pub parent: std::string::String,
10735
10736 pub page_size: i32,
10740
10741 pub page_token: std::string::String,
10744
10745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10746}
10747
10748impl ListEvaluationsRequest {
10749 pub fn new() -> Self {
10750 std::default::Default::default()
10751 }
10752
10753 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10755 self.parent = v.into();
10756 self
10757 }
10758
10759 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10761 self.page_size = v.into();
10762 self
10763 }
10764
10765 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10767 self.page_token = v.into();
10768 self
10769 }
10770}
10771
10772impl wkt::message::Message for ListEvaluationsRequest {
10773 fn typename() -> &'static str {
10774 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
10775 }
10776}
10777
10778#[derive(Clone, Default, PartialEq)]
10780#[non_exhaustive]
10781pub struct ListEvaluationsResponse {
10782 pub evaluations: std::vec::Vec<crate::model::Evaluation>,
10784
10785 pub next_page_token: std::string::String,
10788
10789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10790}
10791
10792impl ListEvaluationsResponse {
10793 pub fn new() -> Self {
10794 std::default::Default::default()
10795 }
10796
10797 pub fn set_evaluations<T, V>(mut self, v: T) -> Self
10799 where
10800 T: std::iter::IntoIterator<Item = V>,
10801 V: std::convert::Into<crate::model::Evaluation>,
10802 {
10803 use std::iter::Iterator;
10804 self.evaluations = v.into_iter().map(|i| i.into()).collect();
10805 self
10806 }
10807
10808 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10810 self.next_page_token = v.into();
10811 self
10812 }
10813}
10814
10815impl wkt::message::Message for ListEvaluationsResponse {
10816 fn typename() -> &'static str {
10817 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
10818 }
10819}
10820
10821#[doc(hidden)]
10822impl gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
10823 type PageItem = crate::model::Evaluation;
10824
10825 fn items(self) -> std::vec::Vec<Self::PageItem> {
10826 self.evaluations
10827 }
10828
10829 fn next_page_token(&self) -> std::string::String {
10830 use std::clone::Clone;
10831 self.next_page_token.clone()
10832 }
10833}
10834
10835#[derive(Clone, Default, PartialEq)]
10837#[non_exhaustive]
10838pub struct DocumentSchema {
10839 pub display_name: std::string::String,
10841
10842 pub description: std::string::String,
10844
10845 pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
10847
10848 pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
10850
10851 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10852}
10853
10854impl DocumentSchema {
10855 pub fn new() -> Self {
10856 std::default::Default::default()
10857 }
10858
10859 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10861 self.display_name = v.into();
10862 self
10863 }
10864
10865 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10867 self.description = v.into();
10868 self
10869 }
10870
10871 pub fn set_entity_types<T, V>(mut self, v: T) -> Self
10873 where
10874 T: std::iter::IntoIterator<Item = V>,
10875 V: std::convert::Into<crate::model::document_schema::EntityType>,
10876 {
10877 use std::iter::Iterator;
10878 self.entity_types = v.into_iter().map(|i| i.into()).collect();
10879 self
10880 }
10881
10882 pub fn set_metadata<T>(mut self, v: T) -> Self
10884 where
10885 T: std::convert::Into<crate::model::document_schema::Metadata>,
10886 {
10887 self.metadata = std::option::Option::Some(v.into());
10888 self
10889 }
10890
10891 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
10893 where
10894 T: std::convert::Into<crate::model::document_schema::Metadata>,
10895 {
10896 self.metadata = v.map(|x| x.into());
10897 self
10898 }
10899}
10900
10901impl wkt::message::Message for DocumentSchema {
10902 fn typename() -> &'static str {
10903 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
10904 }
10905}
10906
10907pub mod document_schema {
10909 #[allow(unused_imports)]
10910 use super::*;
10911
10912 #[derive(Clone, Default, PartialEq)]
10916 #[non_exhaustive]
10917 pub struct EntityType {
10918 pub display_name: std::string::String,
10920
10921 pub name: std::string::String,
10935
10936 pub base_types: std::vec::Vec<std::string::String>,
10939
10940 pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
10942
10943 pub value_source:
10944 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
10945
10946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10947 }
10948
10949 impl EntityType {
10950 pub fn new() -> Self {
10951 std::default::Default::default()
10952 }
10953
10954 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
10956 mut self,
10957 v: T,
10958 ) -> Self {
10959 self.display_name = v.into();
10960 self
10961 }
10962
10963 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10965 self.name = v.into();
10966 self
10967 }
10968
10969 pub fn set_base_types<T, V>(mut self, v: T) -> Self
10971 where
10972 T: std::iter::IntoIterator<Item = V>,
10973 V: std::convert::Into<std::string::String>,
10974 {
10975 use std::iter::Iterator;
10976 self.base_types = v.into_iter().map(|i| i.into()).collect();
10977 self
10978 }
10979
10980 pub fn set_properties<T, V>(mut self, v: T) -> Self
10982 where
10983 T: std::iter::IntoIterator<Item = V>,
10984 V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
10985 {
10986 use std::iter::Iterator;
10987 self.properties = v.into_iter().map(|i| i.into()).collect();
10988 self
10989 }
10990
10991 pub fn set_value_source<
10996 T: std::convert::Into<
10997 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
10998 >,
10999 >(
11000 mut self,
11001 v: T,
11002 ) -> Self {
11003 self.value_source = v.into();
11004 self
11005 }
11006
11007 pub fn enum_values(
11011 &self,
11012 ) -> std::option::Option<
11013 &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
11014 > {
11015 #[allow(unreachable_patterns)]
11016 self.value_source.as_ref().and_then(|v| match v {
11017 crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
11018 std::option::Option::Some(v)
11019 }
11020 _ => std::option::Option::None,
11021 })
11022 }
11023
11024 pub fn set_enum_values<
11030 T: std::convert::Into<
11031 std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
11032 >,
11033 >(
11034 mut self,
11035 v: T,
11036 ) -> Self {
11037 self.value_source = std::option::Option::Some(
11038 crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
11039 );
11040 self
11041 }
11042 }
11043
11044 impl wkt::message::Message for EntityType {
11045 fn typename() -> &'static str {
11046 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
11047 }
11048 }
11049
11050 pub mod entity_type {
11052 #[allow(unused_imports)]
11053 use super::*;
11054
11055 #[derive(Clone, Default, PartialEq)]
11057 #[non_exhaustive]
11058 pub struct EnumValues {
11059 pub values: std::vec::Vec<std::string::String>,
11061
11062 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11063 }
11064
11065 impl EnumValues {
11066 pub fn new() -> Self {
11067 std::default::Default::default()
11068 }
11069
11070 pub fn set_values<T, V>(mut self, v: T) -> Self
11072 where
11073 T: std::iter::IntoIterator<Item = V>,
11074 V: std::convert::Into<std::string::String>,
11075 {
11076 use std::iter::Iterator;
11077 self.values = v.into_iter().map(|i| i.into()).collect();
11078 self
11079 }
11080 }
11081
11082 impl wkt::message::Message for EnumValues {
11083 fn typename() -> &'static str {
11084 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
11085 }
11086 }
11087
11088 #[derive(Clone, Default, PartialEq)]
11090 #[non_exhaustive]
11091 pub struct Property {
11092 pub name: std::string::String,
11095
11096 pub display_name: std::string::String,
11098
11099 pub value_type: std::string::String,
11102
11103 pub occurrence_type:
11106 crate::model::document_schema::entity_type::property::OccurrenceType,
11107
11108 pub method: crate::model::document_schema::entity_type::property::Method,
11110
11111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11112 }
11113
11114 impl Property {
11115 pub fn new() -> Self {
11116 std::default::Default::default()
11117 }
11118
11119 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11121 self.name = v.into();
11122 self
11123 }
11124
11125 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
11127 mut self,
11128 v: T,
11129 ) -> Self {
11130 self.display_name = v.into();
11131 self
11132 }
11133
11134 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
11136 mut self,
11137 v: T,
11138 ) -> Self {
11139 self.value_type = v.into();
11140 self
11141 }
11142
11143 pub fn set_occurrence_type<
11145 T: std::convert::Into<
11146 crate::model::document_schema::entity_type::property::OccurrenceType,
11147 >,
11148 >(
11149 mut self,
11150 v: T,
11151 ) -> Self {
11152 self.occurrence_type = v.into();
11153 self
11154 }
11155
11156 pub fn set_method<
11158 T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
11159 >(
11160 mut self,
11161 v: T,
11162 ) -> Self {
11163 self.method = v.into();
11164 self
11165 }
11166 }
11167
11168 impl wkt::message::Message for Property {
11169 fn typename() -> &'static str {
11170 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
11171 }
11172 }
11173
11174 pub mod property {
11176 #[allow(unused_imports)]
11177 use super::*;
11178
11179 #[derive(Clone, Debug, PartialEq)]
11203 #[non_exhaustive]
11204 pub enum OccurrenceType {
11205 Unspecified,
11207 OptionalOnce,
11210 OptionalMultiple,
11212 RequiredOnce,
11215 RequiredMultiple,
11217 UnknownValue(occurrence_type::UnknownValue),
11222 }
11223
11224 #[doc(hidden)]
11225 pub mod occurrence_type {
11226 #[allow(unused_imports)]
11227 use super::*;
11228 #[derive(Clone, Debug, PartialEq)]
11229 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11230 }
11231
11232 impl OccurrenceType {
11233 pub fn value(&self) -> std::option::Option<i32> {
11238 match self {
11239 Self::Unspecified => std::option::Option::Some(0),
11240 Self::OptionalOnce => std::option::Option::Some(1),
11241 Self::OptionalMultiple => std::option::Option::Some(2),
11242 Self::RequiredOnce => std::option::Option::Some(3),
11243 Self::RequiredMultiple => std::option::Option::Some(4),
11244 Self::UnknownValue(u) => u.0.value(),
11245 }
11246 }
11247
11248 pub fn name(&self) -> std::option::Option<&str> {
11253 match self {
11254 Self::Unspecified => {
11255 std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
11256 }
11257 Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
11258 Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
11259 Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
11260 Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
11261 Self::UnknownValue(u) => u.0.name(),
11262 }
11263 }
11264 }
11265
11266 impl std::default::Default for OccurrenceType {
11267 fn default() -> Self {
11268 use std::convert::From;
11269 Self::from(0)
11270 }
11271 }
11272
11273 impl std::fmt::Display for OccurrenceType {
11274 fn fmt(
11275 &self,
11276 f: &mut std::fmt::Formatter<'_>,
11277 ) -> std::result::Result<(), std::fmt::Error> {
11278 wkt::internal::display_enum(f, self.name(), self.value())
11279 }
11280 }
11281
11282 impl std::convert::From<i32> for OccurrenceType {
11283 fn from(value: i32) -> Self {
11284 match value {
11285 0 => Self::Unspecified,
11286 1 => Self::OptionalOnce,
11287 2 => Self::OptionalMultiple,
11288 3 => Self::RequiredOnce,
11289 4 => Self::RequiredMultiple,
11290 _ => Self::UnknownValue(occurrence_type::UnknownValue(
11291 wkt::internal::UnknownEnumValue::Integer(value),
11292 )),
11293 }
11294 }
11295 }
11296
11297 impl std::convert::From<&str> for OccurrenceType {
11298 fn from(value: &str) -> Self {
11299 use std::string::ToString;
11300 match value {
11301 "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
11302 "OPTIONAL_ONCE" => Self::OptionalOnce,
11303 "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
11304 "REQUIRED_ONCE" => Self::RequiredOnce,
11305 "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
11306 _ => Self::UnknownValue(occurrence_type::UnknownValue(
11307 wkt::internal::UnknownEnumValue::String(value.to_string()),
11308 )),
11309 }
11310 }
11311 }
11312
11313 impl serde::ser::Serialize for OccurrenceType {
11314 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11315 where
11316 S: serde::Serializer,
11317 {
11318 match self {
11319 Self::Unspecified => serializer.serialize_i32(0),
11320 Self::OptionalOnce => serializer.serialize_i32(1),
11321 Self::OptionalMultiple => serializer.serialize_i32(2),
11322 Self::RequiredOnce => serializer.serialize_i32(3),
11323 Self::RequiredMultiple => serializer.serialize_i32(4),
11324 Self::UnknownValue(u) => u.0.serialize(serializer),
11325 }
11326 }
11327 }
11328
11329 impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
11330 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11331 where
11332 D: serde::Deserializer<'de>,
11333 {
11334 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
11335 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
11336 }
11337 }
11338
11339 #[derive(Clone, Debug, PartialEq)]
11355 #[non_exhaustive]
11356 pub enum Method {
11357 Unspecified,
11359 Extract,
11362 Derive,
11365 UnknownValue(method::UnknownValue),
11370 }
11371
11372 #[doc(hidden)]
11373 pub mod method {
11374 #[allow(unused_imports)]
11375 use super::*;
11376 #[derive(Clone, Debug, PartialEq)]
11377 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11378 }
11379
11380 impl Method {
11381 pub fn value(&self) -> std::option::Option<i32> {
11386 match self {
11387 Self::Unspecified => std::option::Option::Some(0),
11388 Self::Extract => std::option::Option::Some(1),
11389 Self::Derive => std::option::Option::Some(2),
11390 Self::UnknownValue(u) => u.0.value(),
11391 }
11392 }
11393
11394 pub fn name(&self) -> std::option::Option<&str> {
11399 match self {
11400 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
11401 Self::Extract => std::option::Option::Some("EXTRACT"),
11402 Self::Derive => std::option::Option::Some("DERIVE"),
11403 Self::UnknownValue(u) => u.0.name(),
11404 }
11405 }
11406 }
11407
11408 impl std::default::Default for Method {
11409 fn default() -> Self {
11410 use std::convert::From;
11411 Self::from(0)
11412 }
11413 }
11414
11415 impl std::fmt::Display for Method {
11416 fn fmt(
11417 &self,
11418 f: &mut std::fmt::Formatter<'_>,
11419 ) -> std::result::Result<(), std::fmt::Error> {
11420 wkt::internal::display_enum(f, self.name(), self.value())
11421 }
11422 }
11423
11424 impl std::convert::From<i32> for Method {
11425 fn from(value: i32) -> Self {
11426 match value {
11427 0 => Self::Unspecified,
11428 1 => Self::Extract,
11429 2 => Self::Derive,
11430 _ => Self::UnknownValue(method::UnknownValue(
11431 wkt::internal::UnknownEnumValue::Integer(value),
11432 )),
11433 }
11434 }
11435 }
11436
11437 impl std::convert::From<&str> for Method {
11438 fn from(value: &str) -> Self {
11439 use std::string::ToString;
11440 match value {
11441 "METHOD_UNSPECIFIED" => Self::Unspecified,
11442 "EXTRACT" => Self::Extract,
11443 "DERIVE" => Self::Derive,
11444 _ => Self::UnknownValue(method::UnknownValue(
11445 wkt::internal::UnknownEnumValue::String(value.to_string()),
11446 )),
11447 }
11448 }
11449 }
11450
11451 impl serde::ser::Serialize for Method {
11452 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11453 where
11454 S: serde::Serializer,
11455 {
11456 match self {
11457 Self::Unspecified => serializer.serialize_i32(0),
11458 Self::Extract => serializer.serialize_i32(1),
11459 Self::Derive => serializer.serialize_i32(2),
11460 Self::UnknownValue(u) => u.0.serialize(serializer),
11461 }
11462 }
11463 }
11464
11465 impl<'de> serde::de::Deserialize<'de> for Method {
11466 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11467 where
11468 D: serde::Deserializer<'de>,
11469 {
11470 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
11471 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
11472 ))
11473 }
11474 }
11475 }
11476
11477 #[derive(Clone, Debug, PartialEq)]
11478 #[non_exhaustive]
11479 pub enum ValueSource {
11480 EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
11486 }
11487 }
11488
11489 #[derive(Clone, Default, PartialEq)]
11491 #[non_exhaustive]
11492 pub struct Metadata {
11493 pub document_splitter: bool,
11497
11498 pub document_allow_multiple_labels: bool,
11501
11502 pub prefixed_naming_on_properties: bool,
11504
11505 pub skip_naming_validation: bool,
11509
11510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11511 }
11512
11513 impl Metadata {
11514 pub fn new() -> Self {
11515 std::default::Default::default()
11516 }
11517
11518 pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11520 self.document_splitter = v.into();
11521 self
11522 }
11523
11524 pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
11526 mut self,
11527 v: T,
11528 ) -> Self {
11529 self.document_allow_multiple_labels = v.into();
11530 self
11531 }
11532
11533 pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
11535 mut self,
11536 v: T,
11537 ) -> Self {
11538 self.prefixed_naming_on_properties = v.into();
11539 self
11540 }
11541
11542 pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11544 self.skip_naming_validation = v.into();
11545 self
11546 }
11547 }
11548
11549 impl wkt::message::Message for Metadata {
11550 fn typename() -> &'static str {
11551 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
11552 }
11553 }
11554}
11555
11556#[derive(Clone, Default, PartialEq)]
11558#[non_exhaustive]
11559pub struct EvaluationReference {
11560 pub operation: std::string::String,
11562
11563 pub evaluation: std::string::String,
11565
11566 pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
11568
11569 pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
11571
11572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11573}
11574
11575impl EvaluationReference {
11576 pub fn new() -> Self {
11577 std::default::Default::default()
11578 }
11579
11580 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11582 self.operation = v.into();
11583 self
11584 }
11585
11586 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11588 self.evaluation = v.into();
11589 self
11590 }
11591
11592 pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
11594 where
11595 T: std::convert::Into<crate::model::evaluation::Metrics>,
11596 {
11597 self.aggregate_metrics = std::option::Option::Some(v.into());
11598 self
11599 }
11600
11601 pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
11603 where
11604 T: std::convert::Into<crate::model::evaluation::Metrics>,
11605 {
11606 self.aggregate_metrics = v.map(|x| x.into());
11607 self
11608 }
11609
11610 pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
11612 where
11613 T: std::convert::Into<crate::model::evaluation::Metrics>,
11614 {
11615 self.aggregate_metrics_exact = std::option::Option::Some(v.into());
11616 self
11617 }
11618
11619 pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
11621 where
11622 T: std::convert::Into<crate::model::evaluation::Metrics>,
11623 {
11624 self.aggregate_metrics_exact = v.map(|x| x.into());
11625 self
11626 }
11627}
11628
11629impl wkt::message::Message for EvaluationReference {
11630 fn typename() -> &'static str {
11631 "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
11632 }
11633}
11634
11635#[derive(Clone, Default, PartialEq)]
11637#[non_exhaustive]
11638pub struct Evaluation {
11639 pub name: std::string::String,
11643
11644 pub create_time: std::option::Option<wkt::Timestamp>,
11646
11647 pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
11649
11650 pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
11652
11653 pub entity_metrics: std::collections::HashMap<
11655 std::string::String,
11656 crate::model::evaluation::MultiConfidenceMetrics,
11657 >,
11658
11659 pub kms_key_name: std::string::String,
11661
11662 pub kms_key_version_name: std::string::String,
11664
11665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11666}
11667
11668impl Evaluation {
11669 pub fn new() -> Self {
11670 std::default::Default::default()
11671 }
11672
11673 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11675 self.name = v.into();
11676 self
11677 }
11678
11679 pub fn set_create_time<T>(mut self, v: T) -> Self
11681 where
11682 T: std::convert::Into<wkt::Timestamp>,
11683 {
11684 self.create_time = std::option::Option::Some(v.into());
11685 self
11686 }
11687
11688 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11690 where
11691 T: std::convert::Into<wkt::Timestamp>,
11692 {
11693 self.create_time = v.map(|x| x.into());
11694 self
11695 }
11696
11697 pub fn set_document_counters<T>(mut self, v: T) -> Self
11699 where
11700 T: std::convert::Into<crate::model::evaluation::Counters>,
11701 {
11702 self.document_counters = std::option::Option::Some(v.into());
11703 self
11704 }
11705
11706 pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
11708 where
11709 T: std::convert::Into<crate::model::evaluation::Counters>,
11710 {
11711 self.document_counters = v.map(|x| x.into());
11712 self
11713 }
11714
11715 pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
11717 where
11718 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
11719 {
11720 self.all_entities_metrics = std::option::Option::Some(v.into());
11721 self
11722 }
11723
11724 pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
11726 where
11727 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
11728 {
11729 self.all_entities_metrics = v.map(|x| x.into());
11730 self
11731 }
11732
11733 pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
11735 where
11736 T: std::iter::IntoIterator<Item = (K, V)>,
11737 K: std::convert::Into<std::string::String>,
11738 V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
11739 {
11740 use std::iter::Iterator;
11741 self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11742 self
11743 }
11744
11745 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11747 self.kms_key_name = v.into();
11748 self
11749 }
11750
11751 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
11753 mut self,
11754 v: T,
11755 ) -> Self {
11756 self.kms_key_version_name = v.into();
11757 self
11758 }
11759}
11760
11761impl wkt::message::Message for Evaluation {
11762 fn typename() -> &'static str {
11763 "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
11764 }
11765}
11766
11767pub mod evaluation {
11769 #[allow(unused_imports)]
11770 use super::*;
11771
11772 #[derive(Clone, Default, PartialEq)]
11774 #[non_exhaustive]
11775 pub struct Counters {
11776 pub input_documents_count: i32,
11778
11779 pub invalid_documents_count: i32,
11782
11783 pub failed_documents_count: i32,
11786
11787 pub evaluated_documents_count: i32,
11789
11790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11791 }
11792
11793 impl Counters {
11794 pub fn new() -> Self {
11795 std::default::Default::default()
11796 }
11797
11798 pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11800 self.input_documents_count = v.into();
11801 self
11802 }
11803
11804 pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11806 self.invalid_documents_count = v.into();
11807 self
11808 }
11809
11810 pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11812 self.failed_documents_count = v.into();
11813 self
11814 }
11815
11816 pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11818 self.evaluated_documents_count = v.into();
11819 self
11820 }
11821 }
11822
11823 impl wkt::message::Message for Counters {
11824 fn typename() -> &'static str {
11825 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
11826 }
11827 }
11828
11829 #[derive(Clone, Default, PartialEq)]
11831 #[non_exhaustive]
11832 pub struct Metrics {
11833 pub precision: f32,
11835
11836 pub recall: f32,
11838
11839 pub f1_score: f32,
11841
11842 pub predicted_occurrences_count: i32,
11844
11845 pub ground_truth_occurrences_count: i32,
11847
11848 pub predicted_document_count: i32,
11850
11851 pub ground_truth_document_count: i32,
11853
11854 pub true_positives_count: i32,
11856
11857 pub false_positives_count: i32,
11859
11860 pub false_negatives_count: i32,
11862
11863 pub total_documents_count: i32,
11865
11866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11867 }
11868
11869 impl Metrics {
11870 pub fn new() -> Self {
11871 std::default::Default::default()
11872 }
11873
11874 pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
11876 self.precision = v.into();
11877 self
11878 }
11879
11880 pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
11882 self.recall = v.into();
11883 self
11884 }
11885
11886 pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
11888 self.f1_score = v.into();
11889 self
11890 }
11891
11892 pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11894 self.predicted_occurrences_count = v.into();
11895 self
11896 }
11897
11898 pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
11900 mut self,
11901 v: T,
11902 ) -> Self {
11903 self.ground_truth_occurrences_count = v.into();
11904 self
11905 }
11906
11907 pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11909 self.predicted_document_count = v.into();
11910 self
11911 }
11912
11913 pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11915 self.ground_truth_document_count = v.into();
11916 self
11917 }
11918
11919 pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11921 self.true_positives_count = v.into();
11922 self
11923 }
11924
11925 pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11927 self.false_positives_count = v.into();
11928 self
11929 }
11930
11931 pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11933 self.false_negatives_count = v.into();
11934 self
11935 }
11936
11937 pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11939 self.total_documents_count = v.into();
11940 self
11941 }
11942 }
11943
11944 impl wkt::message::Message for Metrics {
11945 fn typename() -> &'static str {
11946 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
11947 }
11948 }
11949
11950 #[derive(Clone, Default, PartialEq)]
11952 #[non_exhaustive]
11953 pub struct ConfidenceLevelMetrics {
11954 pub confidence_level: f32,
11956
11957 pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
11959
11960 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11961 }
11962
11963 impl ConfidenceLevelMetrics {
11964 pub fn new() -> Self {
11965 std::default::Default::default()
11966 }
11967
11968 pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
11970 self.confidence_level = v.into();
11971 self
11972 }
11973
11974 pub fn set_metrics<T>(mut self, v: T) -> Self
11976 where
11977 T: std::convert::Into<crate::model::evaluation::Metrics>,
11978 {
11979 self.metrics = std::option::Option::Some(v.into());
11980 self
11981 }
11982
11983 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
11985 where
11986 T: std::convert::Into<crate::model::evaluation::Metrics>,
11987 {
11988 self.metrics = v.map(|x| x.into());
11989 self
11990 }
11991 }
11992
11993 impl wkt::message::Message for ConfidenceLevelMetrics {
11994 fn typename() -> &'static str {
11995 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
11996 }
11997 }
11998
11999 #[derive(Clone, Default, PartialEq)]
12001 #[non_exhaustive]
12002 pub struct MultiConfidenceMetrics {
12003 pub confidence_level_metrics:
12005 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
12006
12007 pub confidence_level_metrics_exact:
12009 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
12010
12011 pub auprc: f32,
12014
12015 pub estimated_calibration_error: f32,
12018
12019 pub auprc_exact: f32,
12022
12023 pub estimated_calibration_error_exact: f32,
12026
12027 pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
12029
12030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12031 }
12032
12033 impl MultiConfidenceMetrics {
12034 pub fn new() -> Self {
12035 std::default::Default::default()
12036 }
12037
12038 pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
12040 where
12041 T: std::iter::IntoIterator<Item = V>,
12042 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
12043 {
12044 use std::iter::Iterator;
12045 self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
12046 self
12047 }
12048
12049 pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
12051 where
12052 T: std::iter::IntoIterator<Item = V>,
12053 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
12054 {
12055 use std::iter::Iterator;
12056 self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
12057 self
12058 }
12059
12060 pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
12062 self.auprc = v.into();
12063 self
12064 }
12065
12066 pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
12068 self.estimated_calibration_error = v.into();
12069 self
12070 }
12071
12072 pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
12074 self.auprc_exact = v.into();
12075 self
12076 }
12077
12078 pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
12080 mut self,
12081 v: T,
12082 ) -> Self {
12083 self.estimated_calibration_error_exact = v.into();
12084 self
12085 }
12086
12087 pub fn set_metrics_type<
12089 T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
12090 >(
12091 mut self,
12092 v: T,
12093 ) -> Self {
12094 self.metrics_type = v.into();
12095 self
12096 }
12097 }
12098
12099 impl wkt::message::Message for MultiConfidenceMetrics {
12100 fn typename() -> &'static str {
12101 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
12102 }
12103 }
12104
12105 pub mod multi_confidence_metrics {
12107 #[allow(unused_imports)]
12108 use super::*;
12109
12110 #[derive(Clone, Debug, PartialEq)]
12126 #[non_exhaustive]
12127 pub enum MetricsType {
12128 Unspecified,
12133 Aggregate,
12138 UnknownValue(metrics_type::UnknownValue),
12143 }
12144
12145 #[doc(hidden)]
12146 pub mod metrics_type {
12147 #[allow(unused_imports)]
12148 use super::*;
12149 #[derive(Clone, Debug, PartialEq)]
12150 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12151 }
12152
12153 impl MetricsType {
12154 pub fn value(&self) -> std::option::Option<i32> {
12159 match self {
12160 Self::Unspecified => std::option::Option::Some(0),
12161 Self::Aggregate => std::option::Option::Some(1),
12162 Self::UnknownValue(u) => u.0.value(),
12163 }
12164 }
12165
12166 pub fn name(&self) -> std::option::Option<&str> {
12171 match self {
12172 Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
12173 Self::Aggregate => std::option::Option::Some("AGGREGATE"),
12174 Self::UnknownValue(u) => u.0.name(),
12175 }
12176 }
12177 }
12178
12179 impl std::default::Default for MetricsType {
12180 fn default() -> Self {
12181 use std::convert::From;
12182 Self::from(0)
12183 }
12184 }
12185
12186 impl std::fmt::Display for MetricsType {
12187 fn fmt(
12188 &self,
12189 f: &mut std::fmt::Formatter<'_>,
12190 ) -> std::result::Result<(), std::fmt::Error> {
12191 wkt::internal::display_enum(f, self.name(), self.value())
12192 }
12193 }
12194
12195 impl std::convert::From<i32> for MetricsType {
12196 fn from(value: i32) -> Self {
12197 match value {
12198 0 => Self::Unspecified,
12199 1 => Self::Aggregate,
12200 _ => Self::UnknownValue(metrics_type::UnknownValue(
12201 wkt::internal::UnknownEnumValue::Integer(value),
12202 )),
12203 }
12204 }
12205 }
12206
12207 impl std::convert::From<&str> for MetricsType {
12208 fn from(value: &str) -> Self {
12209 use std::string::ToString;
12210 match value {
12211 "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
12212 "AGGREGATE" => Self::Aggregate,
12213 _ => Self::UnknownValue(metrics_type::UnknownValue(
12214 wkt::internal::UnknownEnumValue::String(value.to_string()),
12215 )),
12216 }
12217 }
12218 }
12219
12220 impl serde::ser::Serialize for MetricsType {
12221 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12222 where
12223 S: serde::Serializer,
12224 {
12225 match self {
12226 Self::Unspecified => serializer.serialize_i32(0),
12227 Self::Aggregate => serializer.serialize_i32(1),
12228 Self::UnknownValue(u) => u.0.serialize(serializer),
12229 }
12230 }
12231 }
12232
12233 impl<'de> serde::de::Deserialize<'de> for MetricsType {
12234 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12235 where
12236 D: serde::Deserializer<'de>,
12237 {
12238 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
12239 ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
12240 ))
12241 }
12242 }
12243 }
12244}
12245
12246#[derive(Clone, Default, PartialEq)]
12249#[non_exhaustive]
12250pub struct Vertex {
12251 pub x: i32,
12253
12254 pub y: i32,
12256
12257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12258}
12259
12260impl Vertex {
12261 pub fn new() -> Self {
12262 std::default::Default::default()
12263 }
12264
12265 pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12267 self.x = v.into();
12268 self
12269 }
12270
12271 pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12273 self.y = v.into();
12274 self
12275 }
12276}
12277
12278impl wkt::message::Message for Vertex {
12279 fn typename() -> &'static str {
12280 "type.googleapis.com/google.cloud.documentai.v1.Vertex"
12281 }
12282}
12283
12284#[derive(Clone, Default, PartialEq)]
12288#[non_exhaustive]
12289pub struct NormalizedVertex {
12290 pub x: f32,
12292
12293 pub y: f32,
12295
12296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12297}
12298
12299impl NormalizedVertex {
12300 pub fn new() -> Self {
12301 std::default::Default::default()
12302 }
12303
12304 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
12306 self.x = v.into();
12307 self
12308 }
12309
12310 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
12312 self.y = v.into();
12313 self
12314 }
12315}
12316
12317impl wkt::message::Message for NormalizedVertex {
12318 fn typename() -> &'static str {
12319 "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
12320 }
12321}
12322
12323#[derive(Clone, Default, PartialEq)]
12325#[non_exhaustive]
12326pub struct BoundingPoly {
12327 pub vertices: std::vec::Vec<crate::model::Vertex>,
12329
12330 pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
12332
12333 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12334}
12335
12336impl BoundingPoly {
12337 pub fn new() -> Self {
12338 std::default::Default::default()
12339 }
12340
12341 pub fn set_vertices<T, V>(mut self, v: T) -> Self
12343 where
12344 T: std::iter::IntoIterator<Item = V>,
12345 V: std::convert::Into<crate::model::Vertex>,
12346 {
12347 use std::iter::Iterator;
12348 self.vertices = v.into_iter().map(|i| i.into()).collect();
12349 self
12350 }
12351
12352 pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
12354 where
12355 T: std::iter::IntoIterator<Item = V>,
12356 V: std::convert::Into<crate::model::NormalizedVertex>,
12357 {
12358 use std::iter::Iterator;
12359 self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
12360 self
12361 }
12362}
12363
12364impl wkt::message::Message for BoundingPoly {
12365 fn typename() -> &'static str {
12366 "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
12367 }
12368}
12369
12370#[derive(Clone, Default, PartialEq)]
12372#[non_exhaustive]
12373pub struct CommonOperationMetadata {
12374 pub state: crate::model::common_operation_metadata::State,
12376
12377 pub state_message: std::string::String,
12379
12380 pub resource: std::string::String,
12382
12383 pub create_time: std::option::Option<wkt::Timestamp>,
12385
12386 pub update_time: std::option::Option<wkt::Timestamp>,
12388
12389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12390}
12391
12392impl CommonOperationMetadata {
12393 pub fn new() -> Self {
12394 std::default::Default::default()
12395 }
12396
12397 pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
12399 mut self,
12400 v: T,
12401 ) -> Self {
12402 self.state = v.into();
12403 self
12404 }
12405
12406 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12408 self.state_message = v.into();
12409 self
12410 }
12411
12412 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12414 self.resource = v.into();
12415 self
12416 }
12417
12418 pub fn set_create_time<T>(mut self, v: T) -> Self
12420 where
12421 T: std::convert::Into<wkt::Timestamp>,
12422 {
12423 self.create_time = std::option::Option::Some(v.into());
12424 self
12425 }
12426
12427 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12429 where
12430 T: std::convert::Into<wkt::Timestamp>,
12431 {
12432 self.create_time = v.map(|x| x.into());
12433 self
12434 }
12435
12436 pub fn set_update_time<T>(mut self, v: T) -> Self
12438 where
12439 T: std::convert::Into<wkt::Timestamp>,
12440 {
12441 self.update_time = std::option::Option::Some(v.into());
12442 self
12443 }
12444
12445 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12447 where
12448 T: std::convert::Into<wkt::Timestamp>,
12449 {
12450 self.update_time = v.map(|x| x.into());
12451 self
12452 }
12453}
12454
12455impl wkt::message::Message for CommonOperationMetadata {
12456 fn typename() -> &'static str {
12457 "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
12458 }
12459}
12460
12461pub mod common_operation_metadata {
12463 #[allow(unused_imports)]
12464 use super::*;
12465
12466 #[derive(Clone, Debug, PartialEq)]
12482 #[non_exhaustive]
12483 pub enum State {
12484 Unspecified,
12486 Running,
12488 Cancelling,
12490 Succeeded,
12492 Failed,
12494 Cancelled,
12496 UnknownValue(state::UnknownValue),
12501 }
12502
12503 #[doc(hidden)]
12504 pub mod state {
12505 #[allow(unused_imports)]
12506 use super::*;
12507 #[derive(Clone, Debug, PartialEq)]
12508 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12509 }
12510
12511 impl State {
12512 pub fn value(&self) -> std::option::Option<i32> {
12517 match self {
12518 Self::Unspecified => std::option::Option::Some(0),
12519 Self::Running => std::option::Option::Some(1),
12520 Self::Cancelling => std::option::Option::Some(2),
12521 Self::Succeeded => std::option::Option::Some(3),
12522 Self::Failed => std::option::Option::Some(4),
12523 Self::Cancelled => std::option::Option::Some(5),
12524 Self::UnknownValue(u) => u.0.value(),
12525 }
12526 }
12527
12528 pub fn name(&self) -> std::option::Option<&str> {
12533 match self {
12534 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12535 Self::Running => std::option::Option::Some("RUNNING"),
12536 Self::Cancelling => std::option::Option::Some("CANCELLING"),
12537 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
12538 Self::Failed => std::option::Option::Some("FAILED"),
12539 Self::Cancelled => std::option::Option::Some("CANCELLED"),
12540 Self::UnknownValue(u) => u.0.name(),
12541 }
12542 }
12543 }
12544
12545 impl std::default::Default for State {
12546 fn default() -> Self {
12547 use std::convert::From;
12548 Self::from(0)
12549 }
12550 }
12551
12552 impl std::fmt::Display for State {
12553 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12554 wkt::internal::display_enum(f, self.name(), self.value())
12555 }
12556 }
12557
12558 impl std::convert::From<i32> for State {
12559 fn from(value: i32) -> Self {
12560 match value {
12561 0 => Self::Unspecified,
12562 1 => Self::Running,
12563 2 => Self::Cancelling,
12564 3 => Self::Succeeded,
12565 4 => Self::Failed,
12566 5 => Self::Cancelled,
12567 _ => Self::UnknownValue(state::UnknownValue(
12568 wkt::internal::UnknownEnumValue::Integer(value),
12569 )),
12570 }
12571 }
12572 }
12573
12574 impl std::convert::From<&str> for State {
12575 fn from(value: &str) -> Self {
12576 use std::string::ToString;
12577 match value {
12578 "STATE_UNSPECIFIED" => Self::Unspecified,
12579 "RUNNING" => Self::Running,
12580 "CANCELLING" => Self::Cancelling,
12581 "SUCCEEDED" => Self::Succeeded,
12582 "FAILED" => Self::Failed,
12583 "CANCELLED" => Self::Cancelled,
12584 _ => Self::UnknownValue(state::UnknownValue(
12585 wkt::internal::UnknownEnumValue::String(value.to_string()),
12586 )),
12587 }
12588 }
12589 }
12590
12591 impl serde::ser::Serialize for State {
12592 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12593 where
12594 S: serde::Serializer,
12595 {
12596 match self {
12597 Self::Unspecified => serializer.serialize_i32(0),
12598 Self::Running => serializer.serialize_i32(1),
12599 Self::Cancelling => serializer.serialize_i32(2),
12600 Self::Succeeded => serializer.serialize_i32(3),
12601 Self::Failed => serializer.serialize_i32(4),
12602 Self::Cancelled => serializer.serialize_i32(5),
12603 Self::UnknownValue(u) => u.0.serialize(serializer),
12604 }
12605 }
12606 }
12607
12608 impl<'de> serde::de::Deserialize<'de> for State {
12609 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12610 where
12611 D: serde::Deserializer<'de>,
12612 {
12613 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12614 ".google.cloud.documentai.v1.CommonOperationMetadata.State",
12615 ))
12616 }
12617 }
12618}
12619
12620#[derive(Clone, Default, PartialEq)]
12625#[non_exhaustive]
12626pub struct ProcessorVersion {
12627 pub name: std::string::String,
12631
12632 pub display_name: std::string::String,
12634
12635 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
12637
12638 pub state: crate::model::processor_version::State,
12640
12641 pub create_time: std::option::Option<wkt::Timestamp>,
12643
12644 pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
12647
12648 pub kms_key_name: std::string::String,
12650
12651 pub kms_key_version_name: std::string::String,
12653
12654 pub google_managed: bool,
12656
12657 pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
12660
12661 pub model_type: crate::model::processor_version::ModelType,
12663
12664 pub satisfies_pzs: bool,
12666
12667 pub satisfies_pzi: bool,
12669
12670 pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
12673
12674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12675}
12676
12677impl ProcessorVersion {
12678 pub fn new() -> Self {
12679 std::default::Default::default()
12680 }
12681
12682 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12684 self.name = v.into();
12685 self
12686 }
12687
12688 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12690 self.display_name = v.into();
12691 self
12692 }
12693
12694 pub fn set_document_schema<T>(mut self, v: T) -> Self
12696 where
12697 T: std::convert::Into<crate::model::DocumentSchema>,
12698 {
12699 self.document_schema = std::option::Option::Some(v.into());
12700 self
12701 }
12702
12703 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
12705 where
12706 T: std::convert::Into<crate::model::DocumentSchema>,
12707 {
12708 self.document_schema = v.map(|x| x.into());
12709 self
12710 }
12711
12712 pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
12714 mut self,
12715 v: T,
12716 ) -> Self {
12717 self.state = v.into();
12718 self
12719 }
12720
12721 pub fn set_create_time<T>(mut self, v: T) -> Self
12723 where
12724 T: std::convert::Into<wkt::Timestamp>,
12725 {
12726 self.create_time = std::option::Option::Some(v.into());
12727 self
12728 }
12729
12730 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12732 where
12733 T: std::convert::Into<wkt::Timestamp>,
12734 {
12735 self.create_time = v.map(|x| x.into());
12736 self
12737 }
12738
12739 pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
12741 where
12742 T: std::convert::Into<crate::model::EvaluationReference>,
12743 {
12744 self.latest_evaluation = std::option::Option::Some(v.into());
12745 self
12746 }
12747
12748 pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
12750 where
12751 T: std::convert::Into<crate::model::EvaluationReference>,
12752 {
12753 self.latest_evaluation = v.map(|x| x.into());
12754 self
12755 }
12756
12757 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12759 self.kms_key_name = v.into();
12760 self
12761 }
12762
12763 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
12765 mut self,
12766 v: T,
12767 ) -> Self {
12768 self.kms_key_version_name = v.into();
12769 self
12770 }
12771
12772 pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12774 self.google_managed = v.into();
12775 self
12776 }
12777
12778 pub fn set_deprecation_info<T>(mut self, v: T) -> Self
12780 where
12781 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
12782 {
12783 self.deprecation_info = std::option::Option::Some(v.into());
12784 self
12785 }
12786
12787 pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
12789 where
12790 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
12791 {
12792 self.deprecation_info = v.map(|x| x.into());
12793 self
12794 }
12795
12796 pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
12798 mut self,
12799 v: T,
12800 ) -> Self {
12801 self.model_type = v.into();
12802 self
12803 }
12804
12805 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12807 self.satisfies_pzs = v.into();
12808 self
12809 }
12810
12811 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12813 self.satisfies_pzi = v.into();
12814 self
12815 }
12816
12817 pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
12819 where
12820 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
12821 {
12822 self.gen_ai_model_info = std::option::Option::Some(v.into());
12823 self
12824 }
12825
12826 pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
12828 where
12829 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
12830 {
12831 self.gen_ai_model_info = v.map(|x| x.into());
12832 self
12833 }
12834}
12835
12836impl wkt::message::Message for ProcessorVersion {
12837 fn typename() -> &'static str {
12838 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
12839 }
12840}
12841
12842pub mod processor_version {
12844 #[allow(unused_imports)]
12845 use super::*;
12846
12847 #[derive(Clone, Default, PartialEq)]
12849 #[non_exhaustive]
12850 pub struct DeprecationInfo {
12851 pub deprecation_time: std::option::Option<wkt::Timestamp>,
12853
12854 pub replacement_processor_version: std::string::String,
12856
12857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12858 }
12859
12860 impl DeprecationInfo {
12861 pub fn new() -> Self {
12862 std::default::Default::default()
12863 }
12864
12865 pub fn set_deprecation_time<T>(mut self, v: T) -> Self
12867 where
12868 T: std::convert::Into<wkt::Timestamp>,
12869 {
12870 self.deprecation_time = std::option::Option::Some(v.into());
12871 self
12872 }
12873
12874 pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
12876 where
12877 T: std::convert::Into<wkt::Timestamp>,
12878 {
12879 self.deprecation_time = v.map(|x| x.into());
12880 self
12881 }
12882
12883 pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
12885 mut self,
12886 v: T,
12887 ) -> Self {
12888 self.replacement_processor_version = v.into();
12889 self
12890 }
12891 }
12892
12893 impl wkt::message::Message for DeprecationInfo {
12894 fn typename() -> &'static str {
12895 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
12896 }
12897 }
12898
12899 #[derive(Clone, Default, PartialEq)]
12901 #[non_exhaustive]
12902 pub struct GenAiModelInfo {
12903 pub model_info:
12906 std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
12907
12908 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12909 }
12910
12911 impl GenAiModelInfo {
12912 pub fn new() -> Self {
12913 std::default::Default::default()
12914 }
12915
12916 pub fn set_model_info<
12921 T: std::convert::Into<
12922 std::option::Option<
12923 crate::model::processor_version::gen_ai_model_info::ModelInfo,
12924 >,
12925 >,
12926 >(
12927 mut self,
12928 v: T,
12929 ) -> Self {
12930 self.model_info = v.into();
12931 self
12932 }
12933
12934 pub fn foundation_gen_ai_model_info(
12938 &self,
12939 ) -> std::option::Option<
12940 &std::boxed::Box<
12941 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
12942 >,
12943 > {
12944 #[allow(unreachable_patterns)]
12945 self.model_info.as_ref().and_then(|v| match v {
12946 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
12947 _ => std::option::Option::None,
12948 })
12949 }
12950
12951 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{
12957 self.model_info = std::option::Option::Some(
12958 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
12959 v.into()
12960 )
12961 );
12962 self
12963 }
12964
12965 pub fn custom_gen_ai_model_info(
12969 &self,
12970 ) -> std::option::Option<
12971 &std::boxed::Box<
12972 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
12973 >,
12974 > {
12975 #[allow(unreachable_patterns)]
12976 self.model_info.as_ref().and_then(|v| match v {
12977 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
12978 _ => std::option::Option::None,
12979 })
12980 }
12981
12982 pub fn set_custom_gen_ai_model_info<
12988 T: std::convert::Into<
12989 std::boxed::Box<
12990 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
12991 >,
12992 >,
12993 >(
12994 mut self,
12995 v: T,
12996 ) -> Self {
12997 self.model_info = std::option::Option::Some(
12998 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
12999 v.into(),
13000 ),
13001 );
13002 self
13003 }
13004 }
13005
13006 impl wkt::message::Message for GenAiModelInfo {
13007 fn typename() -> &'static str {
13008 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
13009 }
13010 }
13011
13012 pub mod gen_ai_model_info {
13014 #[allow(unused_imports)]
13015 use super::*;
13016
13017 #[derive(Clone, Default, PartialEq)]
13019 #[non_exhaustive]
13020 pub struct FoundationGenAiModelInfo {
13021 pub finetuning_allowed: bool,
13023
13024 pub min_train_labeled_documents: i32,
13027
13028 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13029 }
13030
13031 impl FoundationGenAiModelInfo {
13032 pub fn new() -> Self {
13033 std::default::Default::default()
13034 }
13035
13036 pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13038 self.finetuning_allowed = v.into();
13039 self
13040 }
13041
13042 pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
13044 mut self,
13045 v: T,
13046 ) -> Self {
13047 self.min_train_labeled_documents = v.into();
13048 self
13049 }
13050 }
13051
13052 impl wkt::message::Message for FoundationGenAiModelInfo {
13053 fn typename() -> &'static str {
13054 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
13055 }
13056 }
13057
13058 #[derive(Clone, Default, PartialEq)]
13062 #[non_exhaustive]
13063 pub struct CustomGenAiModelInfo {
13064
13065 pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
13067
13068 pub base_processor_version_id: std::string::String,
13070
13071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13072 }
13073
13074 impl CustomGenAiModelInfo {
13075 pub fn new() -> Self {
13076 std::default::Default::default()
13077 }
13078
13079 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{
13081 self.custom_model_type = v.into();
13082 self
13083 }
13084
13085 pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
13087 mut self,
13088 v: T,
13089 ) -> Self {
13090 self.base_processor_version_id = v.into();
13091 self
13092 }
13093 }
13094
13095 impl wkt::message::Message for CustomGenAiModelInfo {
13096 fn typename() -> &'static str {
13097 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
13098 }
13099 }
13100
13101 pub mod custom_gen_ai_model_info {
13103 #[allow(unused_imports)]
13104 use super::*;
13105
13106 #[derive(Clone, Debug, PartialEq)]
13122 #[non_exhaustive]
13123 pub enum CustomModelType {
13124 Unspecified,
13126 VersionedFoundation,
13128 FineTuned,
13130 UnknownValue(custom_model_type::UnknownValue),
13135 }
13136
13137 #[doc(hidden)]
13138 pub mod custom_model_type {
13139 #[allow(unused_imports)]
13140 use super::*;
13141 #[derive(Clone, Debug, PartialEq)]
13142 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13143 }
13144
13145 impl CustomModelType {
13146 pub fn value(&self) -> std::option::Option<i32> {
13151 match self {
13152 Self::Unspecified => std::option::Option::Some(0),
13153 Self::VersionedFoundation => std::option::Option::Some(1),
13154 Self::FineTuned => std::option::Option::Some(2),
13155 Self::UnknownValue(u) => u.0.value(),
13156 }
13157 }
13158
13159 pub fn name(&self) -> std::option::Option<&str> {
13164 match self {
13165 Self::Unspecified => {
13166 std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
13167 }
13168 Self::VersionedFoundation => {
13169 std::option::Option::Some("VERSIONED_FOUNDATION")
13170 }
13171 Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
13172 Self::UnknownValue(u) => u.0.name(),
13173 }
13174 }
13175 }
13176
13177 impl std::default::Default for CustomModelType {
13178 fn default() -> Self {
13179 use std::convert::From;
13180 Self::from(0)
13181 }
13182 }
13183
13184 impl std::fmt::Display for CustomModelType {
13185 fn fmt(
13186 &self,
13187 f: &mut std::fmt::Formatter<'_>,
13188 ) -> std::result::Result<(), std::fmt::Error> {
13189 wkt::internal::display_enum(f, self.name(), self.value())
13190 }
13191 }
13192
13193 impl std::convert::From<i32> for CustomModelType {
13194 fn from(value: i32) -> Self {
13195 match value {
13196 0 => Self::Unspecified,
13197 1 => Self::VersionedFoundation,
13198 2 => Self::FineTuned,
13199 _ => Self::UnknownValue(custom_model_type::UnknownValue(
13200 wkt::internal::UnknownEnumValue::Integer(value),
13201 )),
13202 }
13203 }
13204 }
13205
13206 impl std::convert::From<&str> for CustomModelType {
13207 fn from(value: &str) -> Self {
13208 use std::string::ToString;
13209 match value {
13210 "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
13211 "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
13212 "FINE_TUNED" => Self::FineTuned,
13213 _ => Self::UnknownValue(custom_model_type::UnknownValue(
13214 wkt::internal::UnknownEnumValue::String(value.to_string()),
13215 )),
13216 }
13217 }
13218 }
13219
13220 impl serde::ser::Serialize for CustomModelType {
13221 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13222 where
13223 S: serde::Serializer,
13224 {
13225 match self {
13226 Self::Unspecified => serializer.serialize_i32(0),
13227 Self::VersionedFoundation => serializer.serialize_i32(1),
13228 Self::FineTuned => serializer.serialize_i32(2),
13229 Self::UnknownValue(u) => u.0.serialize(serializer),
13230 }
13231 }
13232 }
13233
13234 impl<'de> serde::de::Deserialize<'de> for CustomModelType {
13235 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13236 where
13237 D: serde::Deserializer<'de>,
13238 {
13239 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
13240 ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
13241 }
13242 }
13243 }
13244
13245 #[derive(Clone, Debug, PartialEq)]
13248 #[non_exhaustive]
13249 pub enum ModelInfo {
13250 FoundationGenAiModelInfo(
13252 std::boxed::Box<
13253 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
13254 >,
13255 ),
13256 CustomGenAiModelInfo(
13258 std::boxed::Box<
13259 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
13260 >,
13261 ),
13262 }
13263 }
13264
13265 #[derive(Clone, Debug, PartialEq)]
13281 #[non_exhaustive]
13282 pub enum State {
13283 Unspecified,
13285 Deployed,
13287 Deploying,
13289 Undeployed,
13291 Undeploying,
13293 Creating,
13295 Deleting,
13297 Failed,
13299 Importing,
13301 UnknownValue(state::UnknownValue),
13306 }
13307
13308 #[doc(hidden)]
13309 pub mod state {
13310 #[allow(unused_imports)]
13311 use super::*;
13312 #[derive(Clone, Debug, PartialEq)]
13313 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13314 }
13315
13316 impl State {
13317 pub fn value(&self) -> std::option::Option<i32> {
13322 match self {
13323 Self::Unspecified => std::option::Option::Some(0),
13324 Self::Deployed => std::option::Option::Some(1),
13325 Self::Deploying => std::option::Option::Some(2),
13326 Self::Undeployed => std::option::Option::Some(3),
13327 Self::Undeploying => std::option::Option::Some(4),
13328 Self::Creating => std::option::Option::Some(5),
13329 Self::Deleting => std::option::Option::Some(6),
13330 Self::Failed => std::option::Option::Some(7),
13331 Self::Importing => std::option::Option::Some(8),
13332 Self::UnknownValue(u) => u.0.value(),
13333 }
13334 }
13335
13336 pub fn name(&self) -> std::option::Option<&str> {
13341 match self {
13342 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13343 Self::Deployed => std::option::Option::Some("DEPLOYED"),
13344 Self::Deploying => std::option::Option::Some("DEPLOYING"),
13345 Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
13346 Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
13347 Self::Creating => std::option::Option::Some("CREATING"),
13348 Self::Deleting => std::option::Option::Some("DELETING"),
13349 Self::Failed => std::option::Option::Some("FAILED"),
13350 Self::Importing => std::option::Option::Some("IMPORTING"),
13351 Self::UnknownValue(u) => u.0.name(),
13352 }
13353 }
13354 }
13355
13356 impl std::default::Default for State {
13357 fn default() -> Self {
13358 use std::convert::From;
13359 Self::from(0)
13360 }
13361 }
13362
13363 impl std::fmt::Display for State {
13364 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13365 wkt::internal::display_enum(f, self.name(), self.value())
13366 }
13367 }
13368
13369 impl std::convert::From<i32> for State {
13370 fn from(value: i32) -> Self {
13371 match value {
13372 0 => Self::Unspecified,
13373 1 => Self::Deployed,
13374 2 => Self::Deploying,
13375 3 => Self::Undeployed,
13376 4 => Self::Undeploying,
13377 5 => Self::Creating,
13378 6 => Self::Deleting,
13379 7 => Self::Failed,
13380 8 => Self::Importing,
13381 _ => Self::UnknownValue(state::UnknownValue(
13382 wkt::internal::UnknownEnumValue::Integer(value),
13383 )),
13384 }
13385 }
13386 }
13387
13388 impl std::convert::From<&str> for State {
13389 fn from(value: &str) -> Self {
13390 use std::string::ToString;
13391 match value {
13392 "STATE_UNSPECIFIED" => Self::Unspecified,
13393 "DEPLOYED" => Self::Deployed,
13394 "DEPLOYING" => Self::Deploying,
13395 "UNDEPLOYED" => Self::Undeployed,
13396 "UNDEPLOYING" => Self::Undeploying,
13397 "CREATING" => Self::Creating,
13398 "DELETING" => Self::Deleting,
13399 "FAILED" => Self::Failed,
13400 "IMPORTING" => Self::Importing,
13401 _ => Self::UnknownValue(state::UnknownValue(
13402 wkt::internal::UnknownEnumValue::String(value.to_string()),
13403 )),
13404 }
13405 }
13406 }
13407
13408 impl serde::ser::Serialize for State {
13409 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13410 where
13411 S: serde::Serializer,
13412 {
13413 match self {
13414 Self::Unspecified => serializer.serialize_i32(0),
13415 Self::Deployed => serializer.serialize_i32(1),
13416 Self::Deploying => serializer.serialize_i32(2),
13417 Self::Undeployed => serializer.serialize_i32(3),
13418 Self::Undeploying => serializer.serialize_i32(4),
13419 Self::Creating => serializer.serialize_i32(5),
13420 Self::Deleting => serializer.serialize_i32(6),
13421 Self::Failed => serializer.serialize_i32(7),
13422 Self::Importing => serializer.serialize_i32(8),
13423 Self::UnknownValue(u) => u.0.serialize(serializer),
13424 }
13425 }
13426 }
13427
13428 impl<'de> serde::de::Deserialize<'de> for State {
13429 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13430 where
13431 D: serde::Deserializer<'de>,
13432 {
13433 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13434 ".google.cloud.documentai.v1.ProcessorVersion.State",
13435 ))
13436 }
13437 }
13438
13439 #[derive(Clone, Debug, PartialEq)]
13455 #[non_exhaustive]
13456 pub enum ModelType {
13457 Unspecified,
13459 Generative,
13461 Custom,
13463 UnknownValue(model_type::UnknownValue),
13468 }
13469
13470 #[doc(hidden)]
13471 pub mod model_type {
13472 #[allow(unused_imports)]
13473 use super::*;
13474 #[derive(Clone, Debug, PartialEq)]
13475 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13476 }
13477
13478 impl ModelType {
13479 pub fn value(&self) -> std::option::Option<i32> {
13484 match self {
13485 Self::Unspecified => std::option::Option::Some(0),
13486 Self::Generative => std::option::Option::Some(1),
13487 Self::Custom => std::option::Option::Some(2),
13488 Self::UnknownValue(u) => u.0.value(),
13489 }
13490 }
13491
13492 pub fn name(&self) -> std::option::Option<&str> {
13497 match self {
13498 Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
13499 Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
13500 Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
13501 Self::UnknownValue(u) => u.0.name(),
13502 }
13503 }
13504 }
13505
13506 impl std::default::Default for ModelType {
13507 fn default() -> Self {
13508 use std::convert::From;
13509 Self::from(0)
13510 }
13511 }
13512
13513 impl std::fmt::Display for ModelType {
13514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13515 wkt::internal::display_enum(f, self.name(), self.value())
13516 }
13517 }
13518
13519 impl std::convert::From<i32> for ModelType {
13520 fn from(value: i32) -> Self {
13521 match value {
13522 0 => Self::Unspecified,
13523 1 => Self::Generative,
13524 2 => Self::Custom,
13525 _ => Self::UnknownValue(model_type::UnknownValue(
13526 wkt::internal::UnknownEnumValue::Integer(value),
13527 )),
13528 }
13529 }
13530 }
13531
13532 impl std::convert::From<&str> for ModelType {
13533 fn from(value: &str) -> Self {
13534 use std::string::ToString;
13535 match value {
13536 "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
13537 "MODEL_TYPE_GENERATIVE" => Self::Generative,
13538 "MODEL_TYPE_CUSTOM" => Self::Custom,
13539 _ => Self::UnknownValue(model_type::UnknownValue(
13540 wkt::internal::UnknownEnumValue::String(value.to_string()),
13541 )),
13542 }
13543 }
13544 }
13545
13546 impl serde::ser::Serialize for ModelType {
13547 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13548 where
13549 S: serde::Serializer,
13550 {
13551 match self {
13552 Self::Unspecified => serializer.serialize_i32(0),
13553 Self::Generative => serializer.serialize_i32(1),
13554 Self::Custom => serializer.serialize_i32(2),
13555 Self::UnknownValue(u) => u.0.serialize(serializer),
13556 }
13557 }
13558 }
13559
13560 impl<'de> serde::de::Deserialize<'de> for ModelType {
13561 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13562 where
13563 D: serde::Deserializer<'de>,
13564 {
13565 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
13566 ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
13567 ))
13568 }
13569 }
13570}
13571
13572#[derive(Clone, Default, PartialEq)]
13574#[non_exhaustive]
13575pub struct ProcessorVersionAlias {
13576 pub alias: std::string::String,
13578
13579 pub processor_version: std::string::String,
13581
13582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13583}
13584
13585impl ProcessorVersionAlias {
13586 pub fn new() -> Self {
13587 std::default::Default::default()
13588 }
13589
13590 pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13592 self.alias = v.into();
13593 self
13594 }
13595
13596 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
13598 mut self,
13599 v: T,
13600 ) -> Self {
13601 self.processor_version = v.into();
13602 self
13603 }
13604}
13605
13606impl wkt::message::Message for ProcessorVersionAlias {
13607 fn typename() -> &'static str {
13608 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
13609 }
13610}
13611
13612#[derive(Clone, Default, PartialEq)]
13615#[non_exhaustive]
13616pub struct Processor {
13617 pub name: std::string::String,
13620
13621 pub r#type: std::string::String,
13627
13628 pub display_name: std::string::String,
13630
13631 pub state: crate::model::processor::State,
13633
13634 pub default_processor_version: std::string::String,
13636
13637 pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
13639
13640 pub process_endpoint: std::string::String,
13643
13644 pub create_time: std::option::Option<wkt::Timestamp>,
13646
13647 pub kms_key_name: std::string::String,
13650
13651 pub satisfies_pzs: bool,
13653
13654 pub satisfies_pzi: bool,
13656
13657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13658}
13659
13660impl Processor {
13661 pub fn new() -> Self {
13662 std::default::Default::default()
13663 }
13664
13665 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13667 self.name = v.into();
13668 self
13669 }
13670
13671 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13673 self.r#type = v.into();
13674 self
13675 }
13676
13677 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13679 self.display_name = v.into();
13680 self
13681 }
13682
13683 pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
13685 mut self,
13686 v: T,
13687 ) -> Self {
13688 self.state = v.into();
13689 self
13690 }
13691
13692 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
13694 mut self,
13695 v: T,
13696 ) -> Self {
13697 self.default_processor_version = v.into();
13698 self
13699 }
13700
13701 pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
13703 where
13704 T: std::iter::IntoIterator<Item = V>,
13705 V: std::convert::Into<crate::model::ProcessorVersionAlias>,
13706 {
13707 use std::iter::Iterator;
13708 self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
13709 self
13710 }
13711
13712 pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
13714 mut self,
13715 v: T,
13716 ) -> Self {
13717 self.process_endpoint = v.into();
13718 self
13719 }
13720
13721 pub fn set_create_time<T>(mut self, v: T) -> Self
13723 where
13724 T: std::convert::Into<wkt::Timestamp>,
13725 {
13726 self.create_time = std::option::Option::Some(v.into());
13727 self
13728 }
13729
13730 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13732 where
13733 T: std::convert::Into<wkt::Timestamp>,
13734 {
13735 self.create_time = v.map(|x| x.into());
13736 self
13737 }
13738
13739 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13741 self.kms_key_name = v.into();
13742 self
13743 }
13744
13745 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13747 self.satisfies_pzs = v.into();
13748 self
13749 }
13750
13751 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13753 self.satisfies_pzi = v.into();
13754 self
13755 }
13756}
13757
13758impl wkt::message::Message for Processor {
13759 fn typename() -> &'static str {
13760 "type.googleapis.com/google.cloud.documentai.v1.Processor"
13761 }
13762}
13763
13764pub mod processor {
13766 #[allow(unused_imports)]
13767 use super::*;
13768
13769 #[derive(Clone, Debug, PartialEq)]
13785 #[non_exhaustive]
13786 pub enum State {
13787 Unspecified,
13789 Enabled,
13793 Disabled,
13795 Enabling,
13797 Disabling,
13799 Creating,
13805 Failed,
13809 Deleting,
13811 UnknownValue(state::UnknownValue),
13816 }
13817
13818 #[doc(hidden)]
13819 pub mod state {
13820 #[allow(unused_imports)]
13821 use super::*;
13822 #[derive(Clone, Debug, PartialEq)]
13823 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13824 }
13825
13826 impl State {
13827 pub fn value(&self) -> std::option::Option<i32> {
13832 match self {
13833 Self::Unspecified => std::option::Option::Some(0),
13834 Self::Enabled => std::option::Option::Some(1),
13835 Self::Disabled => std::option::Option::Some(2),
13836 Self::Enabling => std::option::Option::Some(3),
13837 Self::Disabling => std::option::Option::Some(4),
13838 Self::Creating => std::option::Option::Some(5),
13839 Self::Failed => std::option::Option::Some(6),
13840 Self::Deleting => std::option::Option::Some(7),
13841 Self::UnknownValue(u) => u.0.value(),
13842 }
13843 }
13844
13845 pub fn name(&self) -> std::option::Option<&str> {
13850 match self {
13851 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13852 Self::Enabled => std::option::Option::Some("ENABLED"),
13853 Self::Disabled => std::option::Option::Some("DISABLED"),
13854 Self::Enabling => std::option::Option::Some("ENABLING"),
13855 Self::Disabling => std::option::Option::Some("DISABLING"),
13856 Self::Creating => std::option::Option::Some("CREATING"),
13857 Self::Failed => std::option::Option::Some("FAILED"),
13858 Self::Deleting => std::option::Option::Some("DELETING"),
13859 Self::UnknownValue(u) => u.0.name(),
13860 }
13861 }
13862 }
13863
13864 impl std::default::Default for State {
13865 fn default() -> Self {
13866 use std::convert::From;
13867 Self::from(0)
13868 }
13869 }
13870
13871 impl std::fmt::Display for State {
13872 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13873 wkt::internal::display_enum(f, self.name(), self.value())
13874 }
13875 }
13876
13877 impl std::convert::From<i32> for State {
13878 fn from(value: i32) -> Self {
13879 match value {
13880 0 => Self::Unspecified,
13881 1 => Self::Enabled,
13882 2 => Self::Disabled,
13883 3 => Self::Enabling,
13884 4 => Self::Disabling,
13885 5 => Self::Creating,
13886 6 => Self::Failed,
13887 7 => Self::Deleting,
13888 _ => Self::UnknownValue(state::UnknownValue(
13889 wkt::internal::UnknownEnumValue::Integer(value),
13890 )),
13891 }
13892 }
13893 }
13894
13895 impl std::convert::From<&str> for State {
13896 fn from(value: &str) -> Self {
13897 use std::string::ToString;
13898 match value {
13899 "STATE_UNSPECIFIED" => Self::Unspecified,
13900 "ENABLED" => Self::Enabled,
13901 "DISABLED" => Self::Disabled,
13902 "ENABLING" => Self::Enabling,
13903 "DISABLING" => Self::Disabling,
13904 "CREATING" => Self::Creating,
13905 "FAILED" => Self::Failed,
13906 "DELETING" => Self::Deleting,
13907 _ => Self::UnknownValue(state::UnknownValue(
13908 wkt::internal::UnknownEnumValue::String(value.to_string()),
13909 )),
13910 }
13911 }
13912 }
13913
13914 impl serde::ser::Serialize for State {
13915 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13916 where
13917 S: serde::Serializer,
13918 {
13919 match self {
13920 Self::Unspecified => serializer.serialize_i32(0),
13921 Self::Enabled => serializer.serialize_i32(1),
13922 Self::Disabled => serializer.serialize_i32(2),
13923 Self::Enabling => serializer.serialize_i32(3),
13924 Self::Disabling => serializer.serialize_i32(4),
13925 Self::Creating => serializer.serialize_i32(5),
13926 Self::Failed => serializer.serialize_i32(6),
13927 Self::Deleting => serializer.serialize_i32(7),
13928 Self::UnknownValue(u) => u.0.serialize(serializer),
13929 }
13930 }
13931 }
13932
13933 impl<'de> serde::de::Deserialize<'de> for State {
13934 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13935 where
13936 D: serde::Deserializer<'de>,
13937 {
13938 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13939 ".google.cloud.documentai.v1.Processor.State",
13940 ))
13941 }
13942 }
13943}
13944
13945#[derive(Clone, Default, PartialEq)]
13948#[non_exhaustive]
13949pub struct ProcessorType {
13950 pub name: std::string::String,
13953
13954 pub r#type: std::string::String,
13956
13957 pub category: std::string::String,
13959
13960 pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
13962
13963 pub allow_creation: bool,
13966
13967 pub launch_stage: api::model::LaunchStage,
13969
13970 pub sample_document_uris: std::vec::Vec<std::string::String>,
13972
13973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13974}
13975
13976impl ProcessorType {
13977 pub fn new() -> Self {
13978 std::default::Default::default()
13979 }
13980
13981 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13983 self.name = v.into();
13984 self
13985 }
13986
13987 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13989 self.r#type = v.into();
13990 self
13991 }
13992
13993 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13995 self.category = v.into();
13996 self
13997 }
13998
13999 pub fn set_available_locations<T, V>(mut self, v: T) -> Self
14001 where
14002 T: std::iter::IntoIterator<Item = V>,
14003 V: std::convert::Into<crate::model::processor_type::LocationInfo>,
14004 {
14005 use std::iter::Iterator;
14006 self.available_locations = v.into_iter().map(|i| i.into()).collect();
14007 self
14008 }
14009
14010 pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14012 self.allow_creation = v.into();
14013 self
14014 }
14015
14016 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
14018 mut self,
14019 v: T,
14020 ) -> Self {
14021 self.launch_stage = v.into();
14022 self
14023 }
14024
14025 pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
14027 where
14028 T: std::iter::IntoIterator<Item = V>,
14029 V: std::convert::Into<std::string::String>,
14030 {
14031 use std::iter::Iterator;
14032 self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
14033 self
14034 }
14035}
14036
14037impl wkt::message::Message for ProcessorType {
14038 fn typename() -> &'static str {
14039 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
14040 }
14041}
14042
14043pub mod processor_type {
14045 #[allow(unused_imports)]
14046 use super::*;
14047
14048 #[derive(Clone, Default, PartialEq)]
14050 #[non_exhaustive]
14051 pub struct LocationInfo {
14052 pub location_id: std::string::String,
14055
14056 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14057 }
14058
14059 impl LocationInfo {
14060 pub fn new() -> Self {
14061 std::default::Default::default()
14062 }
14063
14064 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14066 self.location_id = v.into();
14067 self
14068 }
14069 }
14070
14071 impl wkt::message::Message for LocationInfo {
14072 fn typename() -> &'static str {
14073 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
14074 }
14075 }
14076}