google_cloud_support_v2/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33/// An Actor represents an entity that performed an action. For example, an actor
34/// could be a user who posted a comment on a support case, a user who
35/// uploaded an attachment, or a service account that created a support case.
36#[derive(Clone, Default, PartialEq)]
37#[non_exhaustive]
38pub struct Actor {
39    /// The name to display for the actor. If not provided, it is inferred from
40    /// credentials supplied during case creation. When an email is provided, a
41    /// display name must also be provided. This will be obfuscated if the user
42    /// is a Google Support agent.
43    pub display_name: std::string::String,
44
45    /// The email address of the actor. If not provided, it is inferred from the
46    /// credentials supplied during case creation. When a name is provided, an
47    /// email must also be provided. If the user is a Google Support agent, this is
48    /// obfuscated.
49    ///
50    /// This field is deprecated. Use `username` instead.
51    #[deprecated]
52    pub email: std::string::String,
53
54    /// Output only. Whether the actor is a Google support actor.
55    pub google_support: bool,
56
57    /// Output only. The username of the actor. It may look like an email or other
58    /// format provided by the identity provider. If not provided, it is inferred
59    /// from the credentials supplied. When a name is provided, a username must
60    /// also be provided. If the user is a Google Support agent, this will not be
61    /// set.
62    pub username: std::string::String,
63
64    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
65}
66
67impl Actor {
68    pub fn new() -> Self {
69        std::default::Default::default()
70    }
71
72    /// Sets the value of [display_name][crate::model::Actor::display_name].
73    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
74        self.display_name = v.into();
75        self
76    }
77
78    /// Sets the value of [email][crate::model::Actor::email].
79    #[deprecated]
80    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
81        self.email = v.into();
82        self
83    }
84
85    /// Sets the value of [google_support][crate::model::Actor::google_support].
86    pub fn set_google_support<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
87        self.google_support = v.into();
88        self
89    }
90
91    /// Sets the value of [username][crate::model::Actor::username].
92    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
93        self.username = v.into();
94        self
95    }
96}
97
98impl wkt::message::Message for Actor {
99    fn typename() -> &'static str {
100        "type.googleapis.com/google.cloud.support.v2.Actor"
101    }
102}
103
104#[doc(hidden)]
105impl<'de> serde::de::Deserialize<'de> for Actor {
106    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
107    where
108        D: serde::Deserializer<'de>,
109    {
110        #[allow(non_camel_case_types)]
111        #[doc(hidden)]
112        #[derive(PartialEq, Eq, Hash)]
113        enum __FieldTag {
114            __display_name,
115            __email,
116            __google_support,
117            __username,
118            Unknown(std::string::String),
119        }
120        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
121            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
122            where
123                D: serde::Deserializer<'de>,
124            {
125                struct Visitor;
126                impl<'de> serde::de::Visitor<'de> for Visitor {
127                    type Value = __FieldTag;
128                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
129                        formatter.write_str("a field name for Actor")
130                    }
131                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
132                    where
133                        E: serde::de::Error,
134                    {
135                        use std::result::Result::Ok;
136                        use std::string::ToString;
137                        match value {
138                            "displayName" => Ok(__FieldTag::__display_name),
139                            "display_name" => Ok(__FieldTag::__display_name),
140                            "email" => Ok(__FieldTag::__email),
141                            "googleSupport" => Ok(__FieldTag::__google_support),
142                            "google_support" => Ok(__FieldTag::__google_support),
143                            "username" => Ok(__FieldTag::__username),
144                            _ => Ok(__FieldTag::Unknown(value.to_string())),
145                        }
146                    }
147                }
148                deserializer.deserialize_identifier(Visitor)
149            }
150        }
151        struct Visitor;
152        impl<'de> serde::de::Visitor<'de> for Visitor {
153            type Value = Actor;
154            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
155                formatter.write_str("struct Actor")
156            }
157            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
158            where
159                A: serde::de::MapAccess<'de>,
160            {
161                #[allow(unused_imports)]
162                use serde::de::Error;
163                use std::option::Option::Some;
164                let mut fields = std::collections::HashSet::new();
165                let mut result = Self::Value::new();
166                while let Some(tag) = map.next_key::<__FieldTag>()? {
167                    #[allow(clippy::match_single_binding)]
168                    match tag {
169                        __FieldTag::__display_name => {
170                            if !fields.insert(__FieldTag::__display_name) {
171                                return std::result::Result::Err(A::Error::duplicate_field(
172                                    "multiple values for display_name",
173                                ));
174                            }
175                            result.display_name = map
176                                .next_value::<std::option::Option<std::string::String>>()?
177                                .unwrap_or_default();
178                        }
179                        __FieldTag::__email => {
180                            if !fields.insert(__FieldTag::__email) {
181                                return std::result::Result::Err(A::Error::duplicate_field(
182                                    "multiple values for email",
183                                ));
184                            }
185                            result.email = map
186                                .next_value::<std::option::Option<std::string::String>>()?
187                                .unwrap_or_default();
188                        }
189                        __FieldTag::__google_support => {
190                            if !fields.insert(__FieldTag::__google_support) {
191                                return std::result::Result::Err(A::Error::duplicate_field(
192                                    "multiple values for google_support",
193                                ));
194                            }
195                            result.google_support = map
196                                .next_value::<std::option::Option<bool>>()?
197                                .unwrap_or_default();
198                        }
199                        __FieldTag::__username => {
200                            if !fields.insert(__FieldTag::__username) {
201                                return std::result::Result::Err(A::Error::duplicate_field(
202                                    "multiple values for username",
203                                ));
204                            }
205                            result.username = map
206                                .next_value::<std::option::Option<std::string::String>>()?
207                                .unwrap_or_default();
208                        }
209                        __FieldTag::Unknown(key) => {
210                            let value = map.next_value::<serde_json::Value>()?;
211                            result._unknown_fields.insert(key, value);
212                        }
213                    }
214                }
215                std::result::Result::Ok(result)
216            }
217        }
218        deserializer.deserialize_any(Visitor)
219    }
220}
221
222#[doc(hidden)]
223impl serde::ser::Serialize for Actor {
224    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
225    where
226        S: serde::ser::Serializer,
227    {
228        use serde::ser::SerializeMap;
229        #[allow(unused_imports)]
230        use std::option::Option::Some;
231        let mut state = serializer.serialize_map(std::option::Option::None)?;
232        if !self.display_name.is_empty() {
233            state.serialize_entry("displayName", &self.display_name)?;
234        }
235        if !self.email.is_empty() {
236            state.serialize_entry("email", &self.email)?;
237        }
238        if !wkt::internal::is_default(&self.google_support) {
239            state.serialize_entry("googleSupport", &self.google_support)?;
240        }
241        if !self.username.is_empty() {
242            state.serialize_entry("username", &self.username)?;
243        }
244        if !self._unknown_fields.is_empty() {
245            for (key, value) in self._unknown_fields.iter() {
246                state.serialize_entry(key, &value)?;
247            }
248        }
249        state.end()
250    }
251}
252
253impl std::fmt::Debug for Actor {
254    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
255        let mut debug_struct = f.debug_struct("Actor");
256        debug_struct.field("display_name", &self.display_name);
257        debug_struct.field("email", &self.email);
258        debug_struct.field("google_support", &self.google_support);
259        debug_struct.field("username", &self.username);
260        if !self._unknown_fields.is_empty() {
261            debug_struct.field("_unknown_fields", &self._unknown_fields);
262        }
263        debug_struct.finish()
264    }
265}
266
267/// An Attachment contains metadata about a file that was uploaded to a
268/// case - it is NOT a file itself. That being said, the name of an Attachment
269/// object can be used to download its accompanying file through the
270/// `media.download` endpoint.
271///
272/// While attachments can be uploaded in the console at the
273/// same time as a comment, they're associated on a "case" level, not a
274/// "comment" level.
275#[derive(Clone, Default, PartialEq)]
276#[non_exhaustive]
277pub struct Attachment {
278    /// Output only. Identifier. The resource name of the attachment.
279    pub name: std::string::String,
280
281    /// Output only. The time at which the attachment was created.
282    pub create_time: std::option::Option<wkt::Timestamp>,
283
284    /// Output only. The user who uploaded the attachment. Note, the name and email
285    /// will be obfuscated if the attachment was uploaded by Google support.
286    pub creator: std::option::Option<crate::model::Actor>,
287
288    /// The filename of the attachment (e.g. `"graph.jpg"`).
289    pub filename: std::string::String,
290
291    /// Output only. The MIME type of the attachment (e.g. text/plain).
292    pub mime_type: std::string::String,
293
294    /// Output only. The size of the attachment in bytes.
295    pub size_bytes: i64,
296
297    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
298}
299
300impl Attachment {
301    pub fn new() -> Self {
302        std::default::Default::default()
303    }
304
305    /// Sets the value of [name][crate::model::Attachment::name].
306    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
307        self.name = v.into();
308        self
309    }
310
311    /// Sets the value of [create_time][crate::model::Attachment::create_time].
312    pub fn set_create_time<T>(mut self, v: T) -> Self
313    where
314        T: std::convert::Into<wkt::Timestamp>,
315    {
316        self.create_time = std::option::Option::Some(v.into());
317        self
318    }
319
320    /// Sets or clears the value of [create_time][crate::model::Attachment::create_time].
321    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
322    where
323        T: std::convert::Into<wkt::Timestamp>,
324    {
325        self.create_time = v.map(|x| x.into());
326        self
327    }
328
329    /// Sets the value of [creator][crate::model::Attachment::creator].
330    pub fn set_creator<T>(mut self, v: T) -> Self
331    where
332        T: std::convert::Into<crate::model::Actor>,
333    {
334        self.creator = std::option::Option::Some(v.into());
335        self
336    }
337
338    /// Sets or clears the value of [creator][crate::model::Attachment::creator].
339    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
340    where
341        T: std::convert::Into<crate::model::Actor>,
342    {
343        self.creator = v.map(|x| x.into());
344        self
345    }
346
347    /// Sets the value of [filename][crate::model::Attachment::filename].
348    pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
349        self.filename = v.into();
350        self
351    }
352
353    /// Sets the value of [mime_type][crate::model::Attachment::mime_type].
354    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
355        self.mime_type = v.into();
356        self
357    }
358
359    /// Sets the value of [size_bytes][crate::model::Attachment::size_bytes].
360    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
361        self.size_bytes = v.into();
362        self
363    }
364}
365
366impl wkt::message::Message for Attachment {
367    fn typename() -> &'static str {
368        "type.googleapis.com/google.cloud.support.v2.Attachment"
369    }
370}
371
372#[doc(hidden)]
373impl<'de> serde::de::Deserialize<'de> for Attachment {
374    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
375    where
376        D: serde::Deserializer<'de>,
377    {
378        #[allow(non_camel_case_types)]
379        #[doc(hidden)]
380        #[derive(PartialEq, Eq, Hash)]
381        enum __FieldTag {
382            __name,
383            __create_time,
384            __creator,
385            __filename,
386            __mime_type,
387            __size_bytes,
388            Unknown(std::string::String),
389        }
390        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
391            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
392            where
393                D: serde::Deserializer<'de>,
394            {
395                struct Visitor;
396                impl<'de> serde::de::Visitor<'de> for Visitor {
397                    type Value = __FieldTag;
398                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
399                        formatter.write_str("a field name for Attachment")
400                    }
401                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
402                    where
403                        E: serde::de::Error,
404                    {
405                        use std::result::Result::Ok;
406                        use std::string::ToString;
407                        match value {
408                            "name" => Ok(__FieldTag::__name),
409                            "createTime" => Ok(__FieldTag::__create_time),
410                            "create_time" => Ok(__FieldTag::__create_time),
411                            "creator" => Ok(__FieldTag::__creator),
412                            "filename" => Ok(__FieldTag::__filename),
413                            "mimeType" => Ok(__FieldTag::__mime_type),
414                            "mime_type" => Ok(__FieldTag::__mime_type),
415                            "sizeBytes" => Ok(__FieldTag::__size_bytes),
416                            "size_bytes" => Ok(__FieldTag::__size_bytes),
417                            _ => Ok(__FieldTag::Unknown(value.to_string())),
418                        }
419                    }
420                }
421                deserializer.deserialize_identifier(Visitor)
422            }
423        }
424        struct Visitor;
425        impl<'de> serde::de::Visitor<'de> for Visitor {
426            type Value = Attachment;
427            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
428                formatter.write_str("struct Attachment")
429            }
430            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
431            where
432                A: serde::de::MapAccess<'de>,
433            {
434                #[allow(unused_imports)]
435                use serde::de::Error;
436                use std::option::Option::Some;
437                let mut fields = std::collections::HashSet::new();
438                let mut result = Self::Value::new();
439                while let Some(tag) = map.next_key::<__FieldTag>()? {
440                    #[allow(clippy::match_single_binding)]
441                    match tag {
442                        __FieldTag::__name => {
443                            if !fields.insert(__FieldTag::__name) {
444                                return std::result::Result::Err(A::Error::duplicate_field(
445                                    "multiple values for name",
446                                ));
447                            }
448                            result.name = map
449                                .next_value::<std::option::Option<std::string::String>>()?
450                                .unwrap_or_default();
451                        }
452                        __FieldTag::__create_time => {
453                            if !fields.insert(__FieldTag::__create_time) {
454                                return std::result::Result::Err(A::Error::duplicate_field(
455                                    "multiple values for create_time",
456                                ));
457                            }
458                            result.create_time =
459                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
460                        }
461                        __FieldTag::__creator => {
462                            if !fields.insert(__FieldTag::__creator) {
463                                return std::result::Result::Err(A::Error::duplicate_field(
464                                    "multiple values for creator",
465                                ));
466                            }
467                            result.creator =
468                                map.next_value::<std::option::Option<crate::model::Actor>>()?;
469                        }
470                        __FieldTag::__filename => {
471                            if !fields.insert(__FieldTag::__filename) {
472                                return std::result::Result::Err(A::Error::duplicate_field(
473                                    "multiple values for filename",
474                                ));
475                            }
476                            result.filename = map
477                                .next_value::<std::option::Option<std::string::String>>()?
478                                .unwrap_or_default();
479                        }
480                        __FieldTag::__mime_type => {
481                            if !fields.insert(__FieldTag::__mime_type) {
482                                return std::result::Result::Err(A::Error::duplicate_field(
483                                    "multiple values for mime_type",
484                                ));
485                            }
486                            result.mime_type = map
487                                .next_value::<std::option::Option<std::string::String>>()?
488                                .unwrap_or_default();
489                        }
490                        __FieldTag::__size_bytes => {
491                            if !fields.insert(__FieldTag::__size_bytes) {
492                                return std::result::Result::Err(A::Error::duplicate_field(
493                                    "multiple values for size_bytes",
494                                ));
495                            }
496                            struct __With(std::option::Option<i64>);
497                            impl<'de> serde::de::Deserialize<'de> for __With {
498                                fn deserialize<D>(
499                                    deserializer: D,
500                                ) -> std::result::Result<Self, D::Error>
501                                where
502                                    D: serde::de::Deserializer<'de>,
503                                {
504                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
505                                }
506                            }
507                            result.size_bytes = map.next_value::<__With>()?.0.unwrap_or_default();
508                        }
509                        __FieldTag::Unknown(key) => {
510                            let value = map.next_value::<serde_json::Value>()?;
511                            result._unknown_fields.insert(key, value);
512                        }
513                    }
514                }
515                std::result::Result::Ok(result)
516            }
517        }
518        deserializer.deserialize_any(Visitor)
519    }
520}
521
522#[doc(hidden)]
523impl serde::ser::Serialize for Attachment {
524    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
525    where
526        S: serde::ser::Serializer,
527    {
528        use serde::ser::SerializeMap;
529        #[allow(unused_imports)]
530        use std::option::Option::Some;
531        let mut state = serializer.serialize_map(std::option::Option::None)?;
532        if !self.name.is_empty() {
533            state.serialize_entry("name", &self.name)?;
534        }
535        if self.create_time.is_some() {
536            state.serialize_entry("createTime", &self.create_time)?;
537        }
538        if self.creator.is_some() {
539            state.serialize_entry("creator", &self.creator)?;
540        }
541        if !self.filename.is_empty() {
542            state.serialize_entry("filename", &self.filename)?;
543        }
544        if !self.mime_type.is_empty() {
545            state.serialize_entry("mimeType", &self.mime_type)?;
546        }
547        if !wkt::internal::is_default(&self.size_bytes) {
548            struct __With<'a>(&'a i64);
549            impl<'a> serde::ser::Serialize for __With<'a> {
550                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
551                where
552                    S: serde::ser::Serializer,
553                {
554                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
555                }
556            }
557            state.serialize_entry("sizeBytes", &__With(&self.size_bytes))?;
558        }
559        if !self._unknown_fields.is_empty() {
560            for (key, value) in self._unknown_fields.iter() {
561                state.serialize_entry(key, &value)?;
562            }
563        }
564        state.end()
565    }
566}
567
568impl std::fmt::Debug for Attachment {
569    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
570        let mut debug_struct = f.debug_struct("Attachment");
571        debug_struct.field("name", &self.name);
572        debug_struct.field("create_time", &self.create_time);
573        debug_struct.field("creator", &self.creator);
574        debug_struct.field("filename", &self.filename);
575        debug_struct.field("mime_type", &self.mime_type);
576        debug_struct.field("size_bytes", &self.size_bytes);
577        if !self._unknown_fields.is_empty() {
578            debug_struct.field("_unknown_fields", &self._unknown_fields);
579        }
580        debug_struct.finish()
581    }
582}
583
584/// The request message for the ListAttachments endpoint.
585#[derive(Clone, Default, PartialEq)]
586#[non_exhaustive]
587pub struct ListAttachmentsRequest {
588    /// Required. The name of the case for which attachments should be listed.
589    pub parent: std::string::String,
590
591    /// The maximum number of attachments fetched with each request.
592    ///
593    /// If not provided, the default is 10. The maximum page size that will be
594    /// returned is 100.
595    ///
596    /// The size of each page can be smaller than the requested page size and can
597    /// include zero. For example, you could request 100 attachments on one page,
598    /// receive 0, and then on the next page, receive 90.
599    pub page_size: i32,
600
601    /// A token identifying the page of results to return. If unspecified, the
602    /// first page is retrieved.
603    pub page_token: std::string::String,
604
605    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
606}
607
608impl ListAttachmentsRequest {
609    pub fn new() -> Self {
610        std::default::Default::default()
611    }
612
613    /// Sets the value of [parent][crate::model::ListAttachmentsRequest::parent].
614    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
615        self.parent = v.into();
616        self
617    }
618
619    /// Sets the value of [page_size][crate::model::ListAttachmentsRequest::page_size].
620    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
621        self.page_size = v.into();
622        self
623    }
624
625    /// Sets the value of [page_token][crate::model::ListAttachmentsRequest::page_token].
626    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
627        self.page_token = v.into();
628        self
629    }
630}
631
632impl wkt::message::Message for ListAttachmentsRequest {
633    fn typename() -> &'static str {
634        "type.googleapis.com/google.cloud.support.v2.ListAttachmentsRequest"
635    }
636}
637
638#[doc(hidden)]
639impl<'de> serde::de::Deserialize<'de> for ListAttachmentsRequest {
640    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
641    where
642        D: serde::Deserializer<'de>,
643    {
644        #[allow(non_camel_case_types)]
645        #[doc(hidden)]
646        #[derive(PartialEq, Eq, Hash)]
647        enum __FieldTag {
648            __parent,
649            __page_size,
650            __page_token,
651            Unknown(std::string::String),
652        }
653        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
654            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
655            where
656                D: serde::Deserializer<'de>,
657            {
658                struct Visitor;
659                impl<'de> serde::de::Visitor<'de> for Visitor {
660                    type Value = __FieldTag;
661                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
662                        formatter.write_str("a field name for ListAttachmentsRequest")
663                    }
664                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
665                    where
666                        E: serde::de::Error,
667                    {
668                        use std::result::Result::Ok;
669                        use std::string::ToString;
670                        match value {
671                            "parent" => Ok(__FieldTag::__parent),
672                            "pageSize" => Ok(__FieldTag::__page_size),
673                            "page_size" => Ok(__FieldTag::__page_size),
674                            "pageToken" => Ok(__FieldTag::__page_token),
675                            "page_token" => Ok(__FieldTag::__page_token),
676                            _ => Ok(__FieldTag::Unknown(value.to_string())),
677                        }
678                    }
679                }
680                deserializer.deserialize_identifier(Visitor)
681            }
682        }
683        struct Visitor;
684        impl<'de> serde::de::Visitor<'de> for Visitor {
685            type Value = ListAttachmentsRequest;
686            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
687                formatter.write_str("struct ListAttachmentsRequest")
688            }
689            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
690            where
691                A: serde::de::MapAccess<'de>,
692            {
693                #[allow(unused_imports)]
694                use serde::de::Error;
695                use std::option::Option::Some;
696                let mut fields = std::collections::HashSet::new();
697                let mut result = Self::Value::new();
698                while let Some(tag) = map.next_key::<__FieldTag>()? {
699                    #[allow(clippy::match_single_binding)]
700                    match tag {
701                        __FieldTag::__parent => {
702                            if !fields.insert(__FieldTag::__parent) {
703                                return std::result::Result::Err(A::Error::duplicate_field(
704                                    "multiple values for parent",
705                                ));
706                            }
707                            result.parent = map
708                                .next_value::<std::option::Option<std::string::String>>()?
709                                .unwrap_or_default();
710                        }
711                        __FieldTag::__page_size => {
712                            if !fields.insert(__FieldTag::__page_size) {
713                                return std::result::Result::Err(A::Error::duplicate_field(
714                                    "multiple values for page_size",
715                                ));
716                            }
717                            struct __With(std::option::Option<i32>);
718                            impl<'de> serde::de::Deserialize<'de> for __With {
719                                fn deserialize<D>(
720                                    deserializer: D,
721                                ) -> std::result::Result<Self, D::Error>
722                                where
723                                    D: serde::de::Deserializer<'de>,
724                                {
725                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
726                                }
727                            }
728                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
729                        }
730                        __FieldTag::__page_token => {
731                            if !fields.insert(__FieldTag::__page_token) {
732                                return std::result::Result::Err(A::Error::duplicate_field(
733                                    "multiple values for page_token",
734                                ));
735                            }
736                            result.page_token = map
737                                .next_value::<std::option::Option<std::string::String>>()?
738                                .unwrap_or_default();
739                        }
740                        __FieldTag::Unknown(key) => {
741                            let value = map.next_value::<serde_json::Value>()?;
742                            result._unknown_fields.insert(key, value);
743                        }
744                    }
745                }
746                std::result::Result::Ok(result)
747            }
748        }
749        deserializer.deserialize_any(Visitor)
750    }
751}
752
753#[doc(hidden)]
754impl serde::ser::Serialize for ListAttachmentsRequest {
755    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
756    where
757        S: serde::ser::Serializer,
758    {
759        use serde::ser::SerializeMap;
760        #[allow(unused_imports)]
761        use std::option::Option::Some;
762        let mut state = serializer.serialize_map(std::option::Option::None)?;
763        if !self.parent.is_empty() {
764            state.serialize_entry("parent", &self.parent)?;
765        }
766        if !wkt::internal::is_default(&self.page_size) {
767            struct __With<'a>(&'a i32);
768            impl<'a> serde::ser::Serialize for __With<'a> {
769                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
770                where
771                    S: serde::ser::Serializer,
772                {
773                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
774                }
775            }
776            state.serialize_entry("pageSize", &__With(&self.page_size))?;
777        }
778        if !self.page_token.is_empty() {
779            state.serialize_entry("pageToken", &self.page_token)?;
780        }
781        if !self._unknown_fields.is_empty() {
782            for (key, value) in self._unknown_fields.iter() {
783                state.serialize_entry(key, &value)?;
784            }
785        }
786        state.end()
787    }
788}
789
790impl std::fmt::Debug for ListAttachmentsRequest {
791    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
792        let mut debug_struct = f.debug_struct("ListAttachmentsRequest");
793        debug_struct.field("parent", &self.parent);
794        debug_struct.field("page_size", &self.page_size);
795        debug_struct.field("page_token", &self.page_token);
796        if !self._unknown_fields.is_empty() {
797            debug_struct.field("_unknown_fields", &self._unknown_fields);
798        }
799        debug_struct.finish()
800    }
801}
802
803/// The response message for the ListAttachments endpoint.
804#[derive(Clone, Default, PartialEq)]
805#[non_exhaustive]
806pub struct ListAttachmentsResponse {
807    /// The list of attachments associated with a case.
808    pub attachments: std::vec::Vec<crate::model::Attachment>,
809
810    /// A token to retrieve the next page of results. Set this in the `page_token`
811    /// field of subsequent `cases.attachments.list` requests. If unspecified,
812    /// there are no more results to retrieve.
813    pub next_page_token: std::string::String,
814
815    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
816}
817
818impl ListAttachmentsResponse {
819    pub fn new() -> Self {
820        std::default::Default::default()
821    }
822
823    /// Sets the value of [attachments][crate::model::ListAttachmentsResponse::attachments].
824    pub fn set_attachments<T, V>(mut self, v: T) -> Self
825    where
826        T: std::iter::IntoIterator<Item = V>,
827        V: std::convert::Into<crate::model::Attachment>,
828    {
829        use std::iter::Iterator;
830        self.attachments = v.into_iter().map(|i| i.into()).collect();
831        self
832    }
833
834    /// Sets the value of [next_page_token][crate::model::ListAttachmentsResponse::next_page_token].
835    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
836        self.next_page_token = v.into();
837        self
838    }
839}
840
841impl wkt::message::Message for ListAttachmentsResponse {
842    fn typename() -> &'static str {
843        "type.googleapis.com/google.cloud.support.v2.ListAttachmentsResponse"
844    }
845}
846
847#[doc(hidden)]
848impl gax::paginator::internal::PageableResponse for ListAttachmentsResponse {
849    type PageItem = crate::model::Attachment;
850
851    fn items(self) -> std::vec::Vec<Self::PageItem> {
852        self.attachments
853    }
854
855    fn next_page_token(&self) -> std::string::String {
856        use std::clone::Clone;
857        self.next_page_token.clone()
858    }
859}
860
861#[doc(hidden)]
862impl<'de> serde::de::Deserialize<'de> for ListAttachmentsResponse {
863    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
864    where
865        D: serde::Deserializer<'de>,
866    {
867        #[allow(non_camel_case_types)]
868        #[doc(hidden)]
869        #[derive(PartialEq, Eq, Hash)]
870        enum __FieldTag {
871            __attachments,
872            __next_page_token,
873            Unknown(std::string::String),
874        }
875        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
876            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
877            where
878                D: serde::Deserializer<'de>,
879            {
880                struct Visitor;
881                impl<'de> serde::de::Visitor<'de> for Visitor {
882                    type Value = __FieldTag;
883                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
884                        formatter.write_str("a field name for ListAttachmentsResponse")
885                    }
886                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
887                    where
888                        E: serde::de::Error,
889                    {
890                        use std::result::Result::Ok;
891                        use std::string::ToString;
892                        match value {
893                            "attachments" => Ok(__FieldTag::__attachments),
894                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
895                            "next_page_token" => Ok(__FieldTag::__next_page_token),
896                            _ => Ok(__FieldTag::Unknown(value.to_string())),
897                        }
898                    }
899                }
900                deserializer.deserialize_identifier(Visitor)
901            }
902        }
903        struct Visitor;
904        impl<'de> serde::de::Visitor<'de> for Visitor {
905            type Value = ListAttachmentsResponse;
906            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
907                formatter.write_str("struct ListAttachmentsResponse")
908            }
909            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
910            where
911                A: serde::de::MapAccess<'de>,
912            {
913                #[allow(unused_imports)]
914                use serde::de::Error;
915                use std::option::Option::Some;
916                let mut fields = std::collections::HashSet::new();
917                let mut result = Self::Value::new();
918                while let Some(tag) = map.next_key::<__FieldTag>()? {
919                    #[allow(clippy::match_single_binding)]
920                    match tag {
921                        __FieldTag::__attachments => {
922                            if !fields.insert(__FieldTag::__attachments) {
923                                return std::result::Result::Err(A::Error::duplicate_field(
924                                    "multiple values for attachments",
925                                ));
926                            }
927                            result.attachments = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Attachment>>>()?.unwrap_or_default();
928                        }
929                        __FieldTag::__next_page_token => {
930                            if !fields.insert(__FieldTag::__next_page_token) {
931                                return std::result::Result::Err(A::Error::duplicate_field(
932                                    "multiple values for next_page_token",
933                                ));
934                            }
935                            result.next_page_token = map
936                                .next_value::<std::option::Option<std::string::String>>()?
937                                .unwrap_or_default();
938                        }
939                        __FieldTag::Unknown(key) => {
940                            let value = map.next_value::<serde_json::Value>()?;
941                            result._unknown_fields.insert(key, value);
942                        }
943                    }
944                }
945                std::result::Result::Ok(result)
946            }
947        }
948        deserializer.deserialize_any(Visitor)
949    }
950}
951
952#[doc(hidden)]
953impl serde::ser::Serialize for ListAttachmentsResponse {
954    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
955    where
956        S: serde::ser::Serializer,
957    {
958        use serde::ser::SerializeMap;
959        #[allow(unused_imports)]
960        use std::option::Option::Some;
961        let mut state = serializer.serialize_map(std::option::Option::None)?;
962        if !self.attachments.is_empty() {
963            state.serialize_entry("attachments", &self.attachments)?;
964        }
965        if !self.next_page_token.is_empty() {
966            state.serialize_entry("nextPageToken", &self.next_page_token)?;
967        }
968        if !self._unknown_fields.is_empty() {
969            for (key, value) in self._unknown_fields.iter() {
970                state.serialize_entry(key, &value)?;
971            }
972        }
973        state.end()
974    }
975}
976
977impl std::fmt::Debug for ListAttachmentsResponse {
978    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
979        let mut debug_struct = f.debug_struct("ListAttachmentsResponse");
980        debug_struct.field("attachments", &self.attachments);
981        debug_struct.field("next_page_token", &self.next_page_token);
982        if !self._unknown_fields.is_empty() {
983            debug_struct.field("_unknown_fields", &self._unknown_fields);
984        }
985        debug_struct.finish()
986    }
987}
988
989/// A Case is an object that contains the details of a support case. It
990/// contains fields for the time it was created, its priority, its
991/// classification, and more. Cases can also have comments and attachments that
992/// get added over time.
993///
994/// A case is parented by a Google Cloud organization or project.
995///
996/// Organizations are identified by a number, so the name of a case parented by
997/// an organization would look like this:
998///
999/// ```norust
1000/// organizations/123/cases/456
1001/// ```
1002///
1003/// Projects have two unique identifiers, an ID and a number, and they look like
1004/// this:
1005///
1006/// ```norust
1007/// projects/abc/cases/456
1008/// ```
1009///
1010/// ```norust
1011/// projects/123/cases/456
1012/// ```
1013///
1014/// You can use either of them when calling the API. To learn more
1015/// about project identifiers, see [AIP-2510](https://google.aip.dev/cloud/2510).
1016#[derive(Clone, Default, PartialEq)]
1017#[non_exhaustive]
1018pub struct Case {
1019    /// Identifier. The resource name for the case.
1020    pub name: std::string::String,
1021
1022    /// The short summary of the issue reported in this case.
1023    pub display_name: std::string::String,
1024
1025    /// A broad description of the issue.
1026    pub description: std::string::String,
1027
1028    /// The issue classification applicable to this case.
1029    pub classification: std::option::Option<crate::model::CaseClassification>,
1030
1031    /// The timezone of the user who created the support case.
1032    /// It should be in a format IANA recognizes: <https://www.iana.org/time-zones>.
1033    /// There is no additional validation done by the API.
1034    pub time_zone: std::string::String,
1035
1036    /// The email addresses to receive updates on this case.
1037    pub subscriber_email_addresses: std::vec::Vec<std::string::String>,
1038
1039    /// Output only. The current status of the support case.
1040    pub state: crate::model::case::State,
1041
1042    /// Output only. The time this case was created.
1043    pub create_time: std::option::Option<wkt::Timestamp>,
1044
1045    /// Output only. The time this case was last updated.
1046    pub update_time: std::option::Option<wkt::Timestamp>,
1047
1048    /// The user who created the case.
1049    ///
1050    /// Note: The name and email will be obfuscated if the case was created by
1051    /// Google Support.
1052    pub creator: std::option::Option<crate::model::Actor>,
1053
1054    /// A user-supplied email address to send case update notifications for. This
1055    /// should only be used in BYOID flows, where we cannot infer the user's email
1056    /// address directly from their EUCs.
1057    pub contact_email: std::string::String,
1058
1059    /// Whether the case is currently escalated.
1060    pub escalated: bool,
1061
1062    /// Whether this case was created for internal API testing and should not be
1063    /// acted on by the support team.
1064    pub test_case: bool,
1065
1066    /// The language the user has requested to receive support in. This should be a
1067    /// BCP 47 language code (e.g., `"en"`, `"zh-CN"`, `"zh-TW"`, `"ja"`, `"ko"`).
1068    /// If no language or an unsupported language is specified, this field defaults
1069    /// to English (en).
1070    ///
1071    /// Language selection during case creation may affect your available support
1072    /// options. For a list of supported languages and their support working hours,
1073    /// see: <https://cloud.google.com/support/docs/language-working-hours>
1074    pub language_code: std::string::String,
1075
1076    /// The priority of this case.
1077    pub priority: crate::model::case::Priority,
1078
1079    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1080}
1081
1082impl Case {
1083    pub fn new() -> Self {
1084        std::default::Default::default()
1085    }
1086
1087    /// Sets the value of [name][crate::model::Case::name].
1088    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1089        self.name = v.into();
1090        self
1091    }
1092
1093    /// Sets the value of [display_name][crate::model::Case::display_name].
1094    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1095        self.display_name = v.into();
1096        self
1097    }
1098
1099    /// Sets the value of [description][crate::model::Case::description].
1100    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1101        self.description = v.into();
1102        self
1103    }
1104
1105    /// Sets the value of [classification][crate::model::Case::classification].
1106    pub fn set_classification<T>(mut self, v: T) -> Self
1107    where
1108        T: std::convert::Into<crate::model::CaseClassification>,
1109    {
1110        self.classification = std::option::Option::Some(v.into());
1111        self
1112    }
1113
1114    /// Sets or clears the value of [classification][crate::model::Case::classification].
1115    pub fn set_or_clear_classification<T>(mut self, v: std::option::Option<T>) -> Self
1116    where
1117        T: std::convert::Into<crate::model::CaseClassification>,
1118    {
1119        self.classification = v.map(|x| x.into());
1120        self
1121    }
1122
1123    /// Sets the value of [time_zone][crate::model::Case::time_zone].
1124    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1125        self.time_zone = v.into();
1126        self
1127    }
1128
1129    /// Sets the value of [subscriber_email_addresses][crate::model::Case::subscriber_email_addresses].
1130    pub fn set_subscriber_email_addresses<T, V>(mut self, v: T) -> Self
1131    where
1132        T: std::iter::IntoIterator<Item = V>,
1133        V: std::convert::Into<std::string::String>,
1134    {
1135        use std::iter::Iterator;
1136        self.subscriber_email_addresses = v.into_iter().map(|i| i.into()).collect();
1137        self
1138    }
1139
1140    /// Sets the value of [state][crate::model::Case::state].
1141    pub fn set_state<T: std::convert::Into<crate::model::case::State>>(mut self, v: T) -> Self {
1142        self.state = v.into();
1143        self
1144    }
1145
1146    /// Sets the value of [create_time][crate::model::Case::create_time].
1147    pub fn set_create_time<T>(mut self, v: T) -> Self
1148    where
1149        T: std::convert::Into<wkt::Timestamp>,
1150    {
1151        self.create_time = std::option::Option::Some(v.into());
1152        self
1153    }
1154
1155    /// Sets or clears the value of [create_time][crate::model::Case::create_time].
1156    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1157    where
1158        T: std::convert::Into<wkt::Timestamp>,
1159    {
1160        self.create_time = v.map(|x| x.into());
1161        self
1162    }
1163
1164    /// Sets the value of [update_time][crate::model::Case::update_time].
1165    pub fn set_update_time<T>(mut self, v: T) -> Self
1166    where
1167        T: std::convert::Into<wkt::Timestamp>,
1168    {
1169        self.update_time = std::option::Option::Some(v.into());
1170        self
1171    }
1172
1173    /// Sets or clears the value of [update_time][crate::model::Case::update_time].
1174    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1175    where
1176        T: std::convert::Into<wkt::Timestamp>,
1177    {
1178        self.update_time = v.map(|x| x.into());
1179        self
1180    }
1181
1182    /// Sets the value of [creator][crate::model::Case::creator].
1183    pub fn set_creator<T>(mut self, v: T) -> Self
1184    where
1185        T: std::convert::Into<crate::model::Actor>,
1186    {
1187        self.creator = std::option::Option::Some(v.into());
1188        self
1189    }
1190
1191    /// Sets or clears the value of [creator][crate::model::Case::creator].
1192    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
1193    where
1194        T: std::convert::Into<crate::model::Actor>,
1195    {
1196        self.creator = v.map(|x| x.into());
1197        self
1198    }
1199
1200    /// Sets the value of [contact_email][crate::model::Case::contact_email].
1201    pub fn set_contact_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1202        self.contact_email = v.into();
1203        self
1204    }
1205
1206    /// Sets the value of [escalated][crate::model::Case::escalated].
1207    pub fn set_escalated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1208        self.escalated = v.into();
1209        self
1210    }
1211
1212    /// Sets the value of [test_case][crate::model::Case::test_case].
1213    pub fn set_test_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1214        self.test_case = v.into();
1215        self
1216    }
1217
1218    /// Sets the value of [language_code][crate::model::Case::language_code].
1219    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1220        self.language_code = v.into();
1221        self
1222    }
1223
1224    /// Sets the value of [priority][crate::model::Case::priority].
1225    pub fn set_priority<T: std::convert::Into<crate::model::case::Priority>>(
1226        mut self,
1227        v: T,
1228    ) -> Self {
1229        self.priority = v.into();
1230        self
1231    }
1232}
1233
1234impl wkt::message::Message for Case {
1235    fn typename() -> &'static str {
1236        "type.googleapis.com/google.cloud.support.v2.Case"
1237    }
1238}
1239
1240#[doc(hidden)]
1241impl<'de> serde::de::Deserialize<'de> for Case {
1242    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1243    where
1244        D: serde::Deserializer<'de>,
1245    {
1246        #[allow(non_camel_case_types)]
1247        #[doc(hidden)]
1248        #[derive(PartialEq, Eq, Hash)]
1249        enum __FieldTag {
1250            __name,
1251            __display_name,
1252            __description,
1253            __classification,
1254            __time_zone,
1255            __subscriber_email_addresses,
1256            __state,
1257            __create_time,
1258            __update_time,
1259            __creator,
1260            __contact_email,
1261            __escalated,
1262            __test_case,
1263            __language_code,
1264            __priority,
1265            Unknown(std::string::String),
1266        }
1267        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1268            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1269            where
1270                D: serde::Deserializer<'de>,
1271            {
1272                struct Visitor;
1273                impl<'de> serde::de::Visitor<'de> for Visitor {
1274                    type Value = __FieldTag;
1275                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1276                        formatter.write_str("a field name for Case")
1277                    }
1278                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1279                    where
1280                        E: serde::de::Error,
1281                    {
1282                        use std::result::Result::Ok;
1283                        use std::string::ToString;
1284                        match value {
1285                            "name" => Ok(__FieldTag::__name),
1286                            "displayName" => Ok(__FieldTag::__display_name),
1287                            "display_name" => Ok(__FieldTag::__display_name),
1288                            "description" => Ok(__FieldTag::__description),
1289                            "classification" => Ok(__FieldTag::__classification),
1290                            "timeZone" => Ok(__FieldTag::__time_zone),
1291                            "time_zone" => Ok(__FieldTag::__time_zone),
1292                            "subscriberEmailAddresses" => {
1293                                Ok(__FieldTag::__subscriber_email_addresses)
1294                            }
1295                            "subscriber_email_addresses" => {
1296                                Ok(__FieldTag::__subscriber_email_addresses)
1297                            }
1298                            "state" => Ok(__FieldTag::__state),
1299                            "createTime" => Ok(__FieldTag::__create_time),
1300                            "create_time" => Ok(__FieldTag::__create_time),
1301                            "updateTime" => Ok(__FieldTag::__update_time),
1302                            "update_time" => Ok(__FieldTag::__update_time),
1303                            "creator" => Ok(__FieldTag::__creator),
1304                            "contactEmail" => Ok(__FieldTag::__contact_email),
1305                            "contact_email" => Ok(__FieldTag::__contact_email),
1306                            "escalated" => Ok(__FieldTag::__escalated),
1307                            "testCase" => Ok(__FieldTag::__test_case),
1308                            "test_case" => Ok(__FieldTag::__test_case),
1309                            "languageCode" => Ok(__FieldTag::__language_code),
1310                            "language_code" => Ok(__FieldTag::__language_code),
1311                            "priority" => Ok(__FieldTag::__priority),
1312                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1313                        }
1314                    }
1315                }
1316                deserializer.deserialize_identifier(Visitor)
1317            }
1318        }
1319        struct Visitor;
1320        impl<'de> serde::de::Visitor<'de> for Visitor {
1321            type Value = Case;
1322            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1323                formatter.write_str("struct Case")
1324            }
1325            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1326            where
1327                A: serde::de::MapAccess<'de>,
1328            {
1329                #[allow(unused_imports)]
1330                use serde::de::Error;
1331                use std::option::Option::Some;
1332                let mut fields = std::collections::HashSet::new();
1333                let mut result = Self::Value::new();
1334                while let Some(tag) = map.next_key::<__FieldTag>()? {
1335                    #[allow(clippy::match_single_binding)]
1336                    match tag {
1337                        __FieldTag::__name => {
1338                            if !fields.insert(__FieldTag::__name) {
1339                                return std::result::Result::Err(A::Error::duplicate_field(
1340                                    "multiple values for name",
1341                                ));
1342                            }
1343                            result.name = map
1344                                .next_value::<std::option::Option<std::string::String>>()?
1345                                .unwrap_or_default();
1346                        }
1347                        __FieldTag::__display_name => {
1348                            if !fields.insert(__FieldTag::__display_name) {
1349                                return std::result::Result::Err(A::Error::duplicate_field(
1350                                    "multiple values for display_name",
1351                                ));
1352                            }
1353                            result.display_name = map
1354                                .next_value::<std::option::Option<std::string::String>>()?
1355                                .unwrap_or_default();
1356                        }
1357                        __FieldTag::__description => {
1358                            if !fields.insert(__FieldTag::__description) {
1359                                return std::result::Result::Err(A::Error::duplicate_field(
1360                                    "multiple values for description",
1361                                ));
1362                            }
1363                            result.description = map
1364                                .next_value::<std::option::Option<std::string::String>>()?
1365                                .unwrap_or_default();
1366                        }
1367                        __FieldTag::__classification => {
1368                            if !fields.insert(__FieldTag::__classification) {
1369                                return std::result::Result::Err(A::Error::duplicate_field(
1370                                    "multiple values for classification",
1371                                ));
1372                            }
1373                            result.classification = map.next_value::<std::option::Option<crate::model::CaseClassification>>()?
1374                                ;
1375                        }
1376                        __FieldTag::__time_zone => {
1377                            if !fields.insert(__FieldTag::__time_zone) {
1378                                return std::result::Result::Err(A::Error::duplicate_field(
1379                                    "multiple values for time_zone",
1380                                ));
1381                            }
1382                            result.time_zone = map
1383                                .next_value::<std::option::Option<std::string::String>>()?
1384                                .unwrap_or_default();
1385                        }
1386                        __FieldTag::__subscriber_email_addresses => {
1387                            if !fields.insert(__FieldTag::__subscriber_email_addresses) {
1388                                return std::result::Result::Err(A::Error::duplicate_field(
1389                                    "multiple values for subscriber_email_addresses",
1390                                ));
1391                            }
1392                            result.subscriber_email_addresses = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1393                        }
1394                        __FieldTag::__state => {
1395                            if !fields.insert(__FieldTag::__state) {
1396                                return std::result::Result::Err(A::Error::duplicate_field(
1397                                    "multiple values for state",
1398                                ));
1399                            }
1400                            result.state = map
1401                                .next_value::<std::option::Option<crate::model::case::State>>()?
1402                                .unwrap_or_default();
1403                        }
1404                        __FieldTag::__create_time => {
1405                            if !fields.insert(__FieldTag::__create_time) {
1406                                return std::result::Result::Err(A::Error::duplicate_field(
1407                                    "multiple values for create_time",
1408                                ));
1409                            }
1410                            result.create_time =
1411                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1412                        }
1413                        __FieldTag::__update_time => {
1414                            if !fields.insert(__FieldTag::__update_time) {
1415                                return std::result::Result::Err(A::Error::duplicate_field(
1416                                    "multiple values for update_time",
1417                                ));
1418                            }
1419                            result.update_time =
1420                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1421                        }
1422                        __FieldTag::__creator => {
1423                            if !fields.insert(__FieldTag::__creator) {
1424                                return std::result::Result::Err(A::Error::duplicate_field(
1425                                    "multiple values for creator",
1426                                ));
1427                            }
1428                            result.creator =
1429                                map.next_value::<std::option::Option<crate::model::Actor>>()?;
1430                        }
1431                        __FieldTag::__contact_email => {
1432                            if !fields.insert(__FieldTag::__contact_email) {
1433                                return std::result::Result::Err(A::Error::duplicate_field(
1434                                    "multiple values for contact_email",
1435                                ));
1436                            }
1437                            result.contact_email = map
1438                                .next_value::<std::option::Option<std::string::String>>()?
1439                                .unwrap_or_default();
1440                        }
1441                        __FieldTag::__escalated => {
1442                            if !fields.insert(__FieldTag::__escalated) {
1443                                return std::result::Result::Err(A::Error::duplicate_field(
1444                                    "multiple values for escalated",
1445                                ));
1446                            }
1447                            result.escalated = map
1448                                .next_value::<std::option::Option<bool>>()?
1449                                .unwrap_or_default();
1450                        }
1451                        __FieldTag::__test_case => {
1452                            if !fields.insert(__FieldTag::__test_case) {
1453                                return std::result::Result::Err(A::Error::duplicate_field(
1454                                    "multiple values for test_case",
1455                                ));
1456                            }
1457                            result.test_case = map
1458                                .next_value::<std::option::Option<bool>>()?
1459                                .unwrap_or_default();
1460                        }
1461                        __FieldTag::__language_code => {
1462                            if !fields.insert(__FieldTag::__language_code) {
1463                                return std::result::Result::Err(A::Error::duplicate_field(
1464                                    "multiple values for language_code",
1465                                ));
1466                            }
1467                            result.language_code = map
1468                                .next_value::<std::option::Option<std::string::String>>()?
1469                                .unwrap_or_default();
1470                        }
1471                        __FieldTag::__priority => {
1472                            if !fields.insert(__FieldTag::__priority) {
1473                                return std::result::Result::Err(A::Error::duplicate_field(
1474                                    "multiple values for priority",
1475                                ));
1476                            }
1477                            result.priority = map
1478                                .next_value::<std::option::Option<crate::model::case::Priority>>()?
1479                                .unwrap_or_default();
1480                        }
1481                        __FieldTag::Unknown(key) => {
1482                            let value = map.next_value::<serde_json::Value>()?;
1483                            result._unknown_fields.insert(key, value);
1484                        }
1485                    }
1486                }
1487                std::result::Result::Ok(result)
1488            }
1489        }
1490        deserializer.deserialize_any(Visitor)
1491    }
1492}
1493
1494#[doc(hidden)]
1495impl serde::ser::Serialize for Case {
1496    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1497    where
1498        S: serde::ser::Serializer,
1499    {
1500        use serde::ser::SerializeMap;
1501        #[allow(unused_imports)]
1502        use std::option::Option::Some;
1503        let mut state = serializer.serialize_map(std::option::Option::None)?;
1504        if !self.name.is_empty() {
1505            state.serialize_entry("name", &self.name)?;
1506        }
1507        if !self.display_name.is_empty() {
1508            state.serialize_entry("displayName", &self.display_name)?;
1509        }
1510        if !self.description.is_empty() {
1511            state.serialize_entry("description", &self.description)?;
1512        }
1513        if self.classification.is_some() {
1514            state.serialize_entry("classification", &self.classification)?;
1515        }
1516        if !self.time_zone.is_empty() {
1517            state.serialize_entry("timeZone", &self.time_zone)?;
1518        }
1519        if !self.subscriber_email_addresses.is_empty() {
1520            state.serialize_entry("subscriberEmailAddresses", &self.subscriber_email_addresses)?;
1521        }
1522        if !wkt::internal::is_default(&self.state) {
1523            state.serialize_entry("state", &self.state)?;
1524        }
1525        if self.create_time.is_some() {
1526            state.serialize_entry("createTime", &self.create_time)?;
1527        }
1528        if self.update_time.is_some() {
1529            state.serialize_entry("updateTime", &self.update_time)?;
1530        }
1531        if self.creator.is_some() {
1532            state.serialize_entry("creator", &self.creator)?;
1533        }
1534        if !self.contact_email.is_empty() {
1535            state.serialize_entry("contactEmail", &self.contact_email)?;
1536        }
1537        if !wkt::internal::is_default(&self.escalated) {
1538            state.serialize_entry("escalated", &self.escalated)?;
1539        }
1540        if !wkt::internal::is_default(&self.test_case) {
1541            state.serialize_entry("testCase", &self.test_case)?;
1542        }
1543        if !self.language_code.is_empty() {
1544            state.serialize_entry("languageCode", &self.language_code)?;
1545        }
1546        if !wkt::internal::is_default(&self.priority) {
1547            state.serialize_entry("priority", &self.priority)?;
1548        }
1549        if !self._unknown_fields.is_empty() {
1550            for (key, value) in self._unknown_fields.iter() {
1551                state.serialize_entry(key, &value)?;
1552            }
1553        }
1554        state.end()
1555    }
1556}
1557
1558impl std::fmt::Debug for Case {
1559    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1560        let mut debug_struct = f.debug_struct("Case");
1561        debug_struct.field("name", &self.name);
1562        debug_struct.field("display_name", &self.display_name);
1563        debug_struct.field("description", &self.description);
1564        debug_struct.field("classification", &self.classification);
1565        debug_struct.field("time_zone", &self.time_zone);
1566        debug_struct.field(
1567            "subscriber_email_addresses",
1568            &self.subscriber_email_addresses,
1569        );
1570        debug_struct.field("state", &self.state);
1571        debug_struct.field("create_time", &self.create_time);
1572        debug_struct.field("update_time", &self.update_time);
1573        debug_struct.field("creator", &self.creator);
1574        debug_struct.field("contact_email", &self.contact_email);
1575        debug_struct.field("escalated", &self.escalated);
1576        debug_struct.field("test_case", &self.test_case);
1577        debug_struct.field("language_code", &self.language_code);
1578        debug_struct.field("priority", &self.priority);
1579        if !self._unknown_fields.is_empty() {
1580            debug_struct.field("_unknown_fields", &self._unknown_fields);
1581        }
1582        debug_struct.finish()
1583    }
1584}
1585
1586/// Defines additional types related to [Case].
1587pub mod case {
1588    #[allow(unused_imports)]
1589    use super::*;
1590
1591    /// The status of a support case.
1592    ///
1593    /// # Working with unknown values
1594    ///
1595    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1596    /// additional enum variants at any time. Adding new variants is not considered
1597    /// a breaking change. Applications should write their code in anticipation of:
1598    ///
1599    /// - New values appearing in future releases of the client library, **and**
1600    /// - New values received dynamically, without application changes.
1601    ///
1602    /// Please consult the [Working with enums] section in the user guide for some
1603    /// guidelines.
1604    ///
1605    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1606    #[derive(Clone, Debug, PartialEq)]
1607    #[non_exhaustive]
1608    pub enum State {
1609        /// Case is in an unknown state.
1610        Unspecified,
1611        /// The case has been created but no one is assigned to work on it yet.
1612        New,
1613        /// The case is currently being handled by Google support.
1614        InProgressGoogleSupport,
1615        /// Google is waiting for a response.
1616        ActionRequired,
1617        /// A solution has been offered for the case, but it isn't yet closed.
1618        SolutionProvided,
1619        /// The case has been resolved.
1620        Closed,
1621        /// If set, the enum was initialized with an unknown value.
1622        ///
1623        /// Applications can examine the value using [State::value] or
1624        /// [State::name].
1625        UnknownValue(state::UnknownValue),
1626    }
1627
1628    #[doc(hidden)]
1629    pub mod state {
1630        #[allow(unused_imports)]
1631        use super::*;
1632        #[derive(Clone, Debug, PartialEq)]
1633        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1634    }
1635
1636    impl State {
1637        /// Gets the enum value.
1638        ///
1639        /// Returns `None` if the enum contains an unknown value deserialized from
1640        /// the string representation of enums.
1641        pub fn value(&self) -> std::option::Option<i32> {
1642            match self {
1643                Self::Unspecified => std::option::Option::Some(0),
1644                Self::New => std::option::Option::Some(1),
1645                Self::InProgressGoogleSupport => std::option::Option::Some(2),
1646                Self::ActionRequired => std::option::Option::Some(3),
1647                Self::SolutionProvided => std::option::Option::Some(4),
1648                Self::Closed => std::option::Option::Some(5),
1649                Self::UnknownValue(u) => u.0.value(),
1650            }
1651        }
1652
1653        /// Gets the enum value as a string.
1654        ///
1655        /// Returns `None` if the enum contains an unknown value deserialized from
1656        /// the integer representation of enums.
1657        pub fn name(&self) -> std::option::Option<&str> {
1658            match self {
1659                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1660                Self::New => std::option::Option::Some("NEW"),
1661                Self::InProgressGoogleSupport => {
1662                    std::option::Option::Some("IN_PROGRESS_GOOGLE_SUPPORT")
1663                }
1664                Self::ActionRequired => std::option::Option::Some("ACTION_REQUIRED"),
1665                Self::SolutionProvided => std::option::Option::Some("SOLUTION_PROVIDED"),
1666                Self::Closed => std::option::Option::Some("CLOSED"),
1667                Self::UnknownValue(u) => u.0.name(),
1668            }
1669        }
1670    }
1671
1672    impl std::default::Default for State {
1673        fn default() -> Self {
1674            use std::convert::From;
1675            Self::from(0)
1676        }
1677    }
1678
1679    impl std::fmt::Display for State {
1680        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1681            wkt::internal::display_enum(f, self.name(), self.value())
1682        }
1683    }
1684
1685    impl std::convert::From<i32> for State {
1686        fn from(value: i32) -> Self {
1687            match value {
1688                0 => Self::Unspecified,
1689                1 => Self::New,
1690                2 => Self::InProgressGoogleSupport,
1691                3 => Self::ActionRequired,
1692                4 => Self::SolutionProvided,
1693                5 => Self::Closed,
1694                _ => Self::UnknownValue(state::UnknownValue(
1695                    wkt::internal::UnknownEnumValue::Integer(value),
1696                )),
1697            }
1698        }
1699    }
1700
1701    impl std::convert::From<&str> for State {
1702        fn from(value: &str) -> Self {
1703            use std::string::ToString;
1704            match value {
1705                "STATE_UNSPECIFIED" => Self::Unspecified,
1706                "NEW" => Self::New,
1707                "IN_PROGRESS_GOOGLE_SUPPORT" => Self::InProgressGoogleSupport,
1708                "ACTION_REQUIRED" => Self::ActionRequired,
1709                "SOLUTION_PROVIDED" => Self::SolutionProvided,
1710                "CLOSED" => Self::Closed,
1711                _ => Self::UnknownValue(state::UnknownValue(
1712                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1713                )),
1714            }
1715        }
1716    }
1717
1718    impl serde::ser::Serialize for State {
1719        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1720        where
1721            S: serde::Serializer,
1722        {
1723            match self {
1724                Self::Unspecified => serializer.serialize_i32(0),
1725                Self::New => serializer.serialize_i32(1),
1726                Self::InProgressGoogleSupport => serializer.serialize_i32(2),
1727                Self::ActionRequired => serializer.serialize_i32(3),
1728                Self::SolutionProvided => serializer.serialize_i32(4),
1729                Self::Closed => serializer.serialize_i32(5),
1730                Self::UnknownValue(u) => u.0.serialize(serializer),
1731            }
1732        }
1733    }
1734
1735    impl<'de> serde::de::Deserialize<'de> for State {
1736        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1737        where
1738            D: serde::Deserializer<'de>,
1739        {
1740            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1741                ".google.cloud.support.v2.Case.State",
1742            ))
1743        }
1744    }
1745
1746    /// The case Priority. P0 is most urgent and P4 the least.
1747    ///
1748    /// # Working with unknown values
1749    ///
1750    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1751    /// additional enum variants at any time. Adding new variants is not considered
1752    /// a breaking change. Applications should write their code in anticipation of:
1753    ///
1754    /// - New values appearing in future releases of the client library, **and**
1755    /// - New values received dynamically, without application changes.
1756    ///
1757    /// Please consult the [Working with enums] section in the user guide for some
1758    /// guidelines.
1759    ///
1760    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1761    #[derive(Clone, Debug, PartialEq)]
1762    #[non_exhaustive]
1763    pub enum Priority {
1764        /// Priority is undefined or has not been set yet.
1765        Unspecified,
1766        /// Extreme impact on a production service. Service is hard down.
1767        P0,
1768        /// Critical impact on a production service. Service is currently unusable.
1769        P1,
1770        /// Severe impact on a production service. Service is usable but greatly
1771        /// impaired.
1772        P2,
1773        /// Medium impact on a production service.  Service is available, but
1774        /// moderately impaired.
1775        P3,
1776        /// General questions or minor issues.  Production service is fully
1777        /// available.
1778        P4,
1779        /// If set, the enum was initialized with an unknown value.
1780        ///
1781        /// Applications can examine the value using [Priority::value] or
1782        /// [Priority::name].
1783        UnknownValue(priority::UnknownValue),
1784    }
1785
1786    #[doc(hidden)]
1787    pub mod priority {
1788        #[allow(unused_imports)]
1789        use super::*;
1790        #[derive(Clone, Debug, PartialEq)]
1791        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1792    }
1793
1794    impl Priority {
1795        /// Gets the enum value.
1796        ///
1797        /// Returns `None` if the enum contains an unknown value deserialized from
1798        /// the string representation of enums.
1799        pub fn value(&self) -> std::option::Option<i32> {
1800            match self {
1801                Self::Unspecified => std::option::Option::Some(0),
1802                Self::P0 => std::option::Option::Some(1),
1803                Self::P1 => std::option::Option::Some(2),
1804                Self::P2 => std::option::Option::Some(3),
1805                Self::P3 => std::option::Option::Some(4),
1806                Self::P4 => std::option::Option::Some(5),
1807                Self::UnknownValue(u) => u.0.value(),
1808            }
1809        }
1810
1811        /// Gets the enum value as a string.
1812        ///
1813        /// Returns `None` if the enum contains an unknown value deserialized from
1814        /// the integer representation of enums.
1815        pub fn name(&self) -> std::option::Option<&str> {
1816            match self {
1817                Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
1818                Self::P0 => std::option::Option::Some("P0"),
1819                Self::P1 => std::option::Option::Some("P1"),
1820                Self::P2 => std::option::Option::Some("P2"),
1821                Self::P3 => std::option::Option::Some("P3"),
1822                Self::P4 => std::option::Option::Some("P4"),
1823                Self::UnknownValue(u) => u.0.name(),
1824            }
1825        }
1826    }
1827
1828    impl std::default::Default for Priority {
1829        fn default() -> Self {
1830            use std::convert::From;
1831            Self::from(0)
1832        }
1833    }
1834
1835    impl std::fmt::Display for Priority {
1836        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1837            wkt::internal::display_enum(f, self.name(), self.value())
1838        }
1839    }
1840
1841    impl std::convert::From<i32> for Priority {
1842        fn from(value: i32) -> Self {
1843            match value {
1844                0 => Self::Unspecified,
1845                1 => Self::P0,
1846                2 => Self::P1,
1847                3 => Self::P2,
1848                4 => Self::P3,
1849                5 => Self::P4,
1850                _ => Self::UnknownValue(priority::UnknownValue(
1851                    wkt::internal::UnknownEnumValue::Integer(value),
1852                )),
1853            }
1854        }
1855    }
1856
1857    impl std::convert::From<&str> for Priority {
1858        fn from(value: &str) -> Self {
1859            use std::string::ToString;
1860            match value {
1861                "PRIORITY_UNSPECIFIED" => Self::Unspecified,
1862                "P0" => Self::P0,
1863                "P1" => Self::P1,
1864                "P2" => Self::P2,
1865                "P3" => Self::P3,
1866                "P4" => Self::P4,
1867                _ => Self::UnknownValue(priority::UnknownValue(
1868                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1869                )),
1870            }
1871        }
1872    }
1873
1874    impl serde::ser::Serialize for Priority {
1875        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1876        where
1877            S: serde::Serializer,
1878        {
1879            match self {
1880                Self::Unspecified => serializer.serialize_i32(0),
1881                Self::P0 => serializer.serialize_i32(1),
1882                Self::P1 => serializer.serialize_i32(2),
1883                Self::P2 => serializer.serialize_i32(3),
1884                Self::P3 => serializer.serialize_i32(4),
1885                Self::P4 => serializer.serialize_i32(5),
1886                Self::UnknownValue(u) => u.0.serialize(serializer),
1887            }
1888        }
1889    }
1890
1891    impl<'de> serde::de::Deserialize<'de> for Priority {
1892        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1893        where
1894            D: serde::Deserializer<'de>,
1895        {
1896            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
1897                ".google.cloud.support.v2.Case.Priority",
1898            ))
1899        }
1900    }
1901}
1902
1903/// A Case Classification represents the topic that a case is about. It's very
1904/// important to use accurate classifications, because they're
1905/// used to route your cases to specialists who can help you.
1906///
1907/// A classification always has an ID that is its unique identifier.
1908/// A valid ID is required when creating a case.
1909#[derive(Clone, Default, PartialEq)]
1910#[non_exhaustive]
1911pub struct CaseClassification {
1912    /// The unique ID for a classification. Must be specified for case creation.
1913    ///
1914    /// To retrieve valid classification IDs for case creation, use
1915    /// `caseClassifications.search`.
1916    ///
1917    /// Classification IDs returned by `caseClassifications.search` are guaranteed
1918    /// to be valid for at least 6 months. If a given classification is
1919    /// deactiveated, it will immediately stop being returned. After 6 months,
1920    /// `case.create` requests using the classification ID will fail.
1921    pub id: std::string::String,
1922
1923    /// A display name for the classification.
1924    ///
1925    /// The display name is not static and can change. To uniquely and consistently
1926    /// identify classifications, use the `CaseClassification.id` field.
1927    pub display_name: std::string::String,
1928
1929    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1930}
1931
1932impl CaseClassification {
1933    pub fn new() -> Self {
1934        std::default::Default::default()
1935    }
1936
1937    /// Sets the value of [id][crate::model::CaseClassification::id].
1938    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1939        self.id = v.into();
1940        self
1941    }
1942
1943    /// Sets the value of [display_name][crate::model::CaseClassification::display_name].
1944    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1945        self.display_name = v.into();
1946        self
1947    }
1948}
1949
1950impl wkt::message::Message for CaseClassification {
1951    fn typename() -> &'static str {
1952        "type.googleapis.com/google.cloud.support.v2.CaseClassification"
1953    }
1954}
1955
1956#[doc(hidden)]
1957impl<'de> serde::de::Deserialize<'de> for CaseClassification {
1958    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1959    where
1960        D: serde::Deserializer<'de>,
1961    {
1962        #[allow(non_camel_case_types)]
1963        #[doc(hidden)]
1964        #[derive(PartialEq, Eq, Hash)]
1965        enum __FieldTag {
1966            __id,
1967            __display_name,
1968            Unknown(std::string::String),
1969        }
1970        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1971            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1972            where
1973                D: serde::Deserializer<'de>,
1974            {
1975                struct Visitor;
1976                impl<'de> serde::de::Visitor<'de> for Visitor {
1977                    type Value = __FieldTag;
1978                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1979                        formatter.write_str("a field name for CaseClassification")
1980                    }
1981                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1982                    where
1983                        E: serde::de::Error,
1984                    {
1985                        use std::result::Result::Ok;
1986                        use std::string::ToString;
1987                        match value {
1988                            "id" => Ok(__FieldTag::__id),
1989                            "displayName" => Ok(__FieldTag::__display_name),
1990                            "display_name" => Ok(__FieldTag::__display_name),
1991                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1992                        }
1993                    }
1994                }
1995                deserializer.deserialize_identifier(Visitor)
1996            }
1997        }
1998        struct Visitor;
1999        impl<'de> serde::de::Visitor<'de> for Visitor {
2000            type Value = CaseClassification;
2001            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2002                formatter.write_str("struct CaseClassification")
2003            }
2004            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2005            where
2006                A: serde::de::MapAccess<'de>,
2007            {
2008                #[allow(unused_imports)]
2009                use serde::de::Error;
2010                use std::option::Option::Some;
2011                let mut fields = std::collections::HashSet::new();
2012                let mut result = Self::Value::new();
2013                while let Some(tag) = map.next_key::<__FieldTag>()? {
2014                    #[allow(clippy::match_single_binding)]
2015                    match tag {
2016                        __FieldTag::__id => {
2017                            if !fields.insert(__FieldTag::__id) {
2018                                return std::result::Result::Err(A::Error::duplicate_field(
2019                                    "multiple values for id",
2020                                ));
2021                            }
2022                            result.id = map
2023                                .next_value::<std::option::Option<std::string::String>>()?
2024                                .unwrap_or_default();
2025                        }
2026                        __FieldTag::__display_name => {
2027                            if !fields.insert(__FieldTag::__display_name) {
2028                                return std::result::Result::Err(A::Error::duplicate_field(
2029                                    "multiple values for display_name",
2030                                ));
2031                            }
2032                            result.display_name = map
2033                                .next_value::<std::option::Option<std::string::String>>()?
2034                                .unwrap_or_default();
2035                        }
2036                        __FieldTag::Unknown(key) => {
2037                            let value = map.next_value::<serde_json::Value>()?;
2038                            result._unknown_fields.insert(key, value);
2039                        }
2040                    }
2041                }
2042                std::result::Result::Ok(result)
2043            }
2044        }
2045        deserializer.deserialize_any(Visitor)
2046    }
2047}
2048
2049#[doc(hidden)]
2050impl serde::ser::Serialize for CaseClassification {
2051    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2052    where
2053        S: serde::ser::Serializer,
2054    {
2055        use serde::ser::SerializeMap;
2056        #[allow(unused_imports)]
2057        use std::option::Option::Some;
2058        let mut state = serializer.serialize_map(std::option::Option::None)?;
2059        if !self.id.is_empty() {
2060            state.serialize_entry("id", &self.id)?;
2061        }
2062        if !self.display_name.is_empty() {
2063            state.serialize_entry("displayName", &self.display_name)?;
2064        }
2065        if !self._unknown_fields.is_empty() {
2066            for (key, value) in self._unknown_fields.iter() {
2067                state.serialize_entry(key, &value)?;
2068            }
2069        }
2070        state.end()
2071    }
2072}
2073
2074impl std::fmt::Debug for CaseClassification {
2075    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2076        let mut debug_struct = f.debug_struct("CaseClassification");
2077        debug_struct.field("id", &self.id);
2078        debug_struct.field("display_name", &self.display_name);
2079        if !self._unknown_fields.is_empty() {
2080            debug_struct.field("_unknown_fields", &self._unknown_fields);
2081        }
2082        debug_struct.finish()
2083    }
2084}
2085
2086/// The request message for the GetCase endpoint.
2087#[derive(Clone, Default, PartialEq)]
2088#[non_exhaustive]
2089pub struct GetCaseRequest {
2090    /// Required. The full name of a case to be retrieved.
2091    pub name: std::string::String,
2092
2093    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2094}
2095
2096impl GetCaseRequest {
2097    pub fn new() -> Self {
2098        std::default::Default::default()
2099    }
2100
2101    /// Sets the value of [name][crate::model::GetCaseRequest::name].
2102    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2103        self.name = v.into();
2104        self
2105    }
2106}
2107
2108impl wkt::message::Message for GetCaseRequest {
2109    fn typename() -> &'static str {
2110        "type.googleapis.com/google.cloud.support.v2.GetCaseRequest"
2111    }
2112}
2113
2114#[doc(hidden)]
2115impl<'de> serde::de::Deserialize<'de> for GetCaseRequest {
2116    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2117    where
2118        D: serde::Deserializer<'de>,
2119    {
2120        #[allow(non_camel_case_types)]
2121        #[doc(hidden)]
2122        #[derive(PartialEq, Eq, Hash)]
2123        enum __FieldTag {
2124            __name,
2125            Unknown(std::string::String),
2126        }
2127        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2128            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2129            where
2130                D: serde::Deserializer<'de>,
2131            {
2132                struct Visitor;
2133                impl<'de> serde::de::Visitor<'de> for Visitor {
2134                    type Value = __FieldTag;
2135                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2136                        formatter.write_str("a field name for GetCaseRequest")
2137                    }
2138                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2139                    where
2140                        E: serde::de::Error,
2141                    {
2142                        use std::result::Result::Ok;
2143                        use std::string::ToString;
2144                        match value {
2145                            "name" => Ok(__FieldTag::__name),
2146                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2147                        }
2148                    }
2149                }
2150                deserializer.deserialize_identifier(Visitor)
2151            }
2152        }
2153        struct Visitor;
2154        impl<'de> serde::de::Visitor<'de> for Visitor {
2155            type Value = GetCaseRequest;
2156            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2157                formatter.write_str("struct GetCaseRequest")
2158            }
2159            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2160            where
2161                A: serde::de::MapAccess<'de>,
2162            {
2163                #[allow(unused_imports)]
2164                use serde::de::Error;
2165                use std::option::Option::Some;
2166                let mut fields = std::collections::HashSet::new();
2167                let mut result = Self::Value::new();
2168                while let Some(tag) = map.next_key::<__FieldTag>()? {
2169                    #[allow(clippy::match_single_binding)]
2170                    match tag {
2171                        __FieldTag::__name => {
2172                            if !fields.insert(__FieldTag::__name) {
2173                                return std::result::Result::Err(A::Error::duplicate_field(
2174                                    "multiple values for name",
2175                                ));
2176                            }
2177                            result.name = map
2178                                .next_value::<std::option::Option<std::string::String>>()?
2179                                .unwrap_or_default();
2180                        }
2181                        __FieldTag::Unknown(key) => {
2182                            let value = map.next_value::<serde_json::Value>()?;
2183                            result._unknown_fields.insert(key, value);
2184                        }
2185                    }
2186                }
2187                std::result::Result::Ok(result)
2188            }
2189        }
2190        deserializer.deserialize_any(Visitor)
2191    }
2192}
2193
2194#[doc(hidden)]
2195impl serde::ser::Serialize for GetCaseRequest {
2196    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2197    where
2198        S: serde::ser::Serializer,
2199    {
2200        use serde::ser::SerializeMap;
2201        #[allow(unused_imports)]
2202        use std::option::Option::Some;
2203        let mut state = serializer.serialize_map(std::option::Option::None)?;
2204        if !self.name.is_empty() {
2205            state.serialize_entry("name", &self.name)?;
2206        }
2207        if !self._unknown_fields.is_empty() {
2208            for (key, value) in self._unknown_fields.iter() {
2209                state.serialize_entry(key, &value)?;
2210            }
2211        }
2212        state.end()
2213    }
2214}
2215
2216impl std::fmt::Debug for GetCaseRequest {
2217    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2218        let mut debug_struct = f.debug_struct("GetCaseRequest");
2219        debug_struct.field("name", &self.name);
2220        if !self._unknown_fields.is_empty() {
2221            debug_struct.field("_unknown_fields", &self._unknown_fields);
2222        }
2223        debug_struct.finish()
2224    }
2225}
2226
2227/// The request message for the CreateCase endpoint.
2228#[derive(Clone, Default, PartialEq)]
2229#[non_exhaustive]
2230pub struct CreateCaseRequest {
2231    /// Required. The name of the parent under which the case should be created.
2232    pub parent: std::string::String,
2233
2234    /// Required. The case to be created.
2235    pub case: std::option::Option<crate::model::Case>,
2236
2237    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2238}
2239
2240impl CreateCaseRequest {
2241    pub fn new() -> Self {
2242        std::default::Default::default()
2243    }
2244
2245    /// Sets the value of [parent][crate::model::CreateCaseRequest::parent].
2246    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2247        self.parent = v.into();
2248        self
2249    }
2250
2251    /// Sets the value of [case][crate::model::CreateCaseRequest::case].
2252    pub fn set_case<T>(mut self, v: T) -> Self
2253    where
2254        T: std::convert::Into<crate::model::Case>,
2255    {
2256        self.case = std::option::Option::Some(v.into());
2257        self
2258    }
2259
2260    /// Sets or clears the value of [case][crate::model::CreateCaseRequest::case].
2261    pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
2262    where
2263        T: std::convert::Into<crate::model::Case>,
2264    {
2265        self.case = v.map(|x| x.into());
2266        self
2267    }
2268}
2269
2270impl wkt::message::Message for CreateCaseRequest {
2271    fn typename() -> &'static str {
2272        "type.googleapis.com/google.cloud.support.v2.CreateCaseRequest"
2273    }
2274}
2275
2276#[doc(hidden)]
2277impl<'de> serde::de::Deserialize<'de> for CreateCaseRequest {
2278    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2279    where
2280        D: serde::Deserializer<'de>,
2281    {
2282        #[allow(non_camel_case_types)]
2283        #[doc(hidden)]
2284        #[derive(PartialEq, Eq, Hash)]
2285        enum __FieldTag {
2286            __parent,
2287            __case,
2288            Unknown(std::string::String),
2289        }
2290        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2291            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2292            where
2293                D: serde::Deserializer<'de>,
2294            {
2295                struct Visitor;
2296                impl<'de> serde::de::Visitor<'de> for Visitor {
2297                    type Value = __FieldTag;
2298                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2299                        formatter.write_str("a field name for CreateCaseRequest")
2300                    }
2301                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2302                    where
2303                        E: serde::de::Error,
2304                    {
2305                        use std::result::Result::Ok;
2306                        use std::string::ToString;
2307                        match value {
2308                            "parent" => Ok(__FieldTag::__parent),
2309                            "case" => Ok(__FieldTag::__case),
2310                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2311                        }
2312                    }
2313                }
2314                deserializer.deserialize_identifier(Visitor)
2315            }
2316        }
2317        struct Visitor;
2318        impl<'de> serde::de::Visitor<'de> for Visitor {
2319            type Value = CreateCaseRequest;
2320            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2321                formatter.write_str("struct CreateCaseRequest")
2322            }
2323            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2324            where
2325                A: serde::de::MapAccess<'de>,
2326            {
2327                #[allow(unused_imports)]
2328                use serde::de::Error;
2329                use std::option::Option::Some;
2330                let mut fields = std::collections::HashSet::new();
2331                let mut result = Self::Value::new();
2332                while let Some(tag) = map.next_key::<__FieldTag>()? {
2333                    #[allow(clippy::match_single_binding)]
2334                    match tag {
2335                        __FieldTag::__parent => {
2336                            if !fields.insert(__FieldTag::__parent) {
2337                                return std::result::Result::Err(A::Error::duplicate_field(
2338                                    "multiple values for parent",
2339                                ));
2340                            }
2341                            result.parent = map
2342                                .next_value::<std::option::Option<std::string::String>>()?
2343                                .unwrap_or_default();
2344                        }
2345                        __FieldTag::__case => {
2346                            if !fields.insert(__FieldTag::__case) {
2347                                return std::result::Result::Err(A::Error::duplicate_field(
2348                                    "multiple values for case",
2349                                ));
2350                            }
2351                            result.case =
2352                                map.next_value::<std::option::Option<crate::model::Case>>()?;
2353                        }
2354                        __FieldTag::Unknown(key) => {
2355                            let value = map.next_value::<serde_json::Value>()?;
2356                            result._unknown_fields.insert(key, value);
2357                        }
2358                    }
2359                }
2360                std::result::Result::Ok(result)
2361            }
2362        }
2363        deserializer.deserialize_any(Visitor)
2364    }
2365}
2366
2367#[doc(hidden)]
2368impl serde::ser::Serialize for CreateCaseRequest {
2369    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2370    where
2371        S: serde::ser::Serializer,
2372    {
2373        use serde::ser::SerializeMap;
2374        #[allow(unused_imports)]
2375        use std::option::Option::Some;
2376        let mut state = serializer.serialize_map(std::option::Option::None)?;
2377        if !self.parent.is_empty() {
2378            state.serialize_entry("parent", &self.parent)?;
2379        }
2380        if self.case.is_some() {
2381            state.serialize_entry("case", &self.case)?;
2382        }
2383        if !self._unknown_fields.is_empty() {
2384            for (key, value) in self._unknown_fields.iter() {
2385                state.serialize_entry(key, &value)?;
2386            }
2387        }
2388        state.end()
2389    }
2390}
2391
2392impl std::fmt::Debug for CreateCaseRequest {
2393    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2394        let mut debug_struct = f.debug_struct("CreateCaseRequest");
2395        debug_struct.field("parent", &self.parent);
2396        debug_struct.field("case", &self.case);
2397        if !self._unknown_fields.is_empty() {
2398            debug_struct.field("_unknown_fields", &self._unknown_fields);
2399        }
2400        debug_struct.finish()
2401    }
2402}
2403
2404/// The request message for the ListCases endpoint.
2405#[derive(Clone, Default, PartialEq)]
2406#[non_exhaustive]
2407pub struct ListCasesRequest {
2408    /// Required. The name of a parent to list cases under.
2409    pub parent: std::string::String,
2410
2411    /// An expression used to filter cases.
2412    ///
2413    /// If it's an empty string, then no filtering happens. Otherwise, the endpoint
2414    /// returns the cases that match the filter.
2415    ///
2416    /// Expressions use the following fields separated by `AND` and specified with
2417    /// `=`:
2418    ///
2419    /// - `state`: Can be `OPEN` or `CLOSED`.
2420    /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
2421    ///   can specify multiple values for priority using the `OR` operator. For
2422    ///   example, `priority=P1 OR priority=P2`.
2423    /// - `creator.email`: The email address of the case creator.
2424    ///
2425    /// EXAMPLES:
2426    ///
2427    /// - `state=CLOSED`
2428    /// - `state=OPEN AND creator.email="tester@example.com"`
2429    /// - `state=OPEN AND (priority=P0 OR priority=P1)`
2430    pub filter: std::string::String,
2431
2432    /// The maximum number of cases fetched with each request. Defaults to 10.
2433    pub page_size: i32,
2434
2435    /// A token identifying the page of results to return. If unspecified, the
2436    /// first page is retrieved.
2437    pub page_token: std::string::String,
2438
2439    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2440}
2441
2442impl ListCasesRequest {
2443    pub fn new() -> Self {
2444        std::default::Default::default()
2445    }
2446
2447    /// Sets the value of [parent][crate::model::ListCasesRequest::parent].
2448    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2449        self.parent = v.into();
2450        self
2451    }
2452
2453    /// Sets the value of [filter][crate::model::ListCasesRequest::filter].
2454    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2455        self.filter = v.into();
2456        self
2457    }
2458
2459    /// Sets the value of [page_size][crate::model::ListCasesRequest::page_size].
2460    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2461        self.page_size = v.into();
2462        self
2463    }
2464
2465    /// Sets the value of [page_token][crate::model::ListCasesRequest::page_token].
2466    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2467        self.page_token = v.into();
2468        self
2469    }
2470}
2471
2472impl wkt::message::Message for ListCasesRequest {
2473    fn typename() -> &'static str {
2474        "type.googleapis.com/google.cloud.support.v2.ListCasesRequest"
2475    }
2476}
2477
2478#[doc(hidden)]
2479impl<'de> serde::de::Deserialize<'de> for ListCasesRequest {
2480    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2481    where
2482        D: serde::Deserializer<'de>,
2483    {
2484        #[allow(non_camel_case_types)]
2485        #[doc(hidden)]
2486        #[derive(PartialEq, Eq, Hash)]
2487        enum __FieldTag {
2488            __parent,
2489            __filter,
2490            __page_size,
2491            __page_token,
2492            Unknown(std::string::String),
2493        }
2494        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2495            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2496            where
2497                D: serde::Deserializer<'de>,
2498            {
2499                struct Visitor;
2500                impl<'de> serde::de::Visitor<'de> for Visitor {
2501                    type Value = __FieldTag;
2502                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2503                        formatter.write_str("a field name for ListCasesRequest")
2504                    }
2505                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2506                    where
2507                        E: serde::de::Error,
2508                    {
2509                        use std::result::Result::Ok;
2510                        use std::string::ToString;
2511                        match value {
2512                            "parent" => Ok(__FieldTag::__parent),
2513                            "filter" => Ok(__FieldTag::__filter),
2514                            "pageSize" => Ok(__FieldTag::__page_size),
2515                            "page_size" => Ok(__FieldTag::__page_size),
2516                            "pageToken" => Ok(__FieldTag::__page_token),
2517                            "page_token" => Ok(__FieldTag::__page_token),
2518                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2519                        }
2520                    }
2521                }
2522                deserializer.deserialize_identifier(Visitor)
2523            }
2524        }
2525        struct Visitor;
2526        impl<'de> serde::de::Visitor<'de> for Visitor {
2527            type Value = ListCasesRequest;
2528            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2529                formatter.write_str("struct ListCasesRequest")
2530            }
2531            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2532            where
2533                A: serde::de::MapAccess<'de>,
2534            {
2535                #[allow(unused_imports)]
2536                use serde::de::Error;
2537                use std::option::Option::Some;
2538                let mut fields = std::collections::HashSet::new();
2539                let mut result = Self::Value::new();
2540                while let Some(tag) = map.next_key::<__FieldTag>()? {
2541                    #[allow(clippy::match_single_binding)]
2542                    match tag {
2543                        __FieldTag::__parent => {
2544                            if !fields.insert(__FieldTag::__parent) {
2545                                return std::result::Result::Err(A::Error::duplicate_field(
2546                                    "multiple values for parent",
2547                                ));
2548                            }
2549                            result.parent = map
2550                                .next_value::<std::option::Option<std::string::String>>()?
2551                                .unwrap_or_default();
2552                        }
2553                        __FieldTag::__filter => {
2554                            if !fields.insert(__FieldTag::__filter) {
2555                                return std::result::Result::Err(A::Error::duplicate_field(
2556                                    "multiple values for filter",
2557                                ));
2558                            }
2559                            result.filter = map
2560                                .next_value::<std::option::Option<std::string::String>>()?
2561                                .unwrap_or_default();
2562                        }
2563                        __FieldTag::__page_size => {
2564                            if !fields.insert(__FieldTag::__page_size) {
2565                                return std::result::Result::Err(A::Error::duplicate_field(
2566                                    "multiple values for page_size",
2567                                ));
2568                            }
2569                            struct __With(std::option::Option<i32>);
2570                            impl<'de> serde::de::Deserialize<'de> for __With {
2571                                fn deserialize<D>(
2572                                    deserializer: D,
2573                                ) -> std::result::Result<Self, D::Error>
2574                                where
2575                                    D: serde::de::Deserializer<'de>,
2576                                {
2577                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2578                                }
2579                            }
2580                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2581                        }
2582                        __FieldTag::__page_token => {
2583                            if !fields.insert(__FieldTag::__page_token) {
2584                                return std::result::Result::Err(A::Error::duplicate_field(
2585                                    "multiple values for page_token",
2586                                ));
2587                            }
2588                            result.page_token = map
2589                                .next_value::<std::option::Option<std::string::String>>()?
2590                                .unwrap_or_default();
2591                        }
2592                        __FieldTag::Unknown(key) => {
2593                            let value = map.next_value::<serde_json::Value>()?;
2594                            result._unknown_fields.insert(key, value);
2595                        }
2596                    }
2597                }
2598                std::result::Result::Ok(result)
2599            }
2600        }
2601        deserializer.deserialize_any(Visitor)
2602    }
2603}
2604
2605#[doc(hidden)]
2606impl serde::ser::Serialize for ListCasesRequest {
2607    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2608    where
2609        S: serde::ser::Serializer,
2610    {
2611        use serde::ser::SerializeMap;
2612        #[allow(unused_imports)]
2613        use std::option::Option::Some;
2614        let mut state = serializer.serialize_map(std::option::Option::None)?;
2615        if !self.parent.is_empty() {
2616            state.serialize_entry("parent", &self.parent)?;
2617        }
2618        if !self.filter.is_empty() {
2619            state.serialize_entry("filter", &self.filter)?;
2620        }
2621        if !wkt::internal::is_default(&self.page_size) {
2622            struct __With<'a>(&'a i32);
2623            impl<'a> serde::ser::Serialize for __With<'a> {
2624                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2625                where
2626                    S: serde::ser::Serializer,
2627                {
2628                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2629                }
2630            }
2631            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2632        }
2633        if !self.page_token.is_empty() {
2634            state.serialize_entry("pageToken", &self.page_token)?;
2635        }
2636        if !self._unknown_fields.is_empty() {
2637            for (key, value) in self._unknown_fields.iter() {
2638                state.serialize_entry(key, &value)?;
2639            }
2640        }
2641        state.end()
2642    }
2643}
2644
2645impl std::fmt::Debug for ListCasesRequest {
2646    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2647        let mut debug_struct = f.debug_struct("ListCasesRequest");
2648        debug_struct.field("parent", &self.parent);
2649        debug_struct.field("filter", &self.filter);
2650        debug_struct.field("page_size", &self.page_size);
2651        debug_struct.field("page_token", &self.page_token);
2652        if !self._unknown_fields.is_empty() {
2653            debug_struct.field("_unknown_fields", &self._unknown_fields);
2654        }
2655        debug_struct.finish()
2656    }
2657}
2658
2659/// The response message for the ListCases endpoint.
2660#[derive(Clone, Default, PartialEq)]
2661#[non_exhaustive]
2662pub struct ListCasesResponse {
2663    /// The list of cases associated with the parent after any
2664    /// filters have been applied.
2665    pub cases: std::vec::Vec<crate::model::Case>,
2666
2667    /// A token to retrieve the next page of results. Set this in the `page_token`
2668    /// field of subsequent `cases.list` requests. If unspecified, there are no
2669    /// more results to retrieve.
2670    pub next_page_token: std::string::String,
2671
2672    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2673}
2674
2675impl ListCasesResponse {
2676    pub fn new() -> Self {
2677        std::default::Default::default()
2678    }
2679
2680    /// Sets the value of [cases][crate::model::ListCasesResponse::cases].
2681    pub fn set_cases<T, V>(mut self, v: T) -> Self
2682    where
2683        T: std::iter::IntoIterator<Item = V>,
2684        V: std::convert::Into<crate::model::Case>,
2685    {
2686        use std::iter::Iterator;
2687        self.cases = v.into_iter().map(|i| i.into()).collect();
2688        self
2689    }
2690
2691    /// Sets the value of [next_page_token][crate::model::ListCasesResponse::next_page_token].
2692    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2693        self.next_page_token = v.into();
2694        self
2695    }
2696}
2697
2698impl wkt::message::Message for ListCasesResponse {
2699    fn typename() -> &'static str {
2700        "type.googleapis.com/google.cloud.support.v2.ListCasesResponse"
2701    }
2702}
2703
2704#[doc(hidden)]
2705impl gax::paginator::internal::PageableResponse for ListCasesResponse {
2706    type PageItem = crate::model::Case;
2707
2708    fn items(self) -> std::vec::Vec<Self::PageItem> {
2709        self.cases
2710    }
2711
2712    fn next_page_token(&self) -> std::string::String {
2713        use std::clone::Clone;
2714        self.next_page_token.clone()
2715    }
2716}
2717
2718#[doc(hidden)]
2719impl<'de> serde::de::Deserialize<'de> for ListCasesResponse {
2720    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2721    where
2722        D: serde::Deserializer<'de>,
2723    {
2724        #[allow(non_camel_case_types)]
2725        #[doc(hidden)]
2726        #[derive(PartialEq, Eq, Hash)]
2727        enum __FieldTag {
2728            __cases,
2729            __next_page_token,
2730            Unknown(std::string::String),
2731        }
2732        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2733            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2734            where
2735                D: serde::Deserializer<'de>,
2736            {
2737                struct Visitor;
2738                impl<'de> serde::de::Visitor<'de> for Visitor {
2739                    type Value = __FieldTag;
2740                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2741                        formatter.write_str("a field name for ListCasesResponse")
2742                    }
2743                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2744                    where
2745                        E: serde::de::Error,
2746                    {
2747                        use std::result::Result::Ok;
2748                        use std::string::ToString;
2749                        match value {
2750                            "cases" => Ok(__FieldTag::__cases),
2751                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2752                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2753                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2754                        }
2755                    }
2756                }
2757                deserializer.deserialize_identifier(Visitor)
2758            }
2759        }
2760        struct Visitor;
2761        impl<'de> serde::de::Visitor<'de> for Visitor {
2762            type Value = ListCasesResponse;
2763            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2764                formatter.write_str("struct ListCasesResponse")
2765            }
2766            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2767            where
2768                A: serde::de::MapAccess<'de>,
2769            {
2770                #[allow(unused_imports)]
2771                use serde::de::Error;
2772                use std::option::Option::Some;
2773                let mut fields = std::collections::HashSet::new();
2774                let mut result = Self::Value::new();
2775                while let Some(tag) = map.next_key::<__FieldTag>()? {
2776                    #[allow(clippy::match_single_binding)]
2777                    match tag {
2778                        __FieldTag::__cases => {
2779                            if !fields.insert(__FieldTag::__cases) {
2780                                return std::result::Result::Err(A::Error::duplicate_field(
2781                                    "multiple values for cases",
2782                                ));
2783                            }
2784                            result.cases = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Case>>>()?.unwrap_or_default();
2785                        }
2786                        __FieldTag::__next_page_token => {
2787                            if !fields.insert(__FieldTag::__next_page_token) {
2788                                return std::result::Result::Err(A::Error::duplicate_field(
2789                                    "multiple values for next_page_token",
2790                                ));
2791                            }
2792                            result.next_page_token = map
2793                                .next_value::<std::option::Option<std::string::String>>()?
2794                                .unwrap_or_default();
2795                        }
2796                        __FieldTag::Unknown(key) => {
2797                            let value = map.next_value::<serde_json::Value>()?;
2798                            result._unknown_fields.insert(key, value);
2799                        }
2800                    }
2801                }
2802                std::result::Result::Ok(result)
2803            }
2804        }
2805        deserializer.deserialize_any(Visitor)
2806    }
2807}
2808
2809#[doc(hidden)]
2810impl serde::ser::Serialize for ListCasesResponse {
2811    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2812    where
2813        S: serde::ser::Serializer,
2814    {
2815        use serde::ser::SerializeMap;
2816        #[allow(unused_imports)]
2817        use std::option::Option::Some;
2818        let mut state = serializer.serialize_map(std::option::Option::None)?;
2819        if !self.cases.is_empty() {
2820            state.serialize_entry("cases", &self.cases)?;
2821        }
2822        if !self.next_page_token.is_empty() {
2823            state.serialize_entry("nextPageToken", &self.next_page_token)?;
2824        }
2825        if !self._unknown_fields.is_empty() {
2826            for (key, value) in self._unknown_fields.iter() {
2827                state.serialize_entry(key, &value)?;
2828            }
2829        }
2830        state.end()
2831    }
2832}
2833
2834impl std::fmt::Debug for ListCasesResponse {
2835    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2836        let mut debug_struct = f.debug_struct("ListCasesResponse");
2837        debug_struct.field("cases", &self.cases);
2838        debug_struct.field("next_page_token", &self.next_page_token);
2839        if !self._unknown_fields.is_empty() {
2840            debug_struct.field("_unknown_fields", &self._unknown_fields);
2841        }
2842        debug_struct.finish()
2843    }
2844}
2845
2846/// The request message for the SearchCases endpoint.
2847#[derive(Clone, Default, PartialEq)]
2848#[non_exhaustive]
2849pub struct SearchCasesRequest {
2850    /// The name of the parent resource to search for cases under.
2851    pub parent: std::string::String,
2852
2853    /// An expression used to filter cases.
2854    ///
2855    /// Expressions use the following fields separated by `AND` and specified with
2856    /// `=`:
2857    ///
2858    /// - `organization`: An organization name in the form
2859    ///   `organizations/<organization_id>`.
2860    /// - `project`: A project name in the form `projects/<project_id>`.
2861    /// - `state`: Can be `OPEN` or `CLOSED`.
2862    /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
2863    ///   can specify multiple values for priority using the `OR` operator. For
2864    ///   example, `priority=P1 OR priority=P2`.
2865    /// - `creator.email`: The email address of the case creator.
2866    ///
2867    /// You must specify either `organization` or `project`.
2868    ///
2869    /// To search across `displayName`, `description`, and comments, use a global
2870    /// restriction with no keyword or operator. For example, `"my search"`.
2871    ///
2872    /// To search only cases updated after a certain date, use `update_time`
2873    /// restricted with that particular date, time, and timezone in ISO datetime
2874    /// format. For example, `update_time>"2020-01-01T00:00:00-05:00"`.
2875    /// `update_time` only supports the greater than operator (`>`).
2876    ///
2877    /// Examples:
2878    ///
2879    /// - `organization="organizations/123456789"`
2880    /// - `project="projects/my-project-id"`
2881    /// - `project="projects/123456789"`
2882    /// - `organization="organizations/123456789" AND state=CLOSED`
2883    /// - `project="projects/my-project-id" AND creator.email="tester@example.com"`
2884    /// - `project="projects/my-project-id" AND (priority=P0 OR priority=P1)`
2885    pub query: std::string::String,
2886
2887    /// The maximum number of cases fetched with each request. The default page
2888    /// size is 10.
2889    pub page_size: i32,
2890
2891    /// A token identifying the page of results to return. If unspecified, the
2892    /// first page is retrieved.
2893    pub page_token: std::string::String,
2894
2895    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2896}
2897
2898impl SearchCasesRequest {
2899    pub fn new() -> Self {
2900        std::default::Default::default()
2901    }
2902
2903    /// Sets the value of [parent][crate::model::SearchCasesRequest::parent].
2904    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2905        self.parent = v.into();
2906        self
2907    }
2908
2909    /// Sets the value of [query][crate::model::SearchCasesRequest::query].
2910    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2911        self.query = v.into();
2912        self
2913    }
2914
2915    /// Sets the value of [page_size][crate::model::SearchCasesRequest::page_size].
2916    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2917        self.page_size = v.into();
2918        self
2919    }
2920
2921    /// Sets the value of [page_token][crate::model::SearchCasesRequest::page_token].
2922    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2923        self.page_token = v.into();
2924        self
2925    }
2926}
2927
2928impl wkt::message::Message for SearchCasesRequest {
2929    fn typename() -> &'static str {
2930        "type.googleapis.com/google.cloud.support.v2.SearchCasesRequest"
2931    }
2932}
2933
2934#[doc(hidden)]
2935impl<'de> serde::de::Deserialize<'de> for SearchCasesRequest {
2936    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2937    where
2938        D: serde::Deserializer<'de>,
2939    {
2940        #[allow(non_camel_case_types)]
2941        #[doc(hidden)]
2942        #[derive(PartialEq, Eq, Hash)]
2943        enum __FieldTag {
2944            __parent,
2945            __query,
2946            __page_size,
2947            __page_token,
2948            Unknown(std::string::String),
2949        }
2950        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2951            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2952            where
2953                D: serde::Deserializer<'de>,
2954            {
2955                struct Visitor;
2956                impl<'de> serde::de::Visitor<'de> for Visitor {
2957                    type Value = __FieldTag;
2958                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2959                        formatter.write_str("a field name for SearchCasesRequest")
2960                    }
2961                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2962                    where
2963                        E: serde::de::Error,
2964                    {
2965                        use std::result::Result::Ok;
2966                        use std::string::ToString;
2967                        match value {
2968                            "parent" => Ok(__FieldTag::__parent),
2969                            "query" => Ok(__FieldTag::__query),
2970                            "pageSize" => Ok(__FieldTag::__page_size),
2971                            "page_size" => Ok(__FieldTag::__page_size),
2972                            "pageToken" => Ok(__FieldTag::__page_token),
2973                            "page_token" => Ok(__FieldTag::__page_token),
2974                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2975                        }
2976                    }
2977                }
2978                deserializer.deserialize_identifier(Visitor)
2979            }
2980        }
2981        struct Visitor;
2982        impl<'de> serde::de::Visitor<'de> for Visitor {
2983            type Value = SearchCasesRequest;
2984            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2985                formatter.write_str("struct SearchCasesRequest")
2986            }
2987            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2988            where
2989                A: serde::de::MapAccess<'de>,
2990            {
2991                #[allow(unused_imports)]
2992                use serde::de::Error;
2993                use std::option::Option::Some;
2994                let mut fields = std::collections::HashSet::new();
2995                let mut result = Self::Value::new();
2996                while let Some(tag) = map.next_key::<__FieldTag>()? {
2997                    #[allow(clippy::match_single_binding)]
2998                    match tag {
2999                        __FieldTag::__parent => {
3000                            if !fields.insert(__FieldTag::__parent) {
3001                                return std::result::Result::Err(A::Error::duplicate_field(
3002                                    "multiple values for parent",
3003                                ));
3004                            }
3005                            result.parent = map
3006                                .next_value::<std::option::Option<std::string::String>>()?
3007                                .unwrap_or_default();
3008                        }
3009                        __FieldTag::__query => {
3010                            if !fields.insert(__FieldTag::__query) {
3011                                return std::result::Result::Err(A::Error::duplicate_field(
3012                                    "multiple values for query",
3013                                ));
3014                            }
3015                            result.query = map
3016                                .next_value::<std::option::Option<std::string::String>>()?
3017                                .unwrap_or_default();
3018                        }
3019                        __FieldTag::__page_size => {
3020                            if !fields.insert(__FieldTag::__page_size) {
3021                                return std::result::Result::Err(A::Error::duplicate_field(
3022                                    "multiple values for page_size",
3023                                ));
3024                            }
3025                            struct __With(std::option::Option<i32>);
3026                            impl<'de> serde::de::Deserialize<'de> for __With {
3027                                fn deserialize<D>(
3028                                    deserializer: D,
3029                                ) -> std::result::Result<Self, D::Error>
3030                                where
3031                                    D: serde::de::Deserializer<'de>,
3032                                {
3033                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3034                                }
3035                            }
3036                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3037                        }
3038                        __FieldTag::__page_token => {
3039                            if !fields.insert(__FieldTag::__page_token) {
3040                                return std::result::Result::Err(A::Error::duplicate_field(
3041                                    "multiple values for page_token",
3042                                ));
3043                            }
3044                            result.page_token = map
3045                                .next_value::<std::option::Option<std::string::String>>()?
3046                                .unwrap_or_default();
3047                        }
3048                        __FieldTag::Unknown(key) => {
3049                            let value = map.next_value::<serde_json::Value>()?;
3050                            result._unknown_fields.insert(key, value);
3051                        }
3052                    }
3053                }
3054                std::result::Result::Ok(result)
3055            }
3056        }
3057        deserializer.deserialize_any(Visitor)
3058    }
3059}
3060
3061#[doc(hidden)]
3062impl serde::ser::Serialize for SearchCasesRequest {
3063    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3064    where
3065        S: serde::ser::Serializer,
3066    {
3067        use serde::ser::SerializeMap;
3068        #[allow(unused_imports)]
3069        use std::option::Option::Some;
3070        let mut state = serializer.serialize_map(std::option::Option::None)?;
3071        if !self.parent.is_empty() {
3072            state.serialize_entry("parent", &self.parent)?;
3073        }
3074        if !self.query.is_empty() {
3075            state.serialize_entry("query", &self.query)?;
3076        }
3077        if !wkt::internal::is_default(&self.page_size) {
3078            struct __With<'a>(&'a i32);
3079            impl<'a> serde::ser::Serialize for __With<'a> {
3080                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3081                where
3082                    S: serde::ser::Serializer,
3083                {
3084                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3085                }
3086            }
3087            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3088        }
3089        if !self.page_token.is_empty() {
3090            state.serialize_entry("pageToken", &self.page_token)?;
3091        }
3092        if !self._unknown_fields.is_empty() {
3093            for (key, value) in self._unknown_fields.iter() {
3094                state.serialize_entry(key, &value)?;
3095            }
3096        }
3097        state.end()
3098    }
3099}
3100
3101impl std::fmt::Debug for SearchCasesRequest {
3102    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3103        let mut debug_struct = f.debug_struct("SearchCasesRequest");
3104        debug_struct.field("parent", &self.parent);
3105        debug_struct.field("query", &self.query);
3106        debug_struct.field("page_size", &self.page_size);
3107        debug_struct.field("page_token", &self.page_token);
3108        if !self._unknown_fields.is_empty() {
3109            debug_struct.field("_unknown_fields", &self._unknown_fields);
3110        }
3111        debug_struct.finish()
3112    }
3113}
3114
3115/// The response message for the SearchCases endpoint.
3116#[derive(Clone, Default, PartialEq)]
3117#[non_exhaustive]
3118pub struct SearchCasesResponse {
3119    /// The list of cases associated with the parent after any
3120    /// filters have been applied.
3121    pub cases: std::vec::Vec<crate::model::Case>,
3122
3123    /// A token to retrieve the next page of results. Set this in the
3124    /// `page_token` field of subsequent `cases.search` requests. If unspecified,
3125    /// there are no more results to retrieve.
3126    pub next_page_token: std::string::String,
3127
3128    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3129}
3130
3131impl SearchCasesResponse {
3132    pub fn new() -> Self {
3133        std::default::Default::default()
3134    }
3135
3136    /// Sets the value of [cases][crate::model::SearchCasesResponse::cases].
3137    pub fn set_cases<T, V>(mut self, v: T) -> Self
3138    where
3139        T: std::iter::IntoIterator<Item = V>,
3140        V: std::convert::Into<crate::model::Case>,
3141    {
3142        use std::iter::Iterator;
3143        self.cases = v.into_iter().map(|i| i.into()).collect();
3144        self
3145    }
3146
3147    /// Sets the value of [next_page_token][crate::model::SearchCasesResponse::next_page_token].
3148    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3149        self.next_page_token = v.into();
3150        self
3151    }
3152}
3153
3154impl wkt::message::Message for SearchCasesResponse {
3155    fn typename() -> &'static str {
3156        "type.googleapis.com/google.cloud.support.v2.SearchCasesResponse"
3157    }
3158}
3159
3160#[doc(hidden)]
3161impl gax::paginator::internal::PageableResponse for SearchCasesResponse {
3162    type PageItem = crate::model::Case;
3163
3164    fn items(self) -> std::vec::Vec<Self::PageItem> {
3165        self.cases
3166    }
3167
3168    fn next_page_token(&self) -> std::string::String {
3169        use std::clone::Clone;
3170        self.next_page_token.clone()
3171    }
3172}
3173
3174#[doc(hidden)]
3175impl<'de> serde::de::Deserialize<'de> for SearchCasesResponse {
3176    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3177    where
3178        D: serde::Deserializer<'de>,
3179    {
3180        #[allow(non_camel_case_types)]
3181        #[doc(hidden)]
3182        #[derive(PartialEq, Eq, Hash)]
3183        enum __FieldTag {
3184            __cases,
3185            __next_page_token,
3186            Unknown(std::string::String),
3187        }
3188        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3189            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3190            where
3191                D: serde::Deserializer<'de>,
3192            {
3193                struct Visitor;
3194                impl<'de> serde::de::Visitor<'de> for Visitor {
3195                    type Value = __FieldTag;
3196                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3197                        formatter.write_str("a field name for SearchCasesResponse")
3198                    }
3199                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3200                    where
3201                        E: serde::de::Error,
3202                    {
3203                        use std::result::Result::Ok;
3204                        use std::string::ToString;
3205                        match value {
3206                            "cases" => Ok(__FieldTag::__cases),
3207                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3208                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3209                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3210                        }
3211                    }
3212                }
3213                deserializer.deserialize_identifier(Visitor)
3214            }
3215        }
3216        struct Visitor;
3217        impl<'de> serde::de::Visitor<'de> for Visitor {
3218            type Value = SearchCasesResponse;
3219            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3220                formatter.write_str("struct SearchCasesResponse")
3221            }
3222            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3223            where
3224                A: serde::de::MapAccess<'de>,
3225            {
3226                #[allow(unused_imports)]
3227                use serde::de::Error;
3228                use std::option::Option::Some;
3229                let mut fields = std::collections::HashSet::new();
3230                let mut result = Self::Value::new();
3231                while let Some(tag) = map.next_key::<__FieldTag>()? {
3232                    #[allow(clippy::match_single_binding)]
3233                    match tag {
3234                        __FieldTag::__cases => {
3235                            if !fields.insert(__FieldTag::__cases) {
3236                                return std::result::Result::Err(A::Error::duplicate_field(
3237                                    "multiple values for cases",
3238                                ));
3239                            }
3240                            result.cases = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Case>>>()?.unwrap_or_default();
3241                        }
3242                        __FieldTag::__next_page_token => {
3243                            if !fields.insert(__FieldTag::__next_page_token) {
3244                                return std::result::Result::Err(A::Error::duplicate_field(
3245                                    "multiple values for next_page_token",
3246                                ));
3247                            }
3248                            result.next_page_token = map
3249                                .next_value::<std::option::Option<std::string::String>>()?
3250                                .unwrap_or_default();
3251                        }
3252                        __FieldTag::Unknown(key) => {
3253                            let value = map.next_value::<serde_json::Value>()?;
3254                            result._unknown_fields.insert(key, value);
3255                        }
3256                    }
3257                }
3258                std::result::Result::Ok(result)
3259            }
3260        }
3261        deserializer.deserialize_any(Visitor)
3262    }
3263}
3264
3265#[doc(hidden)]
3266impl serde::ser::Serialize for SearchCasesResponse {
3267    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3268    where
3269        S: serde::ser::Serializer,
3270    {
3271        use serde::ser::SerializeMap;
3272        #[allow(unused_imports)]
3273        use std::option::Option::Some;
3274        let mut state = serializer.serialize_map(std::option::Option::None)?;
3275        if !self.cases.is_empty() {
3276            state.serialize_entry("cases", &self.cases)?;
3277        }
3278        if !self.next_page_token.is_empty() {
3279            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3280        }
3281        if !self._unknown_fields.is_empty() {
3282            for (key, value) in self._unknown_fields.iter() {
3283                state.serialize_entry(key, &value)?;
3284            }
3285        }
3286        state.end()
3287    }
3288}
3289
3290impl std::fmt::Debug for SearchCasesResponse {
3291    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3292        let mut debug_struct = f.debug_struct("SearchCasesResponse");
3293        debug_struct.field("cases", &self.cases);
3294        debug_struct.field("next_page_token", &self.next_page_token);
3295        if !self._unknown_fields.is_empty() {
3296            debug_struct.field("_unknown_fields", &self._unknown_fields);
3297        }
3298        debug_struct.finish()
3299    }
3300}
3301
3302/// The request message for the EscalateCase endpoint.
3303#[derive(Clone, Default, PartialEq)]
3304#[non_exhaustive]
3305pub struct EscalateCaseRequest {
3306    /// Required. The name of the case to be escalated.
3307    pub name: std::string::String,
3308
3309    /// The escalation information to be sent with the escalation request.
3310    pub escalation: std::option::Option<crate::model::Escalation>,
3311
3312    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3313}
3314
3315impl EscalateCaseRequest {
3316    pub fn new() -> Self {
3317        std::default::Default::default()
3318    }
3319
3320    /// Sets the value of [name][crate::model::EscalateCaseRequest::name].
3321    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3322        self.name = v.into();
3323        self
3324    }
3325
3326    /// Sets the value of [escalation][crate::model::EscalateCaseRequest::escalation].
3327    pub fn set_escalation<T>(mut self, v: T) -> Self
3328    where
3329        T: std::convert::Into<crate::model::Escalation>,
3330    {
3331        self.escalation = std::option::Option::Some(v.into());
3332        self
3333    }
3334
3335    /// Sets or clears the value of [escalation][crate::model::EscalateCaseRequest::escalation].
3336    pub fn set_or_clear_escalation<T>(mut self, v: std::option::Option<T>) -> Self
3337    where
3338        T: std::convert::Into<crate::model::Escalation>,
3339    {
3340        self.escalation = v.map(|x| x.into());
3341        self
3342    }
3343}
3344
3345impl wkt::message::Message for EscalateCaseRequest {
3346    fn typename() -> &'static str {
3347        "type.googleapis.com/google.cloud.support.v2.EscalateCaseRequest"
3348    }
3349}
3350
3351#[doc(hidden)]
3352impl<'de> serde::de::Deserialize<'de> for EscalateCaseRequest {
3353    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3354    where
3355        D: serde::Deserializer<'de>,
3356    {
3357        #[allow(non_camel_case_types)]
3358        #[doc(hidden)]
3359        #[derive(PartialEq, Eq, Hash)]
3360        enum __FieldTag {
3361            __name,
3362            __escalation,
3363            Unknown(std::string::String),
3364        }
3365        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3366            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3367            where
3368                D: serde::Deserializer<'de>,
3369            {
3370                struct Visitor;
3371                impl<'de> serde::de::Visitor<'de> for Visitor {
3372                    type Value = __FieldTag;
3373                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3374                        formatter.write_str("a field name for EscalateCaseRequest")
3375                    }
3376                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3377                    where
3378                        E: serde::de::Error,
3379                    {
3380                        use std::result::Result::Ok;
3381                        use std::string::ToString;
3382                        match value {
3383                            "name" => Ok(__FieldTag::__name),
3384                            "escalation" => Ok(__FieldTag::__escalation),
3385                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3386                        }
3387                    }
3388                }
3389                deserializer.deserialize_identifier(Visitor)
3390            }
3391        }
3392        struct Visitor;
3393        impl<'de> serde::de::Visitor<'de> for Visitor {
3394            type Value = EscalateCaseRequest;
3395            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3396                formatter.write_str("struct EscalateCaseRequest")
3397            }
3398            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3399            where
3400                A: serde::de::MapAccess<'de>,
3401            {
3402                #[allow(unused_imports)]
3403                use serde::de::Error;
3404                use std::option::Option::Some;
3405                let mut fields = std::collections::HashSet::new();
3406                let mut result = Self::Value::new();
3407                while let Some(tag) = map.next_key::<__FieldTag>()? {
3408                    #[allow(clippy::match_single_binding)]
3409                    match tag {
3410                        __FieldTag::__name => {
3411                            if !fields.insert(__FieldTag::__name) {
3412                                return std::result::Result::Err(A::Error::duplicate_field(
3413                                    "multiple values for name",
3414                                ));
3415                            }
3416                            result.name = map
3417                                .next_value::<std::option::Option<std::string::String>>()?
3418                                .unwrap_or_default();
3419                        }
3420                        __FieldTag::__escalation => {
3421                            if !fields.insert(__FieldTag::__escalation) {
3422                                return std::result::Result::Err(A::Error::duplicate_field(
3423                                    "multiple values for escalation",
3424                                ));
3425                            }
3426                            result.escalation =
3427                                map.next_value::<std::option::Option<crate::model::Escalation>>()?;
3428                        }
3429                        __FieldTag::Unknown(key) => {
3430                            let value = map.next_value::<serde_json::Value>()?;
3431                            result._unknown_fields.insert(key, value);
3432                        }
3433                    }
3434                }
3435                std::result::Result::Ok(result)
3436            }
3437        }
3438        deserializer.deserialize_any(Visitor)
3439    }
3440}
3441
3442#[doc(hidden)]
3443impl serde::ser::Serialize for EscalateCaseRequest {
3444    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3445    where
3446        S: serde::ser::Serializer,
3447    {
3448        use serde::ser::SerializeMap;
3449        #[allow(unused_imports)]
3450        use std::option::Option::Some;
3451        let mut state = serializer.serialize_map(std::option::Option::None)?;
3452        if !self.name.is_empty() {
3453            state.serialize_entry("name", &self.name)?;
3454        }
3455        if self.escalation.is_some() {
3456            state.serialize_entry("escalation", &self.escalation)?;
3457        }
3458        if !self._unknown_fields.is_empty() {
3459            for (key, value) in self._unknown_fields.iter() {
3460                state.serialize_entry(key, &value)?;
3461            }
3462        }
3463        state.end()
3464    }
3465}
3466
3467impl std::fmt::Debug for EscalateCaseRequest {
3468    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3469        let mut debug_struct = f.debug_struct("EscalateCaseRequest");
3470        debug_struct.field("name", &self.name);
3471        debug_struct.field("escalation", &self.escalation);
3472        if !self._unknown_fields.is_empty() {
3473            debug_struct.field("_unknown_fields", &self._unknown_fields);
3474        }
3475        debug_struct.finish()
3476    }
3477}
3478
3479/// The request message for the UpdateCase endpoint
3480#[derive(Clone, Default, PartialEq)]
3481#[non_exhaustive]
3482pub struct UpdateCaseRequest {
3483    /// Required. The case to update.
3484    pub case: std::option::Option<crate::model::Case>,
3485
3486    /// A list of attributes of the case that should be updated. Supported values
3487    /// are `priority`, `display_name`, and `subscriber_email_addresses`. If no
3488    /// fields are specified, all supported fields are updated.
3489    ///
3490    /// Be careful - if you do not provide a field mask, then you might
3491    /// accidentally clear some fields. For example, if you leave the field mask
3492    /// empty and do not provide a value for `subscriber_email_addresses`, then
3493    /// `subscriber_email_addresses` is updated to empty.
3494    pub update_mask: std::option::Option<wkt::FieldMask>,
3495
3496    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3497}
3498
3499impl UpdateCaseRequest {
3500    pub fn new() -> Self {
3501        std::default::Default::default()
3502    }
3503
3504    /// Sets the value of [case][crate::model::UpdateCaseRequest::case].
3505    pub fn set_case<T>(mut self, v: T) -> Self
3506    where
3507        T: std::convert::Into<crate::model::Case>,
3508    {
3509        self.case = std::option::Option::Some(v.into());
3510        self
3511    }
3512
3513    /// Sets or clears the value of [case][crate::model::UpdateCaseRequest::case].
3514    pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
3515    where
3516        T: std::convert::Into<crate::model::Case>,
3517    {
3518        self.case = v.map(|x| x.into());
3519        self
3520    }
3521
3522    /// Sets the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
3523    pub fn set_update_mask<T>(mut self, v: T) -> Self
3524    where
3525        T: std::convert::Into<wkt::FieldMask>,
3526    {
3527        self.update_mask = std::option::Option::Some(v.into());
3528        self
3529    }
3530
3531    /// Sets or clears the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
3532    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3533    where
3534        T: std::convert::Into<wkt::FieldMask>,
3535    {
3536        self.update_mask = v.map(|x| x.into());
3537        self
3538    }
3539}
3540
3541impl wkt::message::Message for UpdateCaseRequest {
3542    fn typename() -> &'static str {
3543        "type.googleapis.com/google.cloud.support.v2.UpdateCaseRequest"
3544    }
3545}
3546
3547#[doc(hidden)]
3548impl<'de> serde::de::Deserialize<'de> for UpdateCaseRequest {
3549    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3550    where
3551        D: serde::Deserializer<'de>,
3552    {
3553        #[allow(non_camel_case_types)]
3554        #[doc(hidden)]
3555        #[derive(PartialEq, Eq, Hash)]
3556        enum __FieldTag {
3557            __case,
3558            __update_mask,
3559            Unknown(std::string::String),
3560        }
3561        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3562            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3563            where
3564                D: serde::Deserializer<'de>,
3565            {
3566                struct Visitor;
3567                impl<'de> serde::de::Visitor<'de> for Visitor {
3568                    type Value = __FieldTag;
3569                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3570                        formatter.write_str("a field name for UpdateCaseRequest")
3571                    }
3572                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3573                    where
3574                        E: serde::de::Error,
3575                    {
3576                        use std::result::Result::Ok;
3577                        use std::string::ToString;
3578                        match value {
3579                            "case" => Ok(__FieldTag::__case),
3580                            "updateMask" => Ok(__FieldTag::__update_mask),
3581                            "update_mask" => Ok(__FieldTag::__update_mask),
3582                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3583                        }
3584                    }
3585                }
3586                deserializer.deserialize_identifier(Visitor)
3587            }
3588        }
3589        struct Visitor;
3590        impl<'de> serde::de::Visitor<'de> for Visitor {
3591            type Value = UpdateCaseRequest;
3592            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3593                formatter.write_str("struct UpdateCaseRequest")
3594            }
3595            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3596            where
3597                A: serde::de::MapAccess<'de>,
3598            {
3599                #[allow(unused_imports)]
3600                use serde::de::Error;
3601                use std::option::Option::Some;
3602                let mut fields = std::collections::HashSet::new();
3603                let mut result = Self::Value::new();
3604                while let Some(tag) = map.next_key::<__FieldTag>()? {
3605                    #[allow(clippy::match_single_binding)]
3606                    match tag {
3607                        __FieldTag::__case => {
3608                            if !fields.insert(__FieldTag::__case) {
3609                                return std::result::Result::Err(A::Error::duplicate_field(
3610                                    "multiple values for case",
3611                                ));
3612                            }
3613                            result.case =
3614                                map.next_value::<std::option::Option<crate::model::Case>>()?;
3615                        }
3616                        __FieldTag::__update_mask => {
3617                            if !fields.insert(__FieldTag::__update_mask) {
3618                                return std::result::Result::Err(A::Error::duplicate_field(
3619                                    "multiple values for update_mask",
3620                                ));
3621                            }
3622                            result.update_mask =
3623                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
3624                        }
3625                        __FieldTag::Unknown(key) => {
3626                            let value = map.next_value::<serde_json::Value>()?;
3627                            result._unknown_fields.insert(key, value);
3628                        }
3629                    }
3630                }
3631                std::result::Result::Ok(result)
3632            }
3633        }
3634        deserializer.deserialize_any(Visitor)
3635    }
3636}
3637
3638#[doc(hidden)]
3639impl serde::ser::Serialize for UpdateCaseRequest {
3640    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3641    where
3642        S: serde::ser::Serializer,
3643    {
3644        use serde::ser::SerializeMap;
3645        #[allow(unused_imports)]
3646        use std::option::Option::Some;
3647        let mut state = serializer.serialize_map(std::option::Option::None)?;
3648        if self.case.is_some() {
3649            state.serialize_entry("case", &self.case)?;
3650        }
3651        if self.update_mask.is_some() {
3652            state.serialize_entry("updateMask", &self.update_mask)?;
3653        }
3654        if !self._unknown_fields.is_empty() {
3655            for (key, value) in self._unknown_fields.iter() {
3656                state.serialize_entry(key, &value)?;
3657            }
3658        }
3659        state.end()
3660    }
3661}
3662
3663impl std::fmt::Debug for UpdateCaseRequest {
3664    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3665        let mut debug_struct = f.debug_struct("UpdateCaseRequest");
3666        debug_struct.field("case", &self.case);
3667        debug_struct.field("update_mask", &self.update_mask);
3668        if !self._unknown_fields.is_empty() {
3669            debug_struct.field("_unknown_fields", &self._unknown_fields);
3670        }
3671        debug_struct.finish()
3672    }
3673}
3674
3675/// The request message for the CloseCase endpoint.
3676#[derive(Clone, Default, PartialEq)]
3677#[non_exhaustive]
3678pub struct CloseCaseRequest {
3679    /// Required. The name of the case to close.
3680    pub name: std::string::String,
3681
3682    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3683}
3684
3685impl CloseCaseRequest {
3686    pub fn new() -> Self {
3687        std::default::Default::default()
3688    }
3689
3690    /// Sets the value of [name][crate::model::CloseCaseRequest::name].
3691    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3692        self.name = v.into();
3693        self
3694    }
3695}
3696
3697impl wkt::message::Message for CloseCaseRequest {
3698    fn typename() -> &'static str {
3699        "type.googleapis.com/google.cloud.support.v2.CloseCaseRequest"
3700    }
3701}
3702
3703#[doc(hidden)]
3704impl<'de> serde::de::Deserialize<'de> for CloseCaseRequest {
3705    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3706    where
3707        D: serde::Deserializer<'de>,
3708    {
3709        #[allow(non_camel_case_types)]
3710        #[doc(hidden)]
3711        #[derive(PartialEq, Eq, Hash)]
3712        enum __FieldTag {
3713            __name,
3714            Unknown(std::string::String),
3715        }
3716        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3717            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3718            where
3719                D: serde::Deserializer<'de>,
3720            {
3721                struct Visitor;
3722                impl<'de> serde::de::Visitor<'de> for Visitor {
3723                    type Value = __FieldTag;
3724                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3725                        formatter.write_str("a field name for CloseCaseRequest")
3726                    }
3727                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3728                    where
3729                        E: serde::de::Error,
3730                    {
3731                        use std::result::Result::Ok;
3732                        use std::string::ToString;
3733                        match value {
3734                            "name" => Ok(__FieldTag::__name),
3735                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3736                        }
3737                    }
3738                }
3739                deserializer.deserialize_identifier(Visitor)
3740            }
3741        }
3742        struct Visitor;
3743        impl<'de> serde::de::Visitor<'de> for Visitor {
3744            type Value = CloseCaseRequest;
3745            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3746                formatter.write_str("struct CloseCaseRequest")
3747            }
3748            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3749            where
3750                A: serde::de::MapAccess<'de>,
3751            {
3752                #[allow(unused_imports)]
3753                use serde::de::Error;
3754                use std::option::Option::Some;
3755                let mut fields = std::collections::HashSet::new();
3756                let mut result = Self::Value::new();
3757                while let Some(tag) = map.next_key::<__FieldTag>()? {
3758                    #[allow(clippy::match_single_binding)]
3759                    match tag {
3760                        __FieldTag::__name => {
3761                            if !fields.insert(__FieldTag::__name) {
3762                                return std::result::Result::Err(A::Error::duplicate_field(
3763                                    "multiple values for name",
3764                                ));
3765                            }
3766                            result.name = map
3767                                .next_value::<std::option::Option<std::string::String>>()?
3768                                .unwrap_or_default();
3769                        }
3770                        __FieldTag::Unknown(key) => {
3771                            let value = map.next_value::<serde_json::Value>()?;
3772                            result._unknown_fields.insert(key, value);
3773                        }
3774                    }
3775                }
3776                std::result::Result::Ok(result)
3777            }
3778        }
3779        deserializer.deserialize_any(Visitor)
3780    }
3781}
3782
3783#[doc(hidden)]
3784impl serde::ser::Serialize for CloseCaseRequest {
3785    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3786    where
3787        S: serde::ser::Serializer,
3788    {
3789        use serde::ser::SerializeMap;
3790        #[allow(unused_imports)]
3791        use std::option::Option::Some;
3792        let mut state = serializer.serialize_map(std::option::Option::None)?;
3793        if !self.name.is_empty() {
3794            state.serialize_entry("name", &self.name)?;
3795        }
3796        if !self._unknown_fields.is_empty() {
3797            for (key, value) in self._unknown_fields.iter() {
3798                state.serialize_entry(key, &value)?;
3799            }
3800        }
3801        state.end()
3802    }
3803}
3804
3805impl std::fmt::Debug for CloseCaseRequest {
3806    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3807        let mut debug_struct = f.debug_struct("CloseCaseRequest");
3808        debug_struct.field("name", &self.name);
3809        if !self._unknown_fields.is_empty() {
3810            debug_struct.field("_unknown_fields", &self._unknown_fields);
3811        }
3812        debug_struct.finish()
3813    }
3814}
3815
3816/// The request message for the SearchCaseClassifications endpoint.
3817#[derive(Clone, Default, PartialEq)]
3818#[non_exhaustive]
3819pub struct SearchCaseClassificationsRequest {
3820    /// An expression used to filter case classifications.
3821    ///
3822    /// If it's an empty string, then no filtering happens. Otherwise, case
3823    /// classifications will be returned that match the filter.
3824    pub query: std::string::String,
3825
3826    /// The maximum number of classifications fetched with each request.
3827    pub page_size: i32,
3828
3829    /// A token identifying the page of results to return. If unspecified, the
3830    /// first page is retrieved.
3831    pub page_token: std::string::String,
3832
3833    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3834}
3835
3836impl SearchCaseClassificationsRequest {
3837    pub fn new() -> Self {
3838        std::default::Default::default()
3839    }
3840
3841    /// Sets the value of [query][crate::model::SearchCaseClassificationsRequest::query].
3842    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3843        self.query = v.into();
3844        self
3845    }
3846
3847    /// Sets the value of [page_size][crate::model::SearchCaseClassificationsRequest::page_size].
3848    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3849        self.page_size = v.into();
3850        self
3851    }
3852
3853    /// Sets the value of [page_token][crate::model::SearchCaseClassificationsRequest::page_token].
3854    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3855        self.page_token = v.into();
3856        self
3857    }
3858}
3859
3860impl wkt::message::Message for SearchCaseClassificationsRequest {
3861    fn typename() -> &'static str {
3862        "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsRequest"
3863    }
3864}
3865
3866#[doc(hidden)]
3867impl<'de> serde::de::Deserialize<'de> for SearchCaseClassificationsRequest {
3868    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3869    where
3870        D: serde::Deserializer<'de>,
3871    {
3872        #[allow(non_camel_case_types)]
3873        #[doc(hidden)]
3874        #[derive(PartialEq, Eq, Hash)]
3875        enum __FieldTag {
3876            __query,
3877            __page_size,
3878            __page_token,
3879            Unknown(std::string::String),
3880        }
3881        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3882            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3883            where
3884                D: serde::Deserializer<'de>,
3885            {
3886                struct Visitor;
3887                impl<'de> serde::de::Visitor<'de> for Visitor {
3888                    type Value = __FieldTag;
3889                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3890                        formatter.write_str("a field name for SearchCaseClassificationsRequest")
3891                    }
3892                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3893                    where
3894                        E: serde::de::Error,
3895                    {
3896                        use std::result::Result::Ok;
3897                        use std::string::ToString;
3898                        match value {
3899                            "query" => Ok(__FieldTag::__query),
3900                            "pageSize" => Ok(__FieldTag::__page_size),
3901                            "page_size" => Ok(__FieldTag::__page_size),
3902                            "pageToken" => Ok(__FieldTag::__page_token),
3903                            "page_token" => Ok(__FieldTag::__page_token),
3904                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3905                        }
3906                    }
3907                }
3908                deserializer.deserialize_identifier(Visitor)
3909            }
3910        }
3911        struct Visitor;
3912        impl<'de> serde::de::Visitor<'de> for Visitor {
3913            type Value = SearchCaseClassificationsRequest;
3914            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3915                formatter.write_str("struct SearchCaseClassificationsRequest")
3916            }
3917            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3918            where
3919                A: serde::de::MapAccess<'de>,
3920            {
3921                #[allow(unused_imports)]
3922                use serde::de::Error;
3923                use std::option::Option::Some;
3924                let mut fields = std::collections::HashSet::new();
3925                let mut result = Self::Value::new();
3926                while let Some(tag) = map.next_key::<__FieldTag>()? {
3927                    #[allow(clippy::match_single_binding)]
3928                    match tag {
3929                        __FieldTag::__query => {
3930                            if !fields.insert(__FieldTag::__query) {
3931                                return std::result::Result::Err(A::Error::duplicate_field(
3932                                    "multiple values for query",
3933                                ));
3934                            }
3935                            result.query = map
3936                                .next_value::<std::option::Option<std::string::String>>()?
3937                                .unwrap_or_default();
3938                        }
3939                        __FieldTag::__page_size => {
3940                            if !fields.insert(__FieldTag::__page_size) {
3941                                return std::result::Result::Err(A::Error::duplicate_field(
3942                                    "multiple values for page_size",
3943                                ));
3944                            }
3945                            struct __With(std::option::Option<i32>);
3946                            impl<'de> serde::de::Deserialize<'de> for __With {
3947                                fn deserialize<D>(
3948                                    deserializer: D,
3949                                ) -> std::result::Result<Self, D::Error>
3950                                where
3951                                    D: serde::de::Deserializer<'de>,
3952                                {
3953                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3954                                }
3955                            }
3956                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3957                        }
3958                        __FieldTag::__page_token => {
3959                            if !fields.insert(__FieldTag::__page_token) {
3960                                return std::result::Result::Err(A::Error::duplicate_field(
3961                                    "multiple values for page_token",
3962                                ));
3963                            }
3964                            result.page_token = map
3965                                .next_value::<std::option::Option<std::string::String>>()?
3966                                .unwrap_or_default();
3967                        }
3968                        __FieldTag::Unknown(key) => {
3969                            let value = map.next_value::<serde_json::Value>()?;
3970                            result._unknown_fields.insert(key, value);
3971                        }
3972                    }
3973                }
3974                std::result::Result::Ok(result)
3975            }
3976        }
3977        deserializer.deserialize_any(Visitor)
3978    }
3979}
3980
3981#[doc(hidden)]
3982impl serde::ser::Serialize for SearchCaseClassificationsRequest {
3983    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3984    where
3985        S: serde::ser::Serializer,
3986    {
3987        use serde::ser::SerializeMap;
3988        #[allow(unused_imports)]
3989        use std::option::Option::Some;
3990        let mut state = serializer.serialize_map(std::option::Option::None)?;
3991        if !self.query.is_empty() {
3992            state.serialize_entry("query", &self.query)?;
3993        }
3994        if !wkt::internal::is_default(&self.page_size) {
3995            struct __With<'a>(&'a i32);
3996            impl<'a> serde::ser::Serialize for __With<'a> {
3997                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3998                where
3999                    S: serde::ser::Serializer,
4000                {
4001                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4002                }
4003            }
4004            state.serialize_entry("pageSize", &__With(&self.page_size))?;
4005        }
4006        if !self.page_token.is_empty() {
4007            state.serialize_entry("pageToken", &self.page_token)?;
4008        }
4009        if !self._unknown_fields.is_empty() {
4010            for (key, value) in self._unknown_fields.iter() {
4011                state.serialize_entry(key, &value)?;
4012            }
4013        }
4014        state.end()
4015    }
4016}
4017
4018impl std::fmt::Debug for SearchCaseClassificationsRequest {
4019    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4020        let mut debug_struct = f.debug_struct("SearchCaseClassificationsRequest");
4021        debug_struct.field("query", &self.query);
4022        debug_struct.field("page_size", &self.page_size);
4023        debug_struct.field("page_token", &self.page_token);
4024        if !self._unknown_fields.is_empty() {
4025            debug_struct.field("_unknown_fields", &self._unknown_fields);
4026        }
4027        debug_struct.finish()
4028    }
4029}
4030
4031/// The response message for SearchCaseClassifications endpoint.
4032#[derive(Clone, Default, PartialEq)]
4033#[non_exhaustive]
4034pub struct SearchCaseClassificationsResponse {
4035    /// The classifications retrieved.
4036    pub case_classifications: std::vec::Vec<crate::model::CaseClassification>,
4037
4038    /// A token to retrieve the next page of results. Set this in the `page_token`
4039    /// field of subsequent `caseClassifications.list` requests. If unspecified,
4040    /// there are no more results to retrieve.
4041    pub next_page_token: std::string::String,
4042
4043    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4044}
4045
4046impl SearchCaseClassificationsResponse {
4047    pub fn new() -> Self {
4048        std::default::Default::default()
4049    }
4050
4051    /// Sets the value of [case_classifications][crate::model::SearchCaseClassificationsResponse::case_classifications].
4052    pub fn set_case_classifications<T, V>(mut self, v: T) -> Self
4053    where
4054        T: std::iter::IntoIterator<Item = V>,
4055        V: std::convert::Into<crate::model::CaseClassification>,
4056    {
4057        use std::iter::Iterator;
4058        self.case_classifications = v.into_iter().map(|i| i.into()).collect();
4059        self
4060    }
4061
4062    /// Sets the value of [next_page_token][crate::model::SearchCaseClassificationsResponse::next_page_token].
4063    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4064        self.next_page_token = v.into();
4065        self
4066    }
4067}
4068
4069impl wkt::message::Message for SearchCaseClassificationsResponse {
4070    fn typename() -> &'static str {
4071        "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsResponse"
4072    }
4073}
4074
4075#[doc(hidden)]
4076impl gax::paginator::internal::PageableResponse for SearchCaseClassificationsResponse {
4077    type PageItem = crate::model::CaseClassification;
4078
4079    fn items(self) -> std::vec::Vec<Self::PageItem> {
4080        self.case_classifications
4081    }
4082
4083    fn next_page_token(&self) -> std::string::String {
4084        use std::clone::Clone;
4085        self.next_page_token.clone()
4086    }
4087}
4088
4089#[doc(hidden)]
4090impl<'de> serde::de::Deserialize<'de> for SearchCaseClassificationsResponse {
4091    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4092    where
4093        D: serde::Deserializer<'de>,
4094    {
4095        #[allow(non_camel_case_types)]
4096        #[doc(hidden)]
4097        #[derive(PartialEq, Eq, Hash)]
4098        enum __FieldTag {
4099            __case_classifications,
4100            __next_page_token,
4101            Unknown(std::string::String),
4102        }
4103        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4104            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4105            where
4106                D: serde::Deserializer<'de>,
4107            {
4108                struct Visitor;
4109                impl<'de> serde::de::Visitor<'de> for Visitor {
4110                    type Value = __FieldTag;
4111                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4112                        formatter.write_str("a field name for SearchCaseClassificationsResponse")
4113                    }
4114                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4115                    where
4116                        E: serde::de::Error,
4117                    {
4118                        use std::result::Result::Ok;
4119                        use std::string::ToString;
4120                        match value {
4121                            "caseClassifications" => Ok(__FieldTag::__case_classifications),
4122                            "case_classifications" => Ok(__FieldTag::__case_classifications),
4123                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
4124                            "next_page_token" => Ok(__FieldTag::__next_page_token),
4125                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4126                        }
4127                    }
4128                }
4129                deserializer.deserialize_identifier(Visitor)
4130            }
4131        }
4132        struct Visitor;
4133        impl<'de> serde::de::Visitor<'de> for Visitor {
4134            type Value = SearchCaseClassificationsResponse;
4135            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4136                formatter.write_str("struct SearchCaseClassificationsResponse")
4137            }
4138            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4139            where
4140                A: serde::de::MapAccess<'de>,
4141            {
4142                #[allow(unused_imports)]
4143                use serde::de::Error;
4144                use std::option::Option::Some;
4145                let mut fields = std::collections::HashSet::new();
4146                let mut result = Self::Value::new();
4147                while let Some(tag) = map.next_key::<__FieldTag>()? {
4148                    #[allow(clippy::match_single_binding)]
4149                    match tag {
4150                        __FieldTag::__case_classifications => {
4151                            if !fields.insert(__FieldTag::__case_classifications) {
4152                                return std::result::Result::Err(A::Error::duplicate_field(
4153                                    "multiple values for case_classifications",
4154                                ));
4155                            }
4156                            result.case_classifications = map
4157                                .next_value::<std::option::Option<
4158                                    std::vec::Vec<crate::model::CaseClassification>,
4159                                >>()?
4160                                .unwrap_or_default();
4161                        }
4162                        __FieldTag::__next_page_token => {
4163                            if !fields.insert(__FieldTag::__next_page_token) {
4164                                return std::result::Result::Err(A::Error::duplicate_field(
4165                                    "multiple values for next_page_token",
4166                                ));
4167                            }
4168                            result.next_page_token = map
4169                                .next_value::<std::option::Option<std::string::String>>()?
4170                                .unwrap_or_default();
4171                        }
4172                        __FieldTag::Unknown(key) => {
4173                            let value = map.next_value::<serde_json::Value>()?;
4174                            result._unknown_fields.insert(key, value);
4175                        }
4176                    }
4177                }
4178                std::result::Result::Ok(result)
4179            }
4180        }
4181        deserializer.deserialize_any(Visitor)
4182    }
4183}
4184
4185#[doc(hidden)]
4186impl serde::ser::Serialize for SearchCaseClassificationsResponse {
4187    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4188    where
4189        S: serde::ser::Serializer,
4190    {
4191        use serde::ser::SerializeMap;
4192        #[allow(unused_imports)]
4193        use std::option::Option::Some;
4194        let mut state = serializer.serialize_map(std::option::Option::None)?;
4195        if !self.case_classifications.is_empty() {
4196            state.serialize_entry("caseClassifications", &self.case_classifications)?;
4197        }
4198        if !self.next_page_token.is_empty() {
4199            state.serialize_entry("nextPageToken", &self.next_page_token)?;
4200        }
4201        if !self._unknown_fields.is_empty() {
4202            for (key, value) in self._unknown_fields.iter() {
4203                state.serialize_entry(key, &value)?;
4204            }
4205        }
4206        state.end()
4207    }
4208}
4209
4210impl std::fmt::Debug for SearchCaseClassificationsResponse {
4211    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4212        let mut debug_struct = f.debug_struct("SearchCaseClassificationsResponse");
4213        debug_struct.field("case_classifications", &self.case_classifications);
4214        debug_struct.field("next_page_token", &self.next_page_token);
4215        if !self._unknown_fields.is_empty() {
4216            debug_struct.field("_unknown_fields", &self._unknown_fields);
4217        }
4218        debug_struct.finish()
4219    }
4220}
4221
4222/// A comment associated with a support case.
4223///
4224/// Case comments are the primary way for Google Support to communicate with a
4225/// user who has opened a case. When a user responds to Google Support, the
4226/// user's responses also appear as comments.
4227#[derive(Clone, Default, PartialEq)]
4228#[non_exhaustive]
4229pub struct Comment {
4230    /// Output only. Identifier. The resource name of the comment.
4231    pub name: std::string::String,
4232
4233    /// Output only. The time when the comment was created.
4234    pub create_time: std::option::Option<wkt::Timestamp>,
4235
4236    /// Output only. The user or Google Support agent who created the comment.
4237    pub creator: std::option::Option<crate::model::Actor>,
4238
4239    /// The full comment body.
4240    ///
4241    /// Maximum of 12800 characters.
4242    pub body: std::string::String,
4243
4244    /// Output only. DEPRECATED. DO NOT USE.
4245    ///
4246    /// A duplicate of the `body` field.
4247    ///
4248    /// This field is only present for legacy reasons.
4249    #[deprecated]
4250    pub plain_text_body: std::string::String,
4251
4252    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4253}
4254
4255impl Comment {
4256    pub fn new() -> Self {
4257        std::default::Default::default()
4258    }
4259
4260    /// Sets the value of [name][crate::model::Comment::name].
4261    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4262        self.name = v.into();
4263        self
4264    }
4265
4266    /// Sets the value of [create_time][crate::model::Comment::create_time].
4267    pub fn set_create_time<T>(mut self, v: T) -> Self
4268    where
4269        T: std::convert::Into<wkt::Timestamp>,
4270    {
4271        self.create_time = std::option::Option::Some(v.into());
4272        self
4273    }
4274
4275    /// Sets or clears the value of [create_time][crate::model::Comment::create_time].
4276    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4277    where
4278        T: std::convert::Into<wkt::Timestamp>,
4279    {
4280        self.create_time = v.map(|x| x.into());
4281        self
4282    }
4283
4284    /// Sets the value of [creator][crate::model::Comment::creator].
4285    pub fn set_creator<T>(mut self, v: T) -> Self
4286    where
4287        T: std::convert::Into<crate::model::Actor>,
4288    {
4289        self.creator = std::option::Option::Some(v.into());
4290        self
4291    }
4292
4293    /// Sets or clears the value of [creator][crate::model::Comment::creator].
4294    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
4295    where
4296        T: std::convert::Into<crate::model::Actor>,
4297    {
4298        self.creator = v.map(|x| x.into());
4299        self
4300    }
4301
4302    /// Sets the value of [body][crate::model::Comment::body].
4303    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4304        self.body = v.into();
4305        self
4306    }
4307
4308    /// Sets the value of [plain_text_body][crate::model::Comment::plain_text_body].
4309    #[deprecated]
4310    pub fn set_plain_text_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4311        self.plain_text_body = v.into();
4312        self
4313    }
4314}
4315
4316impl wkt::message::Message for Comment {
4317    fn typename() -> &'static str {
4318        "type.googleapis.com/google.cloud.support.v2.Comment"
4319    }
4320}
4321
4322#[doc(hidden)]
4323impl<'de> serde::de::Deserialize<'de> for Comment {
4324    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4325    where
4326        D: serde::Deserializer<'de>,
4327    {
4328        #[allow(non_camel_case_types)]
4329        #[doc(hidden)]
4330        #[derive(PartialEq, Eq, Hash)]
4331        enum __FieldTag {
4332            __name,
4333            __create_time,
4334            __creator,
4335            __body,
4336            __plain_text_body,
4337            Unknown(std::string::String),
4338        }
4339        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4340            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4341            where
4342                D: serde::Deserializer<'de>,
4343            {
4344                struct Visitor;
4345                impl<'de> serde::de::Visitor<'de> for Visitor {
4346                    type Value = __FieldTag;
4347                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4348                        formatter.write_str("a field name for Comment")
4349                    }
4350                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4351                    where
4352                        E: serde::de::Error,
4353                    {
4354                        use std::result::Result::Ok;
4355                        use std::string::ToString;
4356                        match value {
4357                            "name" => Ok(__FieldTag::__name),
4358                            "createTime" => Ok(__FieldTag::__create_time),
4359                            "create_time" => Ok(__FieldTag::__create_time),
4360                            "creator" => Ok(__FieldTag::__creator),
4361                            "body" => Ok(__FieldTag::__body),
4362                            "plainTextBody" => Ok(__FieldTag::__plain_text_body),
4363                            "plain_text_body" => Ok(__FieldTag::__plain_text_body),
4364                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4365                        }
4366                    }
4367                }
4368                deserializer.deserialize_identifier(Visitor)
4369            }
4370        }
4371        struct Visitor;
4372        impl<'de> serde::de::Visitor<'de> for Visitor {
4373            type Value = Comment;
4374            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4375                formatter.write_str("struct Comment")
4376            }
4377            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4378            where
4379                A: serde::de::MapAccess<'de>,
4380            {
4381                #[allow(unused_imports)]
4382                use serde::de::Error;
4383                use std::option::Option::Some;
4384                let mut fields = std::collections::HashSet::new();
4385                let mut result = Self::Value::new();
4386                while let Some(tag) = map.next_key::<__FieldTag>()? {
4387                    #[allow(clippy::match_single_binding)]
4388                    match tag {
4389                        __FieldTag::__name => {
4390                            if !fields.insert(__FieldTag::__name) {
4391                                return std::result::Result::Err(A::Error::duplicate_field(
4392                                    "multiple values for name",
4393                                ));
4394                            }
4395                            result.name = map
4396                                .next_value::<std::option::Option<std::string::String>>()?
4397                                .unwrap_or_default();
4398                        }
4399                        __FieldTag::__create_time => {
4400                            if !fields.insert(__FieldTag::__create_time) {
4401                                return std::result::Result::Err(A::Error::duplicate_field(
4402                                    "multiple values for create_time",
4403                                ));
4404                            }
4405                            result.create_time =
4406                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4407                        }
4408                        __FieldTag::__creator => {
4409                            if !fields.insert(__FieldTag::__creator) {
4410                                return std::result::Result::Err(A::Error::duplicate_field(
4411                                    "multiple values for creator",
4412                                ));
4413                            }
4414                            result.creator =
4415                                map.next_value::<std::option::Option<crate::model::Actor>>()?;
4416                        }
4417                        __FieldTag::__body => {
4418                            if !fields.insert(__FieldTag::__body) {
4419                                return std::result::Result::Err(A::Error::duplicate_field(
4420                                    "multiple values for body",
4421                                ));
4422                            }
4423                            result.body = map
4424                                .next_value::<std::option::Option<std::string::String>>()?
4425                                .unwrap_or_default();
4426                        }
4427                        __FieldTag::__plain_text_body => {
4428                            if !fields.insert(__FieldTag::__plain_text_body) {
4429                                return std::result::Result::Err(A::Error::duplicate_field(
4430                                    "multiple values for plain_text_body",
4431                                ));
4432                            }
4433                            result.plain_text_body = map
4434                                .next_value::<std::option::Option<std::string::String>>()?
4435                                .unwrap_or_default();
4436                        }
4437                        __FieldTag::Unknown(key) => {
4438                            let value = map.next_value::<serde_json::Value>()?;
4439                            result._unknown_fields.insert(key, value);
4440                        }
4441                    }
4442                }
4443                std::result::Result::Ok(result)
4444            }
4445        }
4446        deserializer.deserialize_any(Visitor)
4447    }
4448}
4449
4450#[doc(hidden)]
4451impl serde::ser::Serialize for Comment {
4452    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4453    where
4454        S: serde::ser::Serializer,
4455    {
4456        use serde::ser::SerializeMap;
4457        #[allow(unused_imports)]
4458        use std::option::Option::Some;
4459        let mut state = serializer.serialize_map(std::option::Option::None)?;
4460        if !self.name.is_empty() {
4461            state.serialize_entry("name", &self.name)?;
4462        }
4463        if self.create_time.is_some() {
4464            state.serialize_entry("createTime", &self.create_time)?;
4465        }
4466        if self.creator.is_some() {
4467            state.serialize_entry("creator", &self.creator)?;
4468        }
4469        if !self.body.is_empty() {
4470            state.serialize_entry("body", &self.body)?;
4471        }
4472        if !self.plain_text_body.is_empty() {
4473            state.serialize_entry("plainTextBody", &self.plain_text_body)?;
4474        }
4475        if !self._unknown_fields.is_empty() {
4476            for (key, value) in self._unknown_fields.iter() {
4477                state.serialize_entry(key, &value)?;
4478            }
4479        }
4480        state.end()
4481    }
4482}
4483
4484impl std::fmt::Debug for Comment {
4485    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4486        let mut debug_struct = f.debug_struct("Comment");
4487        debug_struct.field("name", &self.name);
4488        debug_struct.field("create_time", &self.create_time);
4489        debug_struct.field("creator", &self.creator);
4490        debug_struct.field("body", &self.body);
4491        debug_struct.field("plain_text_body", &self.plain_text_body);
4492        if !self._unknown_fields.is_empty() {
4493            debug_struct.field("_unknown_fields", &self._unknown_fields);
4494        }
4495        debug_struct.finish()
4496    }
4497}
4498
4499/// The request message for the ListComments endpoint.
4500#[derive(Clone, Default, PartialEq)]
4501#[non_exhaustive]
4502pub struct ListCommentsRequest {
4503    /// Required. The name of the case for which to list comments.
4504    pub parent: std::string::String,
4505
4506    /// The maximum number of comments to fetch. Defaults to 10.
4507    pub page_size: i32,
4508
4509    /// A token identifying the page of results to return. If unspecified, the
4510    /// first page is returned.
4511    pub page_token: std::string::String,
4512
4513    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4514}
4515
4516impl ListCommentsRequest {
4517    pub fn new() -> Self {
4518        std::default::Default::default()
4519    }
4520
4521    /// Sets the value of [parent][crate::model::ListCommentsRequest::parent].
4522    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4523        self.parent = v.into();
4524        self
4525    }
4526
4527    /// Sets the value of [page_size][crate::model::ListCommentsRequest::page_size].
4528    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4529        self.page_size = v.into();
4530        self
4531    }
4532
4533    /// Sets the value of [page_token][crate::model::ListCommentsRequest::page_token].
4534    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4535        self.page_token = v.into();
4536        self
4537    }
4538}
4539
4540impl wkt::message::Message for ListCommentsRequest {
4541    fn typename() -> &'static str {
4542        "type.googleapis.com/google.cloud.support.v2.ListCommentsRequest"
4543    }
4544}
4545
4546#[doc(hidden)]
4547impl<'de> serde::de::Deserialize<'de> for ListCommentsRequest {
4548    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4549    where
4550        D: serde::Deserializer<'de>,
4551    {
4552        #[allow(non_camel_case_types)]
4553        #[doc(hidden)]
4554        #[derive(PartialEq, Eq, Hash)]
4555        enum __FieldTag {
4556            __parent,
4557            __page_size,
4558            __page_token,
4559            Unknown(std::string::String),
4560        }
4561        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4562            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4563            where
4564                D: serde::Deserializer<'de>,
4565            {
4566                struct Visitor;
4567                impl<'de> serde::de::Visitor<'de> for Visitor {
4568                    type Value = __FieldTag;
4569                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4570                        formatter.write_str("a field name for ListCommentsRequest")
4571                    }
4572                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4573                    where
4574                        E: serde::de::Error,
4575                    {
4576                        use std::result::Result::Ok;
4577                        use std::string::ToString;
4578                        match value {
4579                            "parent" => Ok(__FieldTag::__parent),
4580                            "pageSize" => Ok(__FieldTag::__page_size),
4581                            "page_size" => Ok(__FieldTag::__page_size),
4582                            "pageToken" => Ok(__FieldTag::__page_token),
4583                            "page_token" => Ok(__FieldTag::__page_token),
4584                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4585                        }
4586                    }
4587                }
4588                deserializer.deserialize_identifier(Visitor)
4589            }
4590        }
4591        struct Visitor;
4592        impl<'de> serde::de::Visitor<'de> for Visitor {
4593            type Value = ListCommentsRequest;
4594            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4595                formatter.write_str("struct ListCommentsRequest")
4596            }
4597            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4598            where
4599                A: serde::de::MapAccess<'de>,
4600            {
4601                #[allow(unused_imports)]
4602                use serde::de::Error;
4603                use std::option::Option::Some;
4604                let mut fields = std::collections::HashSet::new();
4605                let mut result = Self::Value::new();
4606                while let Some(tag) = map.next_key::<__FieldTag>()? {
4607                    #[allow(clippy::match_single_binding)]
4608                    match tag {
4609                        __FieldTag::__parent => {
4610                            if !fields.insert(__FieldTag::__parent) {
4611                                return std::result::Result::Err(A::Error::duplicate_field(
4612                                    "multiple values for parent",
4613                                ));
4614                            }
4615                            result.parent = map
4616                                .next_value::<std::option::Option<std::string::String>>()?
4617                                .unwrap_or_default();
4618                        }
4619                        __FieldTag::__page_size => {
4620                            if !fields.insert(__FieldTag::__page_size) {
4621                                return std::result::Result::Err(A::Error::duplicate_field(
4622                                    "multiple values for page_size",
4623                                ));
4624                            }
4625                            struct __With(std::option::Option<i32>);
4626                            impl<'de> serde::de::Deserialize<'de> for __With {
4627                                fn deserialize<D>(
4628                                    deserializer: D,
4629                                ) -> std::result::Result<Self, D::Error>
4630                                where
4631                                    D: serde::de::Deserializer<'de>,
4632                                {
4633                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4634                                }
4635                            }
4636                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
4637                        }
4638                        __FieldTag::__page_token => {
4639                            if !fields.insert(__FieldTag::__page_token) {
4640                                return std::result::Result::Err(A::Error::duplicate_field(
4641                                    "multiple values for page_token",
4642                                ));
4643                            }
4644                            result.page_token = map
4645                                .next_value::<std::option::Option<std::string::String>>()?
4646                                .unwrap_or_default();
4647                        }
4648                        __FieldTag::Unknown(key) => {
4649                            let value = map.next_value::<serde_json::Value>()?;
4650                            result._unknown_fields.insert(key, value);
4651                        }
4652                    }
4653                }
4654                std::result::Result::Ok(result)
4655            }
4656        }
4657        deserializer.deserialize_any(Visitor)
4658    }
4659}
4660
4661#[doc(hidden)]
4662impl serde::ser::Serialize for ListCommentsRequest {
4663    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4664    where
4665        S: serde::ser::Serializer,
4666    {
4667        use serde::ser::SerializeMap;
4668        #[allow(unused_imports)]
4669        use std::option::Option::Some;
4670        let mut state = serializer.serialize_map(std::option::Option::None)?;
4671        if !self.parent.is_empty() {
4672            state.serialize_entry("parent", &self.parent)?;
4673        }
4674        if !wkt::internal::is_default(&self.page_size) {
4675            struct __With<'a>(&'a i32);
4676            impl<'a> serde::ser::Serialize for __With<'a> {
4677                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4678                where
4679                    S: serde::ser::Serializer,
4680                {
4681                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4682                }
4683            }
4684            state.serialize_entry("pageSize", &__With(&self.page_size))?;
4685        }
4686        if !self.page_token.is_empty() {
4687            state.serialize_entry("pageToken", &self.page_token)?;
4688        }
4689        if !self._unknown_fields.is_empty() {
4690            for (key, value) in self._unknown_fields.iter() {
4691                state.serialize_entry(key, &value)?;
4692            }
4693        }
4694        state.end()
4695    }
4696}
4697
4698impl std::fmt::Debug for ListCommentsRequest {
4699    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4700        let mut debug_struct = f.debug_struct("ListCommentsRequest");
4701        debug_struct.field("parent", &self.parent);
4702        debug_struct.field("page_size", &self.page_size);
4703        debug_struct.field("page_token", &self.page_token);
4704        if !self._unknown_fields.is_empty() {
4705            debug_struct.field("_unknown_fields", &self._unknown_fields);
4706        }
4707        debug_struct.finish()
4708    }
4709}
4710
4711/// The response message for the ListComments endpoint.
4712#[derive(Clone, Default, PartialEq)]
4713#[non_exhaustive]
4714pub struct ListCommentsResponse {
4715    /// List of the comments associated with the case.
4716    pub comments: std::vec::Vec<crate::model::Comment>,
4717
4718    /// A token to retrieve the next page of results. Set this in the `page_token`
4719    /// field of subsequent `cases.comments.list` requests. If unspecified, there
4720    /// are no more results to retrieve.
4721    pub next_page_token: std::string::String,
4722
4723    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4724}
4725
4726impl ListCommentsResponse {
4727    pub fn new() -> Self {
4728        std::default::Default::default()
4729    }
4730
4731    /// Sets the value of [comments][crate::model::ListCommentsResponse::comments].
4732    pub fn set_comments<T, V>(mut self, v: T) -> Self
4733    where
4734        T: std::iter::IntoIterator<Item = V>,
4735        V: std::convert::Into<crate::model::Comment>,
4736    {
4737        use std::iter::Iterator;
4738        self.comments = v.into_iter().map(|i| i.into()).collect();
4739        self
4740    }
4741
4742    /// Sets the value of [next_page_token][crate::model::ListCommentsResponse::next_page_token].
4743    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4744        self.next_page_token = v.into();
4745        self
4746    }
4747}
4748
4749impl wkt::message::Message for ListCommentsResponse {
4750    fn typename() -> &'static str {
4751        "type.googleapis.com/google.cloud.support.v2.ListCommentsResponse"
4752    }
4753}
4754
4755#[doc(hidden)]
4756impl gax::paginator::internal::PageableResponse for ListCommentsResponse {
4757    type PageItem = crate::model::Comment;
4758
4759    fn items(self) -> std::vec::Vec<Self::PageItem> {
4760        self.comments
4761    }
4762
4763    fn next_page_token(&self) -> std::string::String {
4764        use std::clone::Clone;
4765        self.next_page_token.clone()
4766    }
4767}
4768
4769#[doc(hidden)]
4770impl<'de> serde::de::Deserialize<'de> for ListCommentsResponse {
4771    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4772    where
4773        D: serde::Deserializer<'de>,
4774    {
4775        #[allow(non_camel_case_types)]
4776        #[doc(hidden)]
4777        #[derive(PartialEq, Eq, Hash)]
4778        enum __FieldTag {
4779            __comments,
4780            __next_page_token,
4781            Unknown(std::string::String),
4782        }
4783        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4784            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4785            where
4786                D: serde::Deserializer<'de>,
4787            {
4788                struct Visitor;
4789                impl<'de> serde::de::Visitor<'de> for Visitor {
4790                    type Value = __FieldTag;
4791                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4792                        formatter.write_str("a field name for ListCommentsResponse")
4793                    }
4794                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4795                    where
4796                        E: serde::de::Error,
4797                    {
4798                        use std::result::Result::Ok;
4799                        use std::string::ToString;
4800                        match value {
4801                            "comments" => Ok(__FieldTag::__comments),
4802                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
4803                            "next_page_token" => Ok(__FieldTag::__next_page_token),
4804                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4805                        }
4806                    }
4807                }
4808                deserializer.deserialize_identifier(Visitor)
4809            }
4810        }
4811        struct Visitor;
4812        impl<'de> serde::de::Visitor<'de> for Visitor {
4813            type Value = ListCommentsResponse;
4814            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4815                formatter.write_str("struct ListCommentsResponse")
4816            }
4817            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4818            where
4819                A: serde::de::MapAccess<'de>,
4820            {
4821                #[allow(unused_imports)]
4822                use serde::de::Error;
4823                use std::option::Option::Some;
4824                let mut fields = std::collections::HashSet::new();
4825                let mut result = Self::Value::new();
4826                while let Some(tag) = map.next_key::<__FieldTag>()? {
4827                    #[allow(clippy::match_single_binding)]
4828                    match tag {
4829                        __FieldTag::__comments => {
4830                            if !fields.insert(__FieldTag::__comments) {
4831                                return std::result::Result::Err(A::Error::duplicate_field(
4832                                    "multiple values for comments",
4833                                ));
4834                            }
4835                            result.comments = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Comment>>>()?.unwrap_or_default();
4836                        }
4837                        __FieldTag::__next_page_token => {
4838                            if !fields.insert(__FieldTag::__next_page_token) {
4839                                return std::result::Result::Err(A::Error::duplicate_field(
4840                                    "multiple values for next_page_token",
4841                                ));
4842                            }
4843                            result.next_page_token = map
4844                                .next_value::<std::option::Option<std::string::String>>()?
4845                                .unwrap_or_default();
4846                        }
4847                        __FieldTag::Unknown(key) => {
4848                            let value = map.next_value::<serde_json::Value>()?;
4849                            result._unknown_fields.insert(key, value);
4850                        }
4851                    }
4852                }
4853                std::result::Result::Ok(result)
4854            }
4855        }
4856        deserializer.deserialize_any(Visitor)
4857    }
4858}
4859
4860#[doc(hidden)]
4861impl serde::ser::Serialize for ListCommentsResponse {
4862    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4863    where
4864        S: serde::ser::Serializer,
4865    {
4866        use serde::ser::SerializeMap;
4867        #[allow(unused_imports)]
4868        use std::option::Option::Some;
4869        let mut state = serializer.serialize_map(std::option::Option::None)?;
4870        if !self.comments.is_empty() {
4871            state.serialize_entry("comments", &self.comments)?;
4872        }
4873        if !self.next_page_token.is_empty() {
4874            state.serialize_entry("nextPageToken", &self.next_page_token)?;
4875        }
4876        if !self._unknown_fields.is_empty() {
4877            for (key, value) in self._unknown_fields.iter() {
4878                state.serialize_entry(key, &value)?;
4879            }
4880        }
4881        state.end()
4882    }
4883}
4884
4885impl std::fmt::Debug for ListCommentsResponse {
4886    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4887        let mut debug_struct = f.debug_struct("ListCommentsResponse");
4888        debug_struct.field("comments", &self.comments);
4889        debug_struct.field("next_page_token", &self.next_page_token);
4890        if !self._unknown_fields.is_empty() {
4891            debug_struct.field("_unknown_fields", &self._unknown_fields);
4892        }
4893        debug_struct.finish()
4894    }
4895}
4896
4897/// The request message for the CreateComment endpoint.
4898#[derive(Clone, Default, PartialEq)]
4899#[non_exhaustive]
4900pub struct CreateCommentRequest {
4901    /// Required. The name of the case to which the comment should be added.
4902    pub parent: std::string::String,
4903
4904    /// Required. The comment to be added.
4905    pub comment: std::option::Option<crate::model::Comment>,
4906
4907    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4908}
4909
4910impl CreateCommentRequest {
4911    pub fn new() -> Self {
4912        std::default::Default::default()
4913    }
4914
4915    /// Sets the value of [parent][crate::model::CreateCommentRequest::parent].
4916    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4917        self.parent = v.into();
4918        self
4919    }
4920
4921    /// Sets the value of [comment][crate::model::CreateCommentRequest::comment].
4922    pub fn set_comment<T>(mut self, v: T) -> Self
4923    where
4924        T: std::convert::Into<crate::model::Comment>,
4925    {
4926        self.comment = std::option::Option::Some(v.into());
4927        self
4928    }
4929
4930    /// Sets or clears the value of [comment][crate::model::CreateCommentRequest::comment].
4931    pub fn set_or_clear_comment<T>(mut self, v: std::option::Option<T>) -> Self
4932    where
4933        T: std::convert::Into<crate::model::Comment>,
4934    {
4935        self.comment = v.map(|x| x.into());
4936        self
4937    }
4938}
4939
4940impl wkt::message::Message for CreateCommentRequest {
4941    fn typename() -> &'static str {
4942        "type.googleapis.com/google.cloud.support.v2.CreateCommentRequest"
4943    }
4944}
4945
4946#[doc(hidden)]
4947impl<'de> serde::de::Deserialize<'de> for CreateCommentRequest {
4948    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4949    where
4950        D: serde::Deserializer<'de>,
4951    {
4952        #[allow(non_camel_case_types)]
4953        #[doc(hidden)]
4954        #[derive(PartialEq, Eq, Hash)]
4955        enum __FieldTag {
4956            __parent,
4957            __comment,
4958            Unknown(std::string::String),
4959        }
4960        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4961            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4962            where
4963                D: serde::Deserializer<'de>,
4964            {
4965                struct Visitor;
4966                impl<'de> serde::de::Visitor<'de> for Visitor {
4967                    type Value = __FieldTag;
4968                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4969                        formatter.write_str("a field name for CreateCommentRequest")
4970                    }
4971                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4972                    where
4973                        E: serde::de::Error,
4974                    {
4975                        use std::result::Result::Ok;
4976                        use std::string::ToString;
4977                        match value {
4978                            "parent" => Ok(__FieldTag::__parent),
4979                            "comment" => Ok(__FieldTag::__comment),
4980                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4981                        }
4982                    }
4983                }
4984                deserializer.deserialize_identifier(Visitor)
4985            }
4986        }
4987        struct Visitor;
4988        impl<'de> serde::de::Visitor<'de> for Visitor {
4989            type Value = CreateCommentRequest;
4990            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4991                formatter.write_str("struct CreateCommentRequest")
4992            }
4993            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4994            where
4995                A: serde::de::MapAccess<'de>,
4996            {
4997                #[allow(unused_imports)]
4998                use serde::de::Error;
4999                use std::option::Option::Some;
5000                let mut fields = std::collections::HashSet::new();
5001                let mut result = Self::Value::new();
5002                while let Some(tag) = map.next_key::<__FieldTag>()? {
5003                    #[allow(clippy::match_single_binding)]
5004                    match tag {
5005                        __FieldTag::__parent => {
5006                            if !fields.insert(__FieldTag::__parent) {
5007                                return std::result::Result::Err(A::Error::duplicate_field(
5008                                    "multiple values for parent",
5009                                ));
5010                            }
5011                            result.parent = map
5012                                .next_value::<std::option::Option<std::string::String>>()?
5013                                .unwrap_or_default();
5014                        }
5015                        __FieldTag::__comment => {
5016                            if !fields.insert(__FieldTag::__comment) {
5017                                return std::result::Result::Err(A::Error::duplicate_field(
5018                                    "multiple values for comment",
5019                                ));
5020                            }
5021                            result.comment =
5022                                map.next_value::<std::option::Option<crate::model::Comment>>()?;
5023                        }
5024                        __FieldTag::Unknown(key) => {
5025                            let value = map.next_value::<serde_json::Value>()?;
5026                            result._unknown_fields.insert(key, value);
5027                        }
5028                    }
5029                }
5030                std::result::Result::Ok(result)
5031            }
5032        }
5033        deserializer.deserialize_any(Visitor)
5034    }
5035}
5036
5037#[doc(hidden)]
5038impl serde::ser::Serialize for CreateCommentRequest {
5039    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5040    where
5041        S: serde::ser::Serializer,
5042    {
5043        use serde::ser::SerializeMap;
5044        #[allow(unused_imports)]
5045        use std::option::Option::Some;
5046        let mut state = serializer.serialize_map(std::option::Option::None)?;
5047        if !self.parent.is_empty() {
5048            state.serialize_entry("parent", &self.parent)?;
5049        }
5050        if self.comment.is_some() {
5051            state.serialize_entry("comment", &self.comment)?;
5052        }
5053        if !self._unknown_fields.is_empty() {
5054            for (key, value) in self._unknown_fields.iter() {
5055                state.serialize_entry(key, &value)?;
5056            }
5057        }
5058        state.end()
5059    }
5060}
5061
5062impl std::fmt::Debug for CreateCommentRequest {
5063    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5064        let mut debug_struct = f.debug_struct("CreateCommentRequest");
5065        debug_struct.field("parent", &self.parent);
5066        debug_struct.field("comment", &self.comment);
5067        if !self._unknown_fields.is_empty() {
5068            debug_struct.field("_unknown_fields", &self._unknown_fields);
5069        }
5070        debug_struct.finish()
5071    }
5072}
5073
5074/// An escalation of a support case.
5075#[derive(Clone, Default, PartialEq)]
5076#[non_exhaustive]
5077pub struct Escalation {
5078    /// Required. The reason why the Case is being escalated.
5079    pub reason: crate::model::escalation::Reason,
5080
5081    /// Required. A free text description to accompany the `reason` field above.
5082    /// Provides additional context on why the case is being escalated.
5083    pub justification: std::string::String,
5084
5085    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5086}
5087
5088impl Escalation {
5089    pub fn new() -> Self {
5090        std::default::Default::default()
5091    }
5092
5093    /// Sets the value of [reason][crate::model::Escalation::reason].
5094    pub fn set_reason<T: std::convert::Into<crate::model::escalation::Reason>>(
5095        mut self,
5096        v: T,
5097    ) -> Self {
5098        self.reason = v.into();
5099        self
5100    }
5101
5102    /// Sets the value of [justification][crate::model::Escalation::justification].
5103    pub fn set_justification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5104        self.justification = v.into();
5105        self
5106    }
5107}
5108
5109impl wkt::message::Message for Escalation {
5110    fn typename() -> &'static str {
5111        "type.googleapis.com/google.cloud.support.v2.Escalation"
5112    }
5113}
5114
5115#[doc(hidden)]
5116impl<'de> serde::de::Deserialize<'de> for Escalation {
5117    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5118    where
5119        D: serde::Deserializer<'de>,
5120    {
5121        #[allow(non_camel_case_types)]
5122        #[doc(hidden)]
5123        #[derive(PartialEq, Eq, Hash)]
5124        enum __FieldTag {
5125            __reason,
5126            __justification,
5127            Unknown(std::string::String),
5128        }
5129        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5130            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5131            where
5132                D: serde::Deserializer<'de>,
5133            {
5134                struct Visitor;
5135                impl<'de> serde::de::Visitor<'de> for Visitor {
5136                    type Value = __FieldTag;
5137                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5138                        formatter.write_str("a field name for Escalation")
5139                    }
5140                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5141                    where
5142                        E: serde::de::Error,
5143                    {
5144                        use std::result::Result::Ok;
5145                        use std::string::ToString;
5146                        match value {
5147                            "reason" => Ok(__FieldTag::__reason),
5148                            "justification" => Ok(__FieldTag::__justification),
5149                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5150                        }
5151                    }
5152                }
5153                deserializer.deserialize_identifier(Visitor)
5154            }
5155        }
5156        struct Visitor;
5157        impl<'de> serde::de::Visitor<'de> for Visitor {
5158            type Value = Escalation;
5159            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5160                formatter.write_str("struct Escalation")
5161            }
5162            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5163            where
5164                A: serde::de::MapAccess<'de>,
5165            {
5166                #[allow(unused_imports)]
5167                use serde::de::Error;
5168                use std::option::Option::Some;
5169                let mut fields = std::collections::HashSet::new();
5170                let mut result = Self::Value::new();
5171                while let Some(tag) = map.next_key::<__FieldTag>()? {
5172                    #[allow(clippy::match_single_binding)]
5173                    match tag {
5174                        __FieldTag::__reason => {
5175                            if !fields.insert(__FieldTag::__reason) {
5176                                return std::result::Result::Err(A::Error::duplicate_field(
5177                                    "multiple values for reason",
5178                                ));
5179                            }
5180                            result.reason = map.next_value::<std::option::Option<crate::model::escalation::Reason>>()?.unwrap_or_default();
5181                        }
5182                        __FieldTag::__justification => {
5183                            if !fields.insert(__FieldTag::__justification) {
5184                                return std::result::Result::Err(A::Error::duplicate_field(
5185                                    "multiple values for justification",
5186                                ));
5187                            }
5188                            result.justification = map
5189                                .next_value::<std::option::Option<std::string::String>>()?
5190                                .unwrap_or_default();
5191                        }
5192                        __FieldTag::Unknown(key) => {
5193                            let value = map.next_value::<serde_json::Value>()?;
5194                            result._unknown_fields.insert(key, value);
5195                        }
5196                    }
5197                }
5198                std::result::Result::Ok(result)
5199            }
5200        }
5201        deserializer.deserialize_any(Visitor)
5202    }
5203}
5204
5205#[doc(hidden)]
5206impl serde::ser::Serialize for Escalation {
5207    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5208    where
5209        S: serde::ser::Serializer,
5210    {
5211        use serde::ser::SerializeMap;
5212        #[allow(unused_imports)]
5213        use std::option::Option::Some;
5214        let mut state = serializer.serialize_map(std::option::Option::None)?;
5215        if !wkt::internal::is_default(&self.reason) {
5216            state.serialize_entry("reason", &self.reason)?;
5217        }
5218        if !self.justification.is_empty() {
5219            state.serialize_entry("justification", &self.justification)?;
5220        }
5221        if !self._unknown_fields.is_empty() {
5222            for (key, value) in self._unknown_fields.iter() {
5223                state.serialize_entry(key, &value)?;
5224            }
5225        }
5226        state.end()
5227    }
5228}
5229
5230impl std::fmt::Debug for Escalation {
5231    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5232        let mut debug_struct = f.debug_struct("Escalation");
5233        debug_struct.field("reason", &self.reason);
5234        debug_struct.field("justification", &self.justification);
5235        if !self._unknown_fields.is_empty() {
5236            debug_struct.field("_unknown_fields", &self._unknown_fields);
5237        }
5238        debug_struct.finish()
5239    }
5240}
5241
5242/// Defines additional types related to [Escalation].
5243pub mod escalation {
5244    #[allow(unused_imports)]
5245    use super::*;
5246
5247    /// An enum detailing the possible reasons a case may be escalated.
5248    ///
5249    /// # Working with unknown values
5250    ///
5251    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5252    /// additional enum variants at any time. Adding new variants is not considered
5253    /// a breaking change. Applications should write their code in anticipation of:
5254    ///
5255    /// - New values appearing in future releases of the client library, **and**
5256    /// - New values received dynamically, without application changes.
5257    ///
5258    /// Please consult the [Working with enums] section in the user guide for some
5259    /// guidelines.
5260    ///
5261    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5262    #[derive(Clone, Debug, PartialEq)]
5263    #[non_exhaustive]
5264    pub enum Reason {
5265        /// The escalation reason is in an unknown state or has not been specified.
5266        Unspecified,
5267        /// The case is taking too long to resolve.
5268        ResolutionTime,
5269        /// The support agent does not have the expertise required to successfully
5270        /// resolve the issue.
5271        TechnicalExpertise,
5272        /// The issue is having a significant business impact.
5273        BusinessImpact,
5274        /// If set, the enum was initialized with an unknown value.
5275        ///
5276        /// Applications can examine the value using [Reason::value] or
5277        /// [Reason::name].
5278        UnknownValue(reason::UnknownValue),
5279    }
5280
5281    #[doc(hidden)]
5282    pub mod reason {
5283        #[allow(unused_imports)]
5284        use super::*;
5285        #[derive(Clone, Debug, PartialEq)]
5286        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5287    }
5288
5289    impl Reason {
5290        /// Gets the enum value.
5291        ///
5292        /// Returns `None` if the enum contains an unknown value deserialized from
5293        /// the string representation of enums.
5294        pub fn value(&self) -> std::option::Option<i32> {
5295            match self {
5296                Self::Unspecified => std::option::Option::Some(0),
5297                Self::ResolutionTime => std::option::Option::Some(1),
5298                Self::TechnicalExpertise => std::option::Option::Some(2),
5299                Self::BusinessImpact => std::option::Option::Some(3),
5300                Self::UnknownValue(u) => u.0.value(),
5301            }
5302        }
5303
5304        /// Gets the enum value as a string.
5305        ///
5306        /// Returns `None` if the enum contains an unknown value deserialized from
5307        /// the integer representation of enums.
5308        pub fn name(&self) -> std::option::Option<&str> {
5309            match self {
5310                Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
5311                Self::ResolutionTime => std::option::Option::Some("RESOLUTION_TIME"),
5312                Self::TechnicalExpertise => std::option::Option::Some("TECHNICAL_EXPERTISE"),
5313                Self::BusinessImpact => std::option::Option::Some("BUSINESS_IMPACT"),
5314                Self::UnknownValue(u) => u.0.name(),
5315            }
5316        }
5317    }
5318
5319    impl std::default::Default for Reason {
5320        fn default() -> Self {
5321            use std::convert::From;
5322            Self::from(0)
5323        }
5324    }
5325
5326    impl std::fmt::Display for Reason {
5327        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5328            wkt::internal::display_enum(f, self.name(), self.value())
5329        }
5330    }
5331
5332    impl std::convert::From<i32> for Reason {
5333        fn from(value: i32) -> Self {
5334            match value {
5335                0 => Self::Unspecified,
5336                1 => Self::ResolutionTime,
5337                2 => Self::TechnicalExpertise,
5338                3 => Self::BusinessImpact,
5339                _ => Self::UnknownValue(reason::UnknownValue(
5340                    wkt::internal::UnknownEnumValue::Integer(value),
5341                )),
5342            }
5343        }
5344    }
5345
5346    impl std::convert::From<&str> for Reason {
5347        fn from(value: &str) -> Self {
5348            use std::string::ToString;
5349            match value {
5350                "REASON_UNSPECIFIED" => Self::Unspecified,
5351                "RESOLUTION_TIME" => Self::ResolutionTime,
5352                "TECHNICAL_EXPERTISE" => Self::TechnicalExpertise,
5353                "BUSINESS_IMPACT" => Self::BusinessImpact,
5354                _ => Self::UnknownValue(reason::UnknownValue(
5355                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5356                )),
5357            }
5358        }
5359    }
5360
5361    impl serde::ser::Serialize for Reason {
5362        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5363        where
5364            S: serde::Serializer,
5365        {
5366            match self {
5367                Self::Unspecified => serializer.serialize_i32(0),
5368                Self::ResolutionTime => serializer.serialize_i32(1),
5369                Self::TechnicalExpertise => serializer.serialize_i32(2),
5370                Self::BusinessImpact => serializer.serialize_i32(3),
5371                Self::UnknownValue(u) => u.0.serialize(serializer),
5372            }
5373        }
5374    }
5375
5376    impl<'de> serde::de::Deserialize<'de> for Reason {
5377        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5378        where
5379            D: serde::Deserializer<'de>,
5380        {
5381            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
5382                ".google.cloud.support.v2.Escalation.Reason",
5383            ))
5384        }
5385    }
5386}