Skip to main content

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 gaxi;
23extern crate google_cloud_gax;
24extern crate serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35/// An Actor represents an entity that performed an action. For example, an actor
36/// could be a user who posted a comment on a support case, a user who
37/// uploaded an attachment, or a service account that created a support case.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct Actor {
41    /// The name to display for the actor. If not provided, it is inferred from
42    /// credentials supplied during case creation. When an email is provided, a
43    /// display name must also be provided. This will be obfuscated if the user
44    /// is a Google Support agent.
45    pub display_name: std::string::String,
46
47    /// The email address of the actor. If not provided, it is inferred from the
48    /// credentials supplied during case creation. When a name is provided, an
49    /// email must also be provided. If the user is a Google Support agent, this is
50    /// obfuscated.
51    ///
52    /// This field is deprecated. Use `username` instead.
53    #[deprecated]
54    pub email: std::string::String,
55
56    /// Output only. Whether the actor is a Google support actor.
57    pub google_support: bool,
58
59    /// Output only. The username of the actor. It may look like an email or other
60    /// format provided by the identity provider. If not provided, it is inferred
61    /// from the credentials supplied. When a name is provided, a username must
62    /// also be provided. If the user is a Google Support agent, this will not be
63    /// set.
64    pub username: std::string::String,
65
66    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
67}
68
69impl Actor {
70    /// Creates a new default instance.
71    pub fn new() -> Self {
72        std::default::Default::default()
73    }
74
75    /// Sets the value of [display_name][crate::model::Actor::display_name].
76    ///
77    /// # Example
78    /// ```ignore,no_run
79    /// # use google_cloud_support_v2::model::Actor;
80    /// let x = Actor::new().set_display_name("example");
81    /// ```
82    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83        self.display_name = v.into();
84        self
85    }
86
87    /// Sets the value of [email][crate::model::Actor::email].
88    ///
89    /// # Example
90    /// ```ignore,no_run
91    /// # use google_cloud_support_v2::model::Actor;
92    /// let x = Actor::new().set_email("example");
93    /// ```
94    #[deprecated]
95    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
96        self.email = v.into();
97        self
98    }
99
100    /// Sets the value of [google_support][crate::model::Actor::google_support].
101    ///
102    /// # Example
103    /// ```ignore,no_run
104    /// # use google_cloud_support_v2::model::Actor;
105    /// let x = Actor::new().set_google_support(true);
106    /// ```
107    pub fn set_google_support<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
108        self.google_support = v.into();
109        self
110    }
111
112    /// Sets the value of [username][crate::model::Actor::username].
113    ///
114    /// # Example
115    /// ```ignore,no_run
116    /// # use google_cloud_support_v2::model::Actor;
117    /// let x = Actor::new().set_username("example");
118    /// ```
119    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
120        self.username = v.into();
121        self
122    }
123}
124
125impl wkt::message::Message for Actor {
126    fn typename() -> &'static str {
127        "type.googleapis.com/google.cloud.support.v2.Actor"
128    }
129}
130
131/// An Attachment contains metadata about a file that was uploaded to a
132/// case - it is NOT a file itself. That being said, the name of an Attachment
133/// object can be used to download its accompanying file through the
134/// `media.download` endpoint.
135///
136/// While attachments can be uploaded in the console at the
137/// same time as a comment, they're associated on a "case" level, not a
138/// "comment" level.
139#[derive(Clone, Default, PartialEq)]
140#[non_exhaustive]
141pub struct Attachment {
142    /// Output only. Identifier. The resource name of the attachment.
143    pub name: std::string::String,
144
145    /// Output only. The time at which the attachment was created.
146    pub create_time: std::option::Option<wkt::Timestamp>,
147
148    /// Output only. The user who uploaded the attachment. Note, the name and email
149    /// will be obfuscated if the attachment was uploaded by Google support.
150    pub creator: std::option::Option<crate::model::Actor>,
151
152    /// The filename of the attachment (e.g. `"graph.jpg"`).
153    pub filename: std::string::String,
154
155    /// Output only. The MIME type of the attachment (e.g. text/plain).
156    pub mime_type: std::string::String,
157
158    /// Output only. The size of the attachment in bytes.
159    pub size_bytes: i64,
160
161    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
162}
163
164impl Attachment {
165    /// Creates a new default instance.
166    pub fn new() -> Self {
167        std::default::Default::default()
168    }
169
170    /// Sets the value of [name][crate::model::Attachment::name].
171    ///
172    /// # Example
173    /// ```ignore,no_run
174    /// # use google_cloud_support_v2::model::Attachment;
175    /// # let organization_id = "organization_id";
176    /// # let case_id = "case_id";
177    /// # let attachment_id = "attachment_id";
178    /// let x = Attachment::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/attachments/{attachment_id}"));
179    /// ```
180    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
181        self.name = v.into();
182        self
183    }
184
185    /// Sets the value of [create_time][crate::model::Attachment::create_time].
186    ///
187    /// # Example
188    /// ```ignore,no_run
189    /// # use google_cloud_support_v2::model::Attachment;
190    /// use wkt::Timestamp;
191    /// let x = Attachment::new().set_create_time(Timestamp::default()/* use setters */);
192    /// ```
193    pub fn set_create_time<T>(mut self, v: T) -> Self
194    where
195        T: std::convert::Into<wkt::Timestamp>,
196    {
197        self.create_time = std::option::Option::Some(v.into());
198        self
199    }
200
201    /// Sets or clears the value of [create_time][crate::model::Attachment::create_time].
202    ///
203    /// # Example
204    /// ```ignore,no_run
205    /// # use google_cloud_support_v2::model::Attachment;
206    /// use wkt::Timestamp;
207    /// let x = Attachment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
208    /// let x = Attachment::new().set_or_clear_create_time(None::<Timestamp>);
209    /// ```
210    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
211    where
212        T: std::convert::Into<wkt::Timestamp>,
213    {
214        self.create_time = v.map(|x| x.into());
215        self
216    }
217
218    /// Sets the value of [creator][crate::model::Attachment::creator].
219    ///
220    /// # Example
221    /// ```ignore,no_run
222    /// # use google_cloud_support_v2::model::Attachment;
223    /// use google_cloud_support_v2::model::Actor;
224    /// let x = Attachment::new().set_creator(Actor::default()/* use setters */);
225    /// ```
226    pub fn set_creator<T>(mut self, v: T) -> Self
227    where
228        T: std::convert::Into<crate::model::Actor>,
229    {
230        self.creator = std::option::Option::Some(v.into());
231        self
232    }
233
234    /// Sets or clears the value of [creator][crate::model::Attachment::creator].
235    ///
236    /// # Example
237    /// ```ignore,no_run
238    /// # use google_cloud_support_v2::model::Attachment;
239    /// use google_cloud_support_v2::model::Actor;
240    /// let x = Attachment::new().set_or_clear_creator(Some(Actor::default()/* use setters */));
241    /// let x = Attachment::new().set_or_clear_creator(None::<Actor>);
242    /// ```
243    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
244    where
245        T: std::convert::Into<crate::model::Actor>,
246    {
247        self.creator = v.map(|x| x.into());
248        self
249    }
250
251    /// Sets the value of [filename][crate::model::Attachment::filename].
252    ///
253    /// # Example
254    /// ```ignore,no_run
255    /// # use google_cloud_support_v2::model::Attachment;
256    /// let x = Attachment::new().set_filename("example");
257    /// ```
258    pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
259        self.filename = v.into();
260        self
261    }
262
263    /// Sets the value of [mime_type][crate::model::Attachment::mime_type].
264    ///
265    /// # Example
266    /// ```ignore,no_run
267    /// # use google_cloud_support_v2::model::Attachment;
268    /// let x = Attachment::new().set_mime_type("example");
269    /// ```
270    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
271        self.mime_type = v.into();
272        self
273    }
274
275    /// Sets the value of [size_bytes][crate::model::Attachment::size_bytes].
276    ///
277    /// # Example
278    /// ```ignore,no_run
279    /// # use google_cloud_support_v2::model::Attachment;
280    /// let x = Attachment::new().set_size_bytes(42);
281    /// ```
282    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
283        self.size_bytes = v.into();
284        self
285    }
286}
287
288impl wkt::message::Message for Attachment {
289    fn typename() -> &'static str {
290        "type.googleapis.com/google.cloud.support.v2.Attachment"
291    }
292}
293
294/// The request message for the ListAttachments endpoint.
295#[derive(Clone, Default, PartialEq)]
296#[non_exhaustive]
297pub struct ListAttachmentsRequest {
298    /// Required. The name of the case for which attachments should be listed.
299    pub parent: std::string::String,
300
301    /// The maximum number of attachments fetched with each request.
302    ///
303    /// If not provided, the default is 10. The maximum page size that will be
304    /// returned is 100.
305    ///
306    /// The size of each page can be smaller than the requested page size and can
307    /// include zero. For example, you could request 100 attachments on one page,
308    /// receive 0, and then on the next page, receive 90.
309    pub page_size: i32,
310
311    /// A token identifying the page of results to return. If unspecified, the
312    /// first page is retrieved.
313    pub page_token: std::string::String,
314
315    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
316}
317
318impl ListAttachmentsRequest {
319    /// Creates a new default instance.
320    pub fn new() -> Self {
321        std::default::Default::default()
322    }
323
324    /// Sets the value of [parent][crate::model::ListAttachmentsRequest::parent].
325    ///
326    /// # Example
327    /// ```ignore,no_run
328    /// # use google_cloud_support_v2::model::ListAttachmentsRequest;
329    /// # let organization_id = "organization_id";
330    /// # let case_id = "case_id";
331    /// let x = ListAttachmentsRequest::new().set_parent(format!("organizations/{organization_id}/cases/{case_id}"));
332    /// ```
333    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
334        self.parent = v.into();
335        self
336    }
337
338    /// Sets the value of [page_size][crate::model::ListAttachmentsRequest::page_size].
339    ///
340    /// # Example
341    /// ```ignore,no_run
342    /// # use google_cloud_support_v2::model::ListAttachmentsRequest;
343    /// let x = ListAttachmentsRequest::new().set_page_size(42);
344    /// ```
345    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
346        self.page_size = v.into();
347        self
348    }
349
350    /// Sets the value of [page_token][crate::model::ListAttachmentsRequest::page_token].
351    ///
352    /// # Example
353    /// ```ignore,no_run
354    /// # use google_cloud_support_v2::model::ListAttachmentsRequest;
355    /// let x = ListAttachmentsRequest::new().set_page_token("example");
356    /// ```
357    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
358        self.page_token = v.into();
359        self
360    }
361}
362
363impl wkt::message::Message for ListAttachmentsRequest {
364    fn typename() -> &'static str {
365        "type.googleapis.com/google.cloud.support.v2.ListAttachmentsRequest"
366    }
367}
368
369/// Request for getting an attachment.
370#[derive(Clone, Default, PartialEq)]
371#[non_exhaustive]
372pub struct GetAttachmentRequest {
373    /// Required. The name of the attachment to get.
374    pub name: std::string::String,
375
376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
377}
378
379impl GetAttachmentRequest {
380    /// Creates a new default instance.
381    pub fn new() -> Self {
382        std::default::Default::default()
383    }
384
385    /// Sets the value of [name][crate::model::GetAttachmentRequest::name].
386    ///
387    /// # Example
388    /// ```ignore,no_run
389    /// # use google_cloud_support_v2::model::GetAttachmentRequest;
390    /// # let organization_id = "organization_id";
391    /// # let case_id = "case_id";
392    /// # let attachment_id = "attachment_id";
393    /// let x = GetAttachmentRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/attachments/{attachment_id}"));
394    /// ```
395    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
396        self.name = v.into();
397        self
398    }
399}
400
401impl wkt::message::Message for GetAttachmentRequest {
402    fn typename() -> &'static str {
403        "type.googleapis.com/google.cloud.support.v2.GetAttachmentRequest"
404    }
405}
406
407/// The response message for the ListAttachments endpoint.
408#[derive(Clone, Default, PartialEq)]
409#[non_exhaustive]
410pub struct ListAttachmentsResponse {
411    /// The list of attachments associated with a case.
412    pub attachments: std::vec::Vec<crate::model::Attachment>,
413
414    /// A token to retrieve the next page of results. Set this in the `page_token`
415    /// field of subsequent `cases.attachments.list` requests. If unspecified,
416    /// there are no more results to retrieve.
417    pub next_page_token: std::string::String,
418
419    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
420}
421
422impl ListAttachmentsResponse {
423    /// Creates a new default instance.
424    pub fn new() -> Self {
425        std::default::Default::default()
426    }
427
428    /// Sets the value of [attachments][crate::model::ListAttachmentsResponse::attachments].
429    ///
430    /// # Example
431    /// ```ignore,no_run
432    /// # use google_cloud_support_v2::model::ListAttachmentsResponse;
433    /// use google_cloud_support_v2::model::Attachment;
434    /// let x = ListAttachmentsResponse::new()
435    ///     .set_attachments([
436    ///         Attachment::default()/* use setters */,
437    ///         Attachment::default()/* use (different) setters */,
438    ///     ]);
439    /// ```
440    pub fn set_attachments<T, V>(mut self, v: T) -> Self
441    where
442        T: std::iter::IntoIterator<Item = V>,
443        V: std::convert::Into<crate::model::Attachment>,
444    {
445        use std::iter::Iterator;
446        self.attachments = v.into_iter().map(|i| i.into()).collect();
447        self
448    }
449
450    /// Sets the value of [next_page_token][crate::model::ListAttachmentsResponse::next_page_token].
451    ///
452    /// # Example
453    /// ```ignore,no_run
454    /// # use google_cloud_support_v2::model::ListAttachmentsResponse;
455    /// let x = ListAttachmentsResponse::new().set_next_page_token("example");
456    /// ```
457    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
458        self.next_page_token = v.into();
459        self
460    }
461}
462
463impl wkt::message::Message for ListAttachmentsResponse {
464    fn typename() -> &'static str {
465        "type.googleapis.com/google.cloud.support.v2.ListAttachmentsResponse"
466    }
467}
468
469#[doc(hidden)]
470impl google_cloud_gax::paginator::internal::PageableResponse for ListAttachmentsResponse {
471    type PageItem = crate::model::Attachment;
472
473    fn items(self) -> std::vec::Vec<Self::PageItem> {
474        self.attachments
475    }
476
477    fn next_page_token(&self) -> std::string::String {
478        use std::clone::Clone;
479        self.next_page_token.clone()
480    }
481}
482
483/// A Case is an object that contains the details of a support case. It
484/// contains fields for the time it was created, its priority, its
485/// classification, and more. Cases can also have comments and attachments that
486/// get added over time.
487///
488/// A case is parented by a Google Cloud organization or project.
489///
490/// Organizations are identified by a number, so the name of a case parented by
491/// an organization would look like this:
492///
493/// ```norust
494/// organizations/123/cases/456
495/// ```
496///
497/// Projects have two unique identifiers, an ID and a number, and they look like
498/// this:
499///
500/// ```norust
501/// projects/abc/cases/456
502/// ```
503///
504/// ```norust
505/// projects/123/cases/456
506/// ```
507///
508/// You can use either of them when calling the API. To learn more
509/// about project identifiers, see [AIP-2510](https://google.aip.dev/cloud/2510).
510#[derive(Clone, Default, PartialEq)]
511#[non_exhaustive]
512pub struct Case {
513    /// Identifier. The resource name for the case.
514    pub name: std::string::String,
515
516    /// The short summary of the issue reported in this case.
517    pub display_name: std::string::String,
518
519    /// A broad description of the issue.
520    pub description: std::string::String,
521
522    /// The issue classification applicable to this case.
523    pub classification: std::option::Option<crate::model::CaseClassification>,
524
525    /// The timezone of the user who created the support case.
526    /// It should be in a format IANA recognizes: <https://www.iana.org/time-zones>.
527    /// There is no additional validation done by the API.
528    pub time_zone: std::string::String,
529
530    /// The email addresses to receive updates on this case.
531    pub subscriber_email_addresses: std::vec::Vec<std::string::String>,
532
533    /// Output only. The current status of the support case.
534    pub state: crate::model::case::State,
535
536    /// Output only. The time this case was created.
537    pub create_time: std::option::Option<wkt::Timestamp>,
538
539    /// Output only. The time this case was last updated.
540    pub update_time: std::option::Option<wkt::Timestamp>,
541
542    /// The user who created the case.
543    ///
544    /// Note: The name and email will be obfuscated if the case was created by
545    /// Google Support.
546    pub creator: std::option::Option<crate::model::Actor>,
547
548    /// A user-supplied email address to send case update notifications for. This
549    /// should only be used in BYOID flows, where we cannot infer the user's email
550    /// address directly from their EUCs.
551    pub contact_email: std::string::String,
552
553    /// Whether the case is currently escalated.
554    pub escalated: bool,
555
556    /// Whether this case was created for internal API testing and should not be
557    /// acted on by the support team.
558    pub test_case: bool,
559
560    /// The language the user has requested to receive support in. This should be a
561    /// BCP 47 language code (e.g., `"en"`, `"zh-CN"`, `"zh-TW"`, `"ja"`, `"ko"`).
562    /// If no language or an unsupported language is specified, this field defaults
563    /// to English (en).
564    ///
565    /// Language selection during case creation may affect your available support
566    /// options. For a list of supported languages and their support working hours,
567    /// see: <https://cloud.google.com/support/docs/language-working-hours>
568    pub language_code: std::string::String,
569
570    /// The priority of this case.
571    pub priority: crate::model::case::Priority,
572
573    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
574}
575
576impl Case {
577    /// Creates a new default instance.
578    pub fn new() -> Self {
579        std::default::Default::default()
580    }
581
582    /// Sets the value of [name][crate::model::Case::name].
583    ///
584    /// # Example
585    /// ```ignore,no_run
586    /// # use google_cloud_support_v2::model::Case;
587    /// # let organization_id = "organization_id";
588    /// # let case_id = "case_id";
589    /// let x = Case::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
590    /// ```
591    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
592        self.name = v.into();
593        self
594    }
595
596    /// Sets the value of [display_name][crate::model::Case::display_name].
597    ///
598    /// # Example
599    /// ```ignore,no_run
600    /// # use google_cloud_support_v2::model::Case;
601    /// let x = Case::new().set_display_name("example");
602    /// ```
603    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
604        self.display_name = v.into();
605        self
606    }
607
608    /// Sets the value of [description][crate::model::Case::description].
609    ///
610    /// # Example
611    /// ```ignore,no_run
612    /// # use google_cloud_support_v2::model::Case;
613    /// let x = Case::new().set_description("example");
614    /// ```
615    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
616        self.description = v.into();
617        self
618    }
619
620    /// Sets the value of [classification][crate::model::Case::classification].
621    ///
622    /// # Example
623    /// ```ignore,no_run
624    /// # use google_cloud_support_v2::model::Case;
625    /// use google_cloud_support_v2::model::CaseClassification;
626    /// let x = Case::new().set_classification(CaseClassification::default()/* use setters */);
627    /// ```
628    pub fn set_classification<T>(mut self, v: T) -> Self
629    where
630        T: std::convert::Into<crate::model::CaseClassification>,
631    {
632        self.classification = std::option::Option::Some(v.into());
633        self
634    }
635
636    /// Sets or clears the value of [classification][crate::model::Case::classification].
637    ///
638    /// # Example
639    /// ```ignore,no_run
640    /// # use google_cloud_support_v2::model::Case;
641    /// use google_cloud_support_v2::model::CaseClassification;
642    /// let x = Case::new().set_or_clear_classification(Some(CaseClassification::default()/* use setters */));
643    /// let x = Case::new().set_or_clear_classification(None::<CaseClassification>);
644    /// ```
645    pub fn set_or_clear_classification<T>(mut self, v: std::option::Option<T>) -> Self
646    where
647        T: std::convert::Into<crate::model::CaseClassification>,
648    {
649        self.classification = v.map(|x| x.into());
650        self
651    }
652
653    /// Sets the value of [time_zone][crate::model::Case::time_zone].
654    ///
655    /// # Example
656    /// ```ignore,no_run
657    /// # use google_cloud_support_v2::model::Case;
658    /// let x = Case::new().set_time_zone("example");
659    /// ```
660    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
661        self.time_zone = v.into();
662        self
663    }
664
665    /// Sets the value of [subscriber_email_addresses][crate::model::Case::subscriber_email_addresses].
666    ///
667    /// # Example
668    /// ```ignore,no_run
669    /// # use google_cloud_support_v2::model::Case;
670    /// let x = Case::new().set_subscriber_email_addresses(["a", "b", "c"]);
671    /// ```
672    pub fn set_subscriber_email_addresses<T, V>(mut self, v: T) -> Self
673    where
674        T: std::iter::IntoIterator<Item = V>,
675        V: std::convert::Into<std::string::String>,
676    {
677        use std::iter::Iterator;
678        self.subscriber_email_addresses = v.into_iter().map(|i| i.into()).collect();
679        self
680    }
681
682    /// Sets the value of [state][crate::model::Case::state].
683    ///
684    /// # Example
685    /// ```ignore,no_run
686    /// # use google_cloud_support_v2::model::Case;
687    /// use google_cloud_support_v2::model::case::State;
688    /// let x0 = Case::new().set_state(State::New);
689    /// let x1 = Case::new().set_state(State::InProgressGoogleSupport);
690    /// let x2 = Case::new().set_state(State::ActionRequired);
691    /// ```
692    pub fn set_state<T: std::convert::Into<crate::model::case::State>>(mut self, v: T) -> Self {
693        self.state = v.into();
694        self
695    }
696
697    /// Sets the value of [create_time][crate::model::Case::create_time].
698    ///
699    /// # Example
700    /// ```ignore,no_run
701    /// # use google_cloud_support_v2::model::Case;
702    /// use wkt::Timestamp;
703    /// let x = Case::new().set_create_time(Timestamp::default()/* use setters */);
704    /// ```
705    pub fn set_create_time<T>(mut self, v: T) -> Self
706    where
707        T: std::convert::Into<wkt::Timestamp>,
708    {
709        self.create_time = std::option::Option::Some(v.into());
710        self
711    }
712
713    /// Sets or clears the value of [create_time][crate::model::Case::create_time].
714    ///
715    /// # Example
716    /// ```ignore,no_run
717    /// # use google_cloud_support_v2::model::Case;
718    /// use wkt::Timestamp;
719    /// let x = Case::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
720    /// let x = Case::new().set_or_clear_create_time(None::<Timestamp>);
721    /// ```
722    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
723    where
724        T: std::convert::Into<wkt::Timestamp>,
725    {
726        self.create_time = v.map(|x| x.into());
727        self
728    }
729
730    /// Sets the value of [update_time][crate::model::Case::update_time].
731    ///
732    /// # Example
733    /// ```ignore,no_run
734    /// # use google_cloud_support_v2::model::Case;
735    /// use wkt::Timestamp;
736    /// let x = Case::new().set_update_time(Timestamp::default()/* use setters */);
737    /// ```
738    pub fn set_update_time<T>(mut self, v: T) -> Self
739    where
740        T: std::convert::Into<wkt::Timestamp>,
741    {
742        self.update_time = std::option::Option::Some(v.into());
743        self
744    }
745
746    /// Sets or clears the value of [update_time][crate::model::Case::update_time].
747    ///
748    /// # Example
749    /// ```ignore,no_run
750    /// # use google_cloud_support_v2::model::Case;
751    /// use wkt::Timestamp;
752    /// let x = Case::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
753    /// let x = Case::new().set_or_clear_update_time(None::<Timestamp>);
754    /// ```
755    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
756    where
757        T: std::convert::Into<wkt::Timestamp>,
758    {
759        self.update_time = v.map(|x| x.into());
760        self
761    }
762
763    /// Sets the value of [creator][crate::model::Case::creator].
764    ///
765    /// # Example
766    /// ```ignore,no_run
767    /// # use google_cloud_support_v2::model::Case;
768    /// use google_cloud_support_v2::model::Actor;
769    /// let x = Case::new().set_creator(Actor::default()/* use setters */);
770    /// ```
771    pub fn set_creator<T>(mut self, v: T) -> Self
772    where
773        T: std::convert::Into<crate::model::Actor>,
774    {
775        self.creator = std::option::Option::Some(v.into());
776        self
777    }
778
779    /// Sets or clears the value of [creator][crate::model::Case::creator].
780    ///
781    /// # Example
782    /// ```ignore,no_run
783    /// # use google_cloud_support_v2::model::Case;
784    /// use google_cloud_support_v2::model::Actor;
785    /// let x = Case::new().set_or_clear_creator(Some(Actor::default()/* use setters */));
786    /// let x = Case::new().set_or_clear_creator(None::<Actor>);
787    /// ```
788    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
789    where
790        T: std::convert::Into<crate::model::Actor>,
791    {
792        self.creator = v.map(|x| x.into());
793        self
794    }
795
796    /// Sets the value of [contact_email][crate::model::Case::contact_email].
797    ///
798    /// # Example
799    /// ```ignore,no_run
800    /// # use google_cloud_support_v2::model::Case;
801    /// let x = Case::new().set_contact_email("example");
802    /// ```
803    pub fn set_contact_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
804        self.contact_email = v.into();
805        self
806    }
807
808    /// Sets the value of [escalated][crate::model::Case::escalated].
809    ///
810    /// # Example
811    /// ```ignore,no_run
812    /// # use google_cloud_support_v2::model::Case;
813    /// let x = Case::new().set_escalated(true);
814    /// ```
815    pub fn set_escalated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
816        self.escalated = v.into();
817        self
818    }
819
820    /// Sets the value of [test_case][crate::model::Case::test_case].
821    ///
822    /// # Example
823    /// ```ignore,no_run
824    /// # use google_cloud_support_v2::model::Case;
825    /// let x = Case::new().set_test_case(true);
826    /// ```
827    pub fn set_test_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
828        self.test_case = v.into();
829        self
830    }
831
832    /// Sets the value of [language_code][crate::model::Case::language_code].
833    ///
834    /// # Example
835    /// ```ignore,no_run
836    /// # use google_cloud_support_v2::model::Case;
837    /// let x = Case::new().set_language_code("example");
838    /// ```
839    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
840        self.language_code = v.into();
841        self
842    }
843
844    /// Sets the value of [priority][crate::model::Case::priority].
845    ///
846    /// # Example
847    /// ```ignore,no_run
848    /// # use google_cloud_support_v2::model::Case;
849    /// use google_cloud_support_v2::model::case::Priority;
850    /// let x0 = Case::new().set_priority(Priority::P0);
851    /// let x1 = Case::new().set_priority(Priority::P1);
852    /// let x2 = Case::new().set_priority(Priority::P2);
853    /// ```
854    pub fn set_priority<T: std::convert::Into<crate::model::case::Priority>>(
855        mut self,
856        v: T,
857    ) -> Self {
858        self.priority = v.into();
859        self
860    }
861}
862
863impl wkt::message::Message for Case {
864    fn typename() -> &'static str {
865        "type.googleapis.com/google.cloud.support.v2.Case"
866    }
867}
868
869/// Defines additional types related to [Case].
870pub mod case {
871    #[allow(unused_imports)]
872    use super::*;
873
874    /// The status of a support case.
875    ///
876    /// # Working with unknown values
877    ///
878    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
879    /// additional enum variants at any time. Adding new variants is not considered
880    /// a breaking change. Applications should write their code in anticipation of:
881    ///
882    /// - New values appearing in future releases of the client library, **and**
883    /// - New values received dynamically, without application changes.
884    ///
885    /// Please consult the [Working with enums] section in the user guide for some
886    /// guidelines.
887    ///
888    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
889    #[derive(Clone, Debug, PartialEq)]
890    #[non_exhaustive]
891    pub enum State {
892        /// Case is in an unknown state.
893        Unspecified,
894        /// The case has been created but no one is assigned to work on it yet.
895        New,
896        /// The case is currently being handled by Google support.
897        InProgressGoogleSupport,
898        /// Google is waiting for a response.
899        ActionRequired,
900        /// A solution has been offered for the case, but it isn't yet closed.
901        SolutionProvided,
902        /// The case has been resolved.
903        Closed,
904        /// If set, the enum was initialized with an unknown value.
905        ///
906        /// Applications can examine the value using [State::value] or
907        /// [State::name].
908        UnknownValue(state::UnknownValue),
909    }
910
911    #[doc(hidden)]
912    pub mod state {
913        #[allow(unused_imports)]
914        use super::*;
915        #[derive(Clone, Debug, PartialEq)]
916        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
917    }
918
919    impl State {
920        /// Gets the enum value.
921        ///
922        /// Returns `None` if the enum contains an unknown value deserialized from
923        /// the string representation of enums.
924        pub fn value(&self) -> std::option::Option<i32> {
925            match self {
926                Self::Unspecified => std::option::Option::Some(0),
927                Self::New => std::option::Option::Some(1),
928                Self::InProgressGoogleSupport => std::option::Option::Some(2),
929                Self::ActionRequired => std::option::Option::Some(3),
930                Self::SolutionProvided => std::option::Option::Some(4),
931                Self::Closed => std::option::Option::Some(5),
932                Self::UnknownValue(u) => u.0.value(),
933            }
934        }
935
936        /// Gets the enum value as a string.
937        ///
938        /// Returns `None` if the enum contains an unknown value deserialized from
939        /// the integer representation of enums.
940        pub fn name(&self) -> std::option::Option<&str> {
941            match self {
942                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
943                Self::New => std::option::Option::Some("NEW"),
944                Self::InProgressGoogleSupport => {
945                    std::option::Option::Some("IN_PROGRESS_GOOGLE_SUPPORT")
946                }
947                Self::ActionRequired => std::option::Option::Some("ACTION_REQUIRED"),
948                Self::SolutionProvided => std::option::Option::Some("SOLUTION_PROVIDED"),
949                Self::Closed => std::option::Option::Some("CLOSED"),
950                Self::UnknownValue(u) => u.0.name(),
951            }
952        }
953    }
954
955    impl std::default::Default for State {
956        fn default() -> Self {
957            use std::convert::From;
958            Self::from(0)
959        }
960    }
961
962    impl std::fmt::Display for State {
963        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
964            wkt::internal::display_enum(f, self.name(), self.value())
965        }
966    }
967
968    impl std::convert::From<i32> for State {
969        fn from(value: i32) -> Self {
970            match value {
971                0 => Self::Unspecified,
972                1 => Self::New,
973                2 => Self::InProgressGoogleSupport,
974                3 => Self::ActionRequired,
975                4 => Self::SolutionProvided,
976                5 => Self::Closed,
977                _ => Self::UnknownValue(state::UnknownValue(
978                    wkt::internal::UnknownEnumValue::Integer(value),
979                )),
980            }
981        }
982    }
983
984    impl std::convert::From<&str> for State {
985        fn from(value: &str) -> Self {
986            use std::string::ToString;
987            match value {
988                "STATE_UNSPECIFIED" => Self::Unspecified,
989                "NEW" => Self::New,
990                "IN_PROGRESS_GOOGLE_SUPPORT" => Self::InProgressGoogleSupport,
991                "ACTION_REQUIRED" => Self::ActionRequired,
992                "SOLUTION_PROVIDED" => Self::SolutionProvided,
993                "CLOSED" => Self::Closed,
994                _ => Self::UnknownValue(state::UnknownValue(
995                    wkt::internal::UnknownEnumValue::String(value.to_string()),
996                )),
997            }
998        }
999    }
1000
1001    impl serde::ser::Serialize for State {
1002        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1003        where
1004            S: serde::Serializer,
1005        {
1006            match self {
1007                Self::Unspecified => serializer.serialize_i32(0),
1008                Self::New => serializer.serialize_i32(1),
1009                Self::InProgressGoogleSupport => serializer.serialize_i32(2),
1010                Self::ActionRequired => serializer.serialize_i32(3),
1011                Self::SolutionProvided => serializer.serialize_i32(4),
1012                Self::Closed => serializer.serialize_i32(5),
1013                Self::UnknownValue(u) => u.0.serialize(serializer),
1014            }
1015        }
1016    }
1017
1018    impl<'de> serde::de::Deserialize<'de> for State {
1019        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1020        where
1021            D: serde::Deserializer<'de>,
1022        {
1023            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1024                ".google.cloud.support.v2.Case.State",
1025            ))
1026        }
1027    }
1028
1029    /// The case Priority. P0 is most urgent and P4 the least.
1030    ///
1031    /// # Working with unknown values
1032    ///
1033    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1034    /// additional enum variants at any time. Adding new variants is not considered
1035    /// a breaking change. Applications should write their code in anticipation of:
1036    ///
1037    /// - New values appearing in future releases of the client library, **and**
1038    /// - New values received dynamically, without application changes.
1039    ///
1040    /// Please consult the [Working with enums] section in the user guide for some
1041    /// guidelines.
1042    ///
1043    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1044    #[derive(Clone, Debug, PartialEq)]
1045    #[non_exhaustive]
1046    pub enum Priority {
1047        /// Priority is undefined or has not been set yet.
1048        Unspecified,
1049        /// Extreme impact on a production service. Service is hard down.
1050        P0,
1051        /// Critical impact on a production service. Service is currently unusable.
1052        P1,
1053        /// Severe impact on a production service. Service is usable but greatly
1054        /// impaired.
1055        P2,
1056        /// Medium impact on a production service.  Service is available, but
1057        /// moderately impaired.
1058        P3,
1059        /// General questions or minor issues.  Production service is fully
1060        /// available.
1061        P4,
1062        /// If set, the enum was initialized with an unknown value.
1063        ///
1064        /// Applications can examine the value using [Priority::value] or
1065        /// [Priority::name].
1066        UnknownValue(priority::UnknownValue),
1067    }
1068
1069    #[doc(hidden)]
1070    pub mod priority {
1071        #[allow(unused_imports)]
1072        use super::*;
1073        #[derive(Clone, Debug, PartialEq)]
1074        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1075    }
1076
1077    impl Priority {
1078        /// Gets the enum value.
1079        ///
1080        /// Returns `None` if the enum contains an unknown value deserialized from
1081        /// the string representation of enums.
1082        pub fn value(&self) -> std::option::Option<i32> {
1083            match self {
1084                Self::Unspecified => std::option::Option::Some(0),
1085                Self::P0 => std::option::Option::Some(1),
1086                Self::P1 => std::option::Option::Some(2),
1087                Self::P2 => std::option::Option::Some(3),
1088                Self::P3 => std::option::Option::Some(4),
1089                Self::P4 => std::option::Option::Some(5),
1090                Self::UnknownValue(u) => u.0.value(),
1091            }
1092        }
1093
1094        /// Gets the enum value as a string.
1095        ///
1096        /// Returns `None` if the enum contains an unknown value deserialized from
1097        /// the integer representation of enums.
1098        pub fn name(&self) -> std::option::Option<&str> {
1099            match self {
1100                Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
1101                Self::P0 => std::option::Option::Some("P0"),
1102                Self::P1 => std::option::Option::Some("P1"),
1103                Self::P2 => std::option::Option::Some("P2"),
1104                Self::P3 => std::option::Option::Some("P3"),
1105                Self::P4 => std::option::Option::Some("P4"),
1106                Self::UnknownValue(u) => u.0.name(),
1107            }
1108        }
1109    }
1110
1111    impl std::default::Default for Priority {
1112        fn default() -> Self {
1113            use std::convert::From;
1114            Self::from(0)
1115        }
1116    }
1117
1118    impl std::fmt::Display for Priority {
1119        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1120            wkt::internal::display_enum(f, self.name(), self.value())
1121        }
1122    }
1123
1124    impl std::convert::From<i32> for Priority {
1125        fn from(value: i32) -> Self {
1126            match value {
1127                0 => Self::Unspecified,
1128                1 => Self::P0,
1129                2 => Self::P1,
1130                3 => Self::P2,
1131                4 => Self::P3,
1132                5 => Self::P4,
1133                _ => Self::UnknownValue(priority::UnknownValue(
1134                    wkt::internal::UnknownEnumValue::Integer(value),
1135                )),
1136            }
1137        }
1138    }
1139
1140    impl std::convert::From<&str> for Priority {
1141        fn from(value: &str) -> Self {
1142            use std::string::ToString;
1143            match value {
1144                "PRIORITY_UNSPECIFIED" => Self::Unspecified,
1145                "P0" => Self::P0,
1146                "P1" => Self::P1,
1147                "P2" => Self::P2,
1148                "P3" => Self::P3,
1149                "P4" => Self::P4,
1150                _ => Self::UnknownValue(priority::UnknownValue(
1151                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1152                )),
1153            }
1154        }
1155    }
1156
1157    impl serde::ser::Serialize for Priority {
1158        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1159        where
1160            S: serde::Serializer,
1161        {
1162            match self {
1163                Self::Unspecified => serializer.serialize_i32(0),
1164                Self::P0 => serializer.serialize_i32(1),
1165                Self::P1 => serializer.serialize_i32(2),
1166                Self::P2 => serializer.serialize_i32(3),
1167                Self::P3 => serializer.serialize_i32(4),
1168                Self::P4 => serializer.serialize_i32(5),
1169                Self::UnknownValue(u) => u.0.serialize(serializer),
1170            }
1171        }
1172    }
1173
1174    impl<'de> serde::de::Deserialize<'de> for Priority {
1175        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1176        where
1177            D: serde::Deserializer<'de>,
1178        {
1179            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
1180                ".google.cloud.support.v2.Case.Priority",
1181            ))
1182        }
1183    }
1184}
1185
1186/// A Case Classification represents the topic that a case is about. It's very
1187/// important to use accurate classifications, because they're
1188/// used to route your cases to specialists who can help you.
1189///
1190/// A classification always has an ID that is its unique identifier.
1191/// A valid ID is required when creating a case.
1192#[derive(Clone, Default, PartialEq)]
1193#[non_exhaustive]
1194pub struct CaseClassification {
1195    /// The unique ID for a classification. Must be specified for case creation.
1196    ///
1197    /// To retrieve valid classification IDs for case creation, use
1198    /// `caseClassifications.search`.
1199    ///
1200    /// Classification IDs returned by `caseClassifications.search` are guaranteed
1201    /// to be valid for at least 6 months. If a given classification is
1202    /// deactiveated, it will immediately stop being returned. After 6 months,
1203    /// `case.create` requests using the classification ID will fail.
1204    pub id: std::string::String,
1205
1206    /// A display name for the classification.
1207    ///
1208    /// The display name is not static and can change. To uniquely and consistently
1209    /// identify classifications, use the `CaseClassification.id` field.
1210    pub display_name: std::string::String,
1211
1212    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1213}
1214
1215impl CaseClassification {
1216    /// Creates a new default instance.
1217    pub fn new() -> Self {
1218        std::default::Default::default()
1219    }
1220
1221    /// Sets the value of [id][crate::model::CaseClassification::id].
1222    ///
1223    /// # Example
1224    /// ```ignore,no_run
1225    /// # use google_cloud_support_v2::model::CaseClassification;
1226    /// let x = CaseClassification::new().set_id("example");
1227    /// ```
1228    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1229        self.id = v.into();
1230        self
1231    }
1232
1233    /// Sets the value of [display_name][crate::model::CaseClassification::display_name].
1234    ///
1235    /// # Example
1236    /// ```ignore,no_run
1237    /// # use google_cloud_support_v2::model::CaseClassification;
1238    /// let x = CaseClassification::new().set_display_name("example");
1239    /// ```
1240    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1241        self.display_name = v.into();
1242        self
1243    }
1244}
1245
1246impl wkt::message::Message for CaseClassification {
1247    fn typename() -> &'static str {
1248        "type.googleapis.com/google.cloud.support.v2.CaseClassification"
1249    }
1250}
1251
1252/// The request message for the GetCase endpoint.
1253#[derive(Clone, Default, PartialEq)]
1254#[non_exhaustive]
1255pub struct GetCaseRequest {
1256    /// Required. The full name of a case to be retrieved.
1257    pub name: std::string::String,
1258
1259    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1260}
1261
1262impl GetCaseRequest {
1263    /// Creates a new default instance.
1264    pub fn new() -> Self {
1265        std::default::Default::default()
1266    }
1267
1268    /// Sets the value of [name][crate::model::GetCaseRequest::name].
1269    ///
1270    /// # Example
1271    /// ```ignore,no_run
1272    /// # use google_cloud_support_v2::model::GetCaseRequest;
1273    /// # let organization_id = "organization_id";
1274    /// # let case_id = "case_id";
1275    /// let x = GetCaseRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
1276    /// ```
1277    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1278        self.name = v.into();
1279        self
1280    }
1281}
1282
1283impl wkt::message::Message for GetCaseRequest {
1284    fn typename() -> &'static str {
1285        "type.googleapis.com/google.cloud.support.v2.GetCaseRequest"
1286    }
1287}
1288
1289/// The request message for the CreateCase endpoint.
1290#[derive(Clone, Default, PartialEq)]
1291#[non_exhaustive]
1292pub struct CreateCaseRequest {
1293    /// Required. The name of the parent under which the case should be created.
1294    pub parent: std::string::String,
1295
1296    /// Required. The case to be created.
1297    pub case: std::option::Option<crate::model::Case>,
1298
1299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1300}
1301
1302impl CreateCaseRequest {
1303    /// Creates a new default instance.
1304    pub fn new() -> Self {
1305        std::default::Default::default()
1306    }
1307
1308    /// Sets the value of [parent][crate::model::CreateCaseRequest::parent].
1309    ///
1310    /// # Example
1311    /// ```ignore,no_run
1312    /// # use google_cloud_support_v2::model::CreateCaseRequest;
1313    /// # let organization_id = "organization_id";
1314    /// let x = CreateCaseRequest::new().set_parent(format!("organizations/{organization_id}"));
1315    /// ```
1316    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1317        self.parent = v.into();
1318        self
1319    }
1320
1321    /// Sets the value of [case][crate::model::CreateCaseRequest::case].
1322    ///
1323    /// # Example
1324    /// ```ignore,no_run
1325    /// # use google_cloud_support_v2::model::CreateCaseRequest;
1326    /// use google_cloud_support_v2::model::Case;
1327    /// let x = CreateCaseRequest::new().set_case(Case::default()/* use setters */);
1328    /// ```
1329    pub fn set_case<T>(mut self, v: T) -> Self
1330    where
1331        T: std::convert::Into<crate::model::Case>,
1332    {
1333        self.case = std::option::Option::Some(v.into());
1334        self
1335    }
1336
1337    /// Sets or clears the value of [case][crate::model::CreateCaseRequest::case].
1338    ///
1339    /// # Example
1340    /// ```ignore,no_run
1341    /// # use google_cloud_support_v2::model::CreateCaseRequest;
1342    /// use google_cloud_support_v2::model::Case;
1343    /// let x = CreateCaseRequest::new().set_or_clear_case(Some(Case::default()/* use setters */));
1344    /// let x = CreateCaseRequest::new().set_or_clear_case(None::<Case>);
1345    /// ```
1346    pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
1347    where
1348        T: std::convert::Into<crate::model::Case>,
1349    {
1350        self.case = v.map(|x| x.into());
1351        self
1352    }
1353}
1354
1355impl wkt::message::Message for CreateCaseRequest {
1356    fn typename() -> &'static str {
1357        "type.googleapis.com/google.cloud.support.v2.CreateCaseRequest"
1358    }
1359}
1360
1361/// The request message for the ListCases endpoint.
1362#[derive(Clone, Default, PartialEq)]
1363#[non_exhaustive]
1364pub struct ListCasesRequest {
1365    /// Required. The name of a parent to list cases under.
1366    pub parent: std::string::String,
1367
1368    /// An expression used to filter cases.
1369    ///
1370    /// If it's an empty string, then no filtering happens. Otherwise, the endpoint
1371    /// returns the cases that match the filter.
1372    ///
1373    /// Expressions use the following fields separated by `AND` and specified with
1374    /// `=`:
1375    ///
1376    /// - `state`: Can be `OPEN` or `CLOSED`.
1377    /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
1378    ///   can specify multiple values for priority using the `OR` operator. For
1379    ///   example, `priority=P1 OR priority=P2`.
1380    /// - `creator.email`: The email address of the case creator.
1381    ///
1382    /// EXAMPLES:
1383    ///
1384    /// - `state=CLOSED`
1385    /// - `state=OPEN AND creator.email="tester@example.com"`
1386    /// - `state=OPEN AND (priority=P0 OR priority=P1)`
1387    pub filter: std::string::String,
1388
1389    /// The maximum number of cases fetched with each request. Defaults to 10.
1390    pub page_size: i32,
1391
1392    /// A token identifying the page of results to return. If unspecified, the
1393    /// first page is retrieved.
1394    pub page_token: std::string::String,
1395
1396    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1397}
1398
1399impl ListCasesRequest {
1400    /// Creates a new default instance.
1401    pub fn new() -> Self {
1402        std::default::Default::default()
1403    }
1404
1405    /// Sets the value of [parent][crate::model::ListCasesRequest::parent].
1406    ///
1407    /// # Example
1408    /// ```ignore,no_run
1409    /// # use google_cloud_support_v2::model::ListCasesRequest;
1410    /// # let organization_id = "organization_id";
1411    /// let x = ListCasesRequest::new().set_parent(format!("organizations/{organization_id}"));
1412    /// ```
1413    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1414        self.parent = v.into();
1415        self
1416    }
1417
1418    /// Sets the value of [filter][crate::model::ListCasesRequest::filter].
1419    ///
1420    /// # Example
1421    /// ```ignore,no_run
1422    /// # use google_cloud_support_v2::model::ListCasesRequest;
1423    /// let x = ListCasesRequest::new().set_filter("example");
1424    /// ```
1425    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1426        self.filter = v.into();
1427        self
1428    }
1429
1430    /// Sets the value of [page_size][crate::model::ListCasesRequest::page_size].
1431    ///
1432    /// # Example
1433    /// ```ignore,no_run
1434    /// # use google_cloud_support_v2::model::ListCasesRequest;
1435    /// let x = ListCasesRequest::new().set_page_size(42);
1436    /// ```
1437    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1438        self.page_size = v.into();
1439        self
1440    }
1441
1442    /// Sets the value of [page_token][crate::model::ListCasesRequest::page_token].
1443    ///
1444    /// # Example
1445    /// ```ignore,no_run
1446    /// # use google_cloud_support_v2::model::ListCasesRequest;
1447    /// let x = ListCasesRequest::new().set_page_token("example");
1448    /// ```
1449    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1450        self.page_token = v.into();
1451        self
1452    }
1453}
1454
1455impl wkt::message::Message for ListCasesRequest {
1456    fn typename() -> &'static str {
1457        "type.googleapis.com/google.cloud.support.v2.ListCasesRequest"
1458    }
1459}
1460
1461/// The response message for the ListCases endpoint.
1462#[derive(Clone, Default, PartialEq)]
1463#[non_exhaustive]
1464pub struct ListCasesResponse {
1465    /// The list of cases associated with the parent after any
1466    /// filters have been applied.
1467    pub cases: std::vec::Vec<crate::model::Case>,
1468
1469    /// A token to retrieve the next page of results. Set this in the `page_token`
1470    /// field of subsequent `cases.list` requests. If unspecified, there are no
1471    /// more results to retrieve.
1472    pub next_page_token: std::string::String,
1473
1474    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1475}
1476
1477impl ListCasesResponse {
1478    /// Creates a new default instance.
1479    pub fn new() -> Self {
1480        std::default::Default::default()
1481    }
1482
1483    /// Sets the value of [cases][crate::model::ListCasesResponse::cases].
1484    ///
1485    /// # Example
1486    /// ```ignore,no_run
1487    /// # use google_cloud_support_v2::model::ListCasesResponse;
1488    /// use google_cloud_support_v2::model::Case;
1489    /// let x = ListCasesResponse::new()
1490    ///     .set_cases([
1491    ///         Case::default()/* use setters */,
1492    ///         Case::default()/* use (different) setters */,
1493    ///     ]);
1494    /// ```
1495    pub fn set_cases<T, V>(mut self, v: T) -> Self
1496    where
1497        T: std::iter::IntoIterator<Item = V>,
1498        V: std::convert::Into<crate::model::Case>,
1499    {
1500        use std::iter::Iterator;
1501        self.cases = v.into_iter().map(|i| i.into()).collect();
1502        self
1503    }
1504
1505    /// Sets the value of [next_page_token][crate::model::ListCasesResponse::next_page_token].
1506    ///
1507    /// # Example
1508    /// ```ignore,no_run
1509    /// # use google_cloud_support_v2::model::ListCasesResponse;
1510    /// let x = ListCasesResponse::new().set_next_page_token("example");
1511    /// ```
1512    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1513        self.next_page_token = v.into();
1514        self
1515    }
1516}
1517
1518impl wkt::message::Message for ListCasesResponse {
1519    fn typename() -> &'static str {
1520        "type.googleapis.com/google.cloud.support.v2.ListCasesResponse"
1521    }
1522}
1523
1524#[doc(hidden)]
1525impl google_cloud_gax::paginator::internal::PageableResponse for ListCasesResponse {
1526    type PageItem = crate::model::Case;
1527
1528    fn items(self) -> std::vec::Vec<Self::PageItem> {
1529        self.cases
1530    }
1531
1532    fn next_page_token(&self) -> std::string::String {
1533        use std::clone::Clone;
1534        self.next_page_token.clone()
1535    }
1536}
1537
1538/// The request message for the SearchCases endpoint.
1539#[derive(Clone, Default, PartialEq)]
1540#[non_exhaustive]
1541pub struct SearchCasesRequest {
1542    /// The name of the parent resource to search for cases under.
1543    pub parent: std::string::String,
1544
1545    /// An expression used to filter cases.
1546    ///
1547    /// Expressions use the following fields separated by `AND` and specified with
1548    /// `=`:
1549    ///
1550    /// - `organization`: An organization name in the form
1551    ///   `organizations/<organization_id>`.
1552    /// - `project`: A project name in the form `projects/<project_id>`.
1553    /// - `state`: Can be `OPEN` or `CLOSED`.
1554    /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
1555    ///   can specify multiple values for priority using the `OR` operator. For
1556    ///   example, `priority=P1 OR priority=P2`.
1557    /// - `creator.email`: The email address of the case creator.
1558    ///
1559    /// You must specify either `organization` or `project`.
1560    ///
1561    /// To search across `displayName`, `description`, and comments, use a global
1562    /// restriction with no keyword or operator. For example, `"my search"`.
1563    ///
1564    /// To search only cases updated after a certain date, use `update_time`
1565    /// restricted with that particular date, time, and timezone in ISO datetime
1566    /// format. For example, `update_time>"2020-01-01T00:00:00-05:00"`.
1567    /// `update_time` only supports the greater than operator (`>`).
1568    ///
1569    /// Examples:
1570    ///
1571    /// - `organization="organizations/123456789"`
1572    /// - `project="projects/my-project-id"`
1573    /// - `project="projects/123456789"`
1574    /// - `organization="organizations/123456789" AND state=CLOSED`
1575    /// - `project="projects/my-project-id" AND creator.email="tester@example.com"`
1576    /// - `project="projects/my-project-id" AND (priority=P0 OR priority=P1)`
1577    pub query: std::string::String,
1578
1579    /// The maximum number of cases fetched with each request. The default page
1580    /// size is 10.
1581    pub page_size: i32,
1582
1583    /// A token identifying the page of results to return. If unspecified, the
1584    /// first page is retrieved.
1585    pub page_token: std::string::String,
1586
1587    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1588}
1589
1590impl SearchCasesRequest {
1591    /// Creates a new default instance.
1592    pub fn new() -> Self {
1593        std::default::Default::default()
1594    }
1595
1596    /// Sets the value of [parent][crate::model::SearchCasesRequest::parent].
1597    ///
1598    /// # Example
1599    /// ```ignore,no_run
1600    /// # use google_cloud_support_v2::model::SearchCasesRequest;
1601    /// let x = SearchCasesRequest::new().set_parent("example");
1602    /// ```
1603    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1604        self.parent = v.into();
1605        self
1606    }
1607
1608    /// Sets the value of [query][crate::model::SearchCasesRequest::query].
1609    ///
1610    /// # Example
1611    /// ```ignore,no_run
1612    /// # use google_cloud_support_v2::model::SearchCasesRequest;
1613    /// let x = SearchCasesRequest::new().set_query("example");
1614    /// ```
1615    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1616        self.query = v.into();
1617        self
1618    }
1619
1620    /// Sets the value of [page_size][crate::model::SearchCasesRequest::page_size].
1621    ///
1622    /// # Example
1623    /// ```ignore,no_run
1624    /// # use google_cloud_support_v2::model::SearchCasesRequest;
1625    /// let x = SearchCasesRequest::new().set_page_size(42);
1626    /// ```
1627    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1628        self.page_size = v.into();
1629        self
1630    }
1631
1632    /// Sets the value of [page_token][crate::model::SearchCasesRequest::page_token].
1633    ///
1634    /// # Example
1635    /// ```ignore,no_run
1636    /// # use google_cloud_support_v2::model::SearchCasesRequest;
1637    /// let x = SearchCasesRequest::new().set_page_token("example");
1638    /// ```
1639    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1640        self.page_token = v.into();
1641        self
1642    }
1643}
1644
1645impl wkt::message::Message for SearchCasesRequest {
1646    fn typename() -> &'static str {
1647        "type.googleapis.com/google.cloud.support.v2.SearchCasesRequest"
1648    }
1649}
1650
1651/// The response message for the SearchCases endpoint.
1652#[derive(Clone, Default, PartialEq)]
1653#[non_exhaustive]
1654pub struct SearchCasesResponse {
1655    /// The list of cases associated with the parent after any
1656    /// filters have been applied.
1657    pub cases: std::vec::Vec<crate::model::Case>,
1658
1659    /// A token to retrieve the next page of results. Set this in the
1660    /// `page_token` field of subsequent `cases.search` requests. If unspecified,
1661    /// there are no more results to retrieve.
1662    pub next_page_token: std::string::String,
1663
1664    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1665}
1666
1667impl SearchCasesResponse {
1668    /// Creates a new default instance.
1669    pub fn new() -> Self {
1670        std::default::Default::default()
1671    }
1672
1673    /// Sets the value of [cases][crate::model::SearchCasesResponse::cases].
1674    ///
1675    /// # Example
1676    /// ```ignore,no_run
1677    /// # use google_cloud_support_v2::model::SearchCasesResponse;
1678    /// use google_cloud_support_v2::model::Case;
1679    /// let x = SearchCasesResponse::new()
1680    ///     .set_cases([
1681    ///         Case::default()/* use setters */,
1682    ///         Case::default()/* use (different) setters */,
1683    ///     ]);
1684    /// ```
1685    pub fn set_cases<T, V>(mut self, v: T) -> Self
1686    where
1687        T: std::iter::IntoIterator<Item = V>,
1688        V: std::convert::Into<crate::model::Case>,
1689    {
1690        use std::iter::Iterator;
1691        self.cases = v.into_iter().map(|i| i.into()).collect();
1692        self
1693    }
1694
1695    /// Sets the value of [next_page_token][crate::model::SearchCasesResponse::next_page_token].
1696    ///
1697    /// # Example
1698    /// ```ignore,no_run
1699    /// # use google_cloud_support_v2::model::SearchCasesResponse;
1700    /// let x = SearchCasesResponse::new().set_next_page_token("example");
1701    /// ```
1702    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1703        self.next_page_token = v.into();
1704        self
1705    }
1706}
1707
1708impl wkt::message::Message for SearchCasesResponse {
1709    fn typename() -> &'static str {
1710        "type.googleapis.com/google.cloud.support.v2.SearchCasesResponse"
1711    }
1712}
1713
1714#[doc(hidden)]
1715impl google_cloud_gax::paginator::internal::PageableResponse for SearchCasesResponse {
1716    type PageItem = crate::model::Case;
1717
1718    fn items(self) -> std::vec::Vec<Self::PageItem> {
1719        self.cases
1720    }
1721
1722    fn next_page_token(&self) -> std::string::String {
1723        use std::clone::Clone;
1724        self.next_page_token.clone()
1725    }
1726}
1727
1728/// The request message for the EscalateCase endpoint.
1729#[derive(Clone, Default, PartialEq)]
1730#[non_exhaustive]
1731pub struct EscalateCaseRequest {
1732    /// Required. The name of the case to be escalated.
1733    pub name: std::string::String,
1734
1735    /// The escalation information to be sent with the escalation request.
1736    pub escalation: std::option::Option<crate::model::Escalation>,
1737
1738    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1739}
1740
1741impl EscalateCaseRequest {
1742    /// Creates a new default instance.
1743    pub fn new() -> Self {
1744        std::default::Default::default()
1745    }
1746
1747    /// Sets the value of [name][crate::model::EscalateCaseRequest::name].
1748    ///
1749    /// # Example
1750    /// ```ignore,no_run
1751    /// # use google_cloud_support_v2::model::EscalateCaseRequest;
1752    /// # let organization_id = "organization_id";
1753    /// # let case_id = "case_id";
1754    /// let x = EscalateCaseRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
1755    /// ```
1756    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1757        self.name = v.into();
1758        self
1759    }
1760
1761    /// Sets the value of [escalation][crate::model::EscalateCaseRequest::escalation].
1762    ///
1763    /// # Example
1764    /// ```ignore,no_run
1765    /// # use google_cloud_support_v2::model::EscalateCaseRequest;
1766    /// use google_cloud_support_v2::model::Escalation;
1767    /// let x = EscalateCaseRequest::new().set_escalation(Escalation::default()/* use setters */);
1768    /// ```
1769    pub fn set_escalation<T>(mut self, v: T) -> Self
1770    where
1771        T: std::convert::Into<crate::model::Escalation>,
1772    {
1773        self.escalation = std::option::Option::Some(v.into());
1774        self
1775    }
1776
1777    /// Sets or clears the value of [escalation][crate::model::EscalateCaseRequest::escalation].
1778    ///
1779    /// # Example
1780    /// ```ignore,no_run
1781    /// # use google_cloud_support_v2::model::EscalateCaseRequest;
1782    /// use google_cloud_support_v2::model::Escalation;
1783    /// let x = EscalateCaseRequest::new().set_or_clear_escalation(Some(Escalation::default()/* use setters */));
1784    /// let x = EscalateCaseRequest::new().set_or_clear_escalation(None::<Escalation>);
1785    /// ```
1786    pub fn set_or_clear_escalation<T>(mut self, v: std::option::Option<T>) -> Self
1787    where
1788        T: std::convert::Into<crate::model::Escalation>,
1789    {
1790        self.escalation = v.map(|x| x.into());
1791        self
1792    }
1793}
1794
1795impl wkt::message::Message for EscalateCaseRequest {
1796    fn typename() -> &'static str {
1797        "type.googleapis.com/google.cloud.support.v2.EscalateCaseRequest"
1798    }
1799}
1800
1801/// The request message for the UpdateCase endpoint
1802#[derive(Clone, Default, PartialEq)]
1803#[non_exhaustive]
1804pub struct UpdateCaseRequest {
1805    /// Required. The case to update.
1806    pub case: std::option::Option<crate::model::Case>,
1807
1808    /// A list of attributes of the case that should be updated. Supported values
1809    /// are `priority`, `display_name`, and `subscriber_email_addresses`. If no
1810    /// fields are specified, all supported fields are updated.
1811    ///
1812    /// Be careful - if you do not provide a field mask, then you might
1813    /// accidentally clear some fields. For example, if you leave the field mask
1814    /// empty and do not provide a value for `subscriber_email_addresses`, then
1815    /// `subscriber_email_addresses` is updated to empty.
1816    pub update_mask: std::option::Option<wkt::FieldMask>,
1817
1818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1819}
1820
1821impl UpdateCaseRequest {
1822    /// Creates a new default instance.
1823    pub fn new() -> Self {
1824        std::default::Default::default()
1825    }
1826
1827    /// Sets the value of [case][crate::model::UpdateCaseRequest::case].
1828    ///
1829    /// # Example
1830    /// ```ignore,no_run
1831    /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1832    /// use google_cloud_support_v2::model::Case;
1833    /// let x = UpdateCaseRequest::new().set_case(Case::default()/* use setters */);
1834    /// ```
1835    pub fn set_case<T>(mut self, v: T) -> Self
1836    where
1837        T: std::convert::Into<crate::model::Case>,
1838    {
1839        self.case = std::option::Option::Some(v.into());
1840        self
1841    }
1842
1843    /// Sets or clears the value of [case][crate::model::UpdateCaseRequest::case].
1844    ///
1845    /// # Example
1846    /// ```ignore,no_run
1847    /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1848    /// use google_cloud_support_v2::model::Case;
1849    /// let x = UpdateCaseRequest::new().set_or_clear_case(Some(Case::default()/* use setters */));
1850    /// let x = UpdateCaseRequest::new().set_or_clear_case(None::<Case>);
1851    /// ```
1852    pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
1853    where
1854        T: std::convert::Into<crate::model::Case>,
1855    {
1856        self.case = v.map(|x| x.into());
1857        self
1858    }
1859
1860    /// Sets the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
1861    ///
1862    /// # Example
1863    /// ```ignore,no_run
1864    /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1865    /// use wkt::FieldMask;
1866    /// let x = UpdateCaseRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1867    /// ```
1868    pub fn set_update_mask<T>(mut self, v: T) -> Self
1869    where
1870        T: std::convert::Into<wkt::FieldMask>,
1871    {
1872        self.update_mask = std::option::Option::Some(v.into());
1873        self
1874    }
1875
1876    /// Sets or clears the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
1877    ///
1878    /// # Example
1879    /// ```ignore,no_run
1880    /// # use google_cloud_support_v2::model::UpdateCaseRequest;
1881    /// use wkt::FieldMask;
1882    /// let x = UpdateCaseRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1883    /// let x = UpdateCaseRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1884    /// ```
1885    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1886    where
1887        T: std::convert::Into<wkt::FieldMask>,
1888    {
1889        self.update_mask = v.map(|x| x.into());
1890        self
1891    }
1892}
1893
1894impl wkt::message::Message for UpdateCaseRequest {
1895    fn typename() -> &'static str {
1896        "type.googleapis.com/google.cloud.support.v2.UpdateCaseRequest"
1897    }
1898}
1899
1900/// The request message for the CloseCase endpoint.
1901#[derive(Clone, Default, PartialEq)]
1902#[non_exhaustive]
1903pub struct CloseCaseRequest {
1904    /// Required. The name of the case to close.
1905    pub name: std::string::String,
1906
1907    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1908}
1909
1910impl CloseCaseRequest {
1911    /// Creates a new default instance.
1912    pub fn new() -> Self {
1913        std::default::Default::default()
1914    }
1915
1916    /// Sets the value of [name][crate::model::CloseCaseRequest::name].
1917    ///
1918    /// # Example
1919    /// ```ignore,no_run
1920    /// # use google_cloud_support_v2::model::CloseCaseRequest;
1921    /// # let organization_id = "organization_id";
1922    /// # let case_id = "case_id";
1923    /// let x = CloseCaseRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}"));
1924    /// ```
1925    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1926        self.name = v.into();
1927        self
1928    }
1929}
1930
1931impl wkt::message::Message for CloseCaseRequest {
1932    fn typename() -> &'static str {
1933        "type.googleapis.com/google.cloud.support.v2.CloseCaseRequest"
1934    }
1935}
1936
1937/// The request message for the SearchCaseClassifications endpoint.
1938#[derive(Clone, Default, PartialEq)]
1939#[non_exhaustive]
1940pub struct SearchCaseClassificationsRequest {
1941    /// An expression used to filter case classifications.
1942    ///
1943    /// If it's an empty string, then no filtering happens. Otherwise, case
1944    /// classifications will be returned that match the filter.
1945    pub query: std::string::String,
1946
1947    /// The maximum number of classifications fetched with each request.
1948    pub page_size: i32,
1949
1950    /// A token identifying the page of results to return. If unspecified, the
1951    /// first page is retrieved.
1952    pub page_token: std::string::String,
1953
1954    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1955}
1956
1957impl SearchCaseClassificationsRequest {
1958    /// Creates a new default instance.
1959    pub fn new() -> Self {
1960        std::default::Default::default()
1961    }
1962
1963    /// Sets the value of [query][crate::model::SearchCaseClassificationsRequest::query].
1964    ///
1965    /// # Example
1966    /// ```ignore,no_run
1967    /// # use google_cloud_support_v2::model::SearchCaseClassificationsRequest;
1968    /// let x = SearchCaseClassificationsRequest::new().set_query("example");
1969    /// ```
1970    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1971        self.query = v.into();
1972        self
1973    }
1974
1975    /// Sets the value of [page_size][crate::model::SearchCaseClassificationsRequest::page_size].
1976    ///
1977    /// # Example
1978    /// ```ignore,no_run
1979    /// # use google_cloud_support_v2::model::SearchCaseClassificationsRequest;
1980    /// let x = SearchCaseClassificationsRequest::new().set_page_size(42);
1981    /// ```
1982    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1983        self.page_size = v.into();
1984        self
1985    }
1986
1987    /// Sets the value of [page_token][crate::model::SearchCaseClassificationsRequest::page_token].
1988    ///
1989    /// # Example
1990    /// ```ignore,no_run
1991    /// # use google_cloud_support_v2::model::SearchCaseClassificationsRequest;
1992    /// let x = SearchCaseClassificationsRequest::new().set_page_token("example");
1993    /// ```
1994    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1995        self.page_token = v.into();
1996        self
1997    }
1998}
1999
2000impl wkt::message::Message for SearchCaseClassificationsRequest {
2001    fn typename() -> &'static str {
2002        "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsRequest"
2003    }
2004}
2005
2006/// The response message for SearchCaseClassifications endpoint.
2007#[derive(Clone, Default, PartialEq)]
2008#[non_exhaustive]
2009pub struct SearchCaseClassificationsResponse {
2010    /// The classifications retrieved.
2011    pub case_classifications: std::vec::Vec<crate::model::CaseClassification>,
2012
2013    /// A token to retrieve the next page of results. Set this in the `page_token`
2014    /// field of subsequent `caseClassifications.list` requests. If unspecified,
2015    /// there are no more results to retrieve.
2016    pub next_page_token: std::string::String,
2017
2018    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2019}
2020
2021impl SearchCaseClassificationsResponse {
2022    /// Creates a new default instance.
2023    pub fn new() -> Self {
2024        std::default::Default::default()
2025    }
2026
2027    /// Sets the value of [case_classifications][crate::model::SearchCaseClassificationsResponse::case_classifications].
2028    ///
2029    /// # Example
2030    /// ```ignore,no_run
2031    /// # use google_cloud_support_v2::model::SearchCaseClassificationsResponse;
2032    /// use google_cloud_support_v2::model::CaseClassification;
2033    /// let x = SearchCaseClassificationsResponse::new()
2034    ///     .set_case_classifications([
2035    ///         CaseClassification::default()/* use setters */,
2036    ///         CaseClassification::default()/* use (different) setters */,
2037    ///     ]);
2038    /// ```
2039    pub fn set_case_classifications<T, V>(mut self, v: T) -> Self
2040    where
2041        T: std::iter::IntoIterator<Item = V>,
2042        V: std::convert::Into<crate::model::CaseClassification>,
2043    {
2044        use std::iter::Iterator;
2045        self.case_classifications = v.into_iter().map(|i| i.into()).collect();
2046        self
2047    }
2048
2049    /// Sets the value of [next_page_token][crate::model::SearchCaseClassificationsResponse::next_page_token].
2050    ///
2051    /// # Example
2052    /// ```ignore,no_run
2053    /// # use google_cloud_support_v2::model::SearchCaseClassificationsResponse;
2054    /// let x = SearchCaseClassificationsResponse::new().set_next_page_token("example");
2055    /// ```
2056    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2057        self.next_page_token = v.into();
2058        self
2059    }
2060}
2061
2062impl wkt::message::Message for SearchCaseClassificationsResponse {
2063    fn typename() -> &'static str {
2064        "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsResponse"
2065    }
2066}
2067
2068#[doc(hidden)]
2069impl google_cloud_gax::paginator::internal::PageableResponse for SearchCaseClassificationsResponse {
2070    type PageItem = crate::model::CaseClassification;
2071
2072    fn items(self) -> std::vec::Vec<Self::PageItem> {
2073        self.case_classifications
2074    }
2075
2076    fn next_page_token(&self) -> std::string::String {
2077        use std::clone::Clone;
2078        self.next_page_token.clone()
2079    }
2080}
2081
2082/// A comment associated with a support case.
2083///
2084/// Case comments are the primary way for Google Support to communicate with a
2085/// user who has opened a case. When a user responds to Google Support, the
2086/// user's responses also appear as comments.
2087#[derive(Clone, Default, PartialEq)]
2088#[non_exhaustive]
2089pub struct Comment {
2090    /// Output only. Identifier. The resource name of the comment.
2091    pub name: std::string::String,
2092
2093    /// Output only. The time when the comment was created.
2094    pub create_time: std::option::Option<wkt::Timestamp>,
2095
2096    /// Output only. The user or Google Support agent who created the comment.
2097    pub creator: std::option::Option<crate::model::Actor>,
2098
2099    /// The full comment body.
2100    ///
2101    /// Maximum of 12800 characters.
2102    pub body: std::string::String,
2103
2104    /// Output only. DEPRECATED. DO NOT USE.
2105    ///
2106    /// A duplicate of the `body` field.
2107    ///
2108    /// This field is only present for legacy reasons.
2109    #[deprecated]
2110    pub plain_text_body: std::string::String,
2111
2112    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2113}
2114
2115impl Comment {
2116    /// Creates a new default instance.
2117    pub fn new() -> Self {
2118        std::default::Default::default()
2119    }
2120
2121    /// Sets the value of [name][crate::model::Comment::name].
2122    ///
2123    /// # Example
2124    /// ```ignore,no_run
2125    /// # use google_cloud_support_v2::model::Comment;
2126    /// # let organization_id = "organization_id";
2127    /// # let case_id = "case_id";
2128    /// # let comment_id = "comment_id";
2129    /// let x = Comment::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/comments/{comment_id}"));
2130    /// ```
2131    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2132        self.name = v.into();
2133        self
2134    }
2135
2136    /// Sets the value of [create_time][crate::model::Comment::create_time].
2137    ///
2138    /// # Example
2139    /// ```ignore,no_run
2140    /// # use google_cloud_support_v2::model::Comment;
2141    /// use wkt::Timestamp;
2142    /// let x = Comment::new().set_create_time(Timestamp::default()/* use setters */);
2143    /// ```
2144    pub fn set_create_time<T>(mut self, v: T) -> Self
2145    where
2146        T: std::convert::Into<wkt::Timestamp>,
2147    {
2148        self.create_time = std::option::Option::Some(v.into());
2149        self
2150    }
2151
2152    /// Sets or clears the value of [create_time][crate::model::Comment::create_time].
2153    ///
2154    /// # Example
2155    /// ```ignore,no_run
2156    /// # use google_cloud_support_v2::model::Comment;
2157    /// use wkt::Timestamp;
2158    /// let x = Comment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2159    /// let x = Comment::new().set_or_clear_create_time(None::<Timestamp>);
2160    /// ```
2161    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2162    where
2163        T: std::convert::Into<wkt::Timestamp>,
2164    {
2165        self.create_time = v.map(|x| x.into());
2166        self
2167    }
2168
2169    /// Sets the value of [creator][crate::model::Comment::creator].
2170    ///
2171    /// # Example
2172    /// ```ignore,no_run
2173    /// # use google_cloud_support_v2::model::Comment;
2174    /// use google_cloud_support_v2::model::Actor;
2175    /// let x = Comment::new().set_creator(Actor::default()/* use setters */);
2176    /// ```
2177    pub fn set_creator<T>(mut self, v: T) -> Self
2178    where
2179        T: std::convert::Into<crate::model::Actor>,
2180    {
2181        self.creator = std::option::Option::Some(v.into());
2182        self
2183    }
2184
2185    /// Sets or clears the value of [creator][crate::model::Comment::creator].
2186    ///
2187    /// # Example
2188    /// ```ignore,no_run
2189    /// # use google_cloud_support_v2::model::Comment;
2190    /// use google_cloud_support_v2::model::Actor;
2191    /// let x = Comment::new().set_or_clear_creator(Some(Actor::default()/* use setters */));
2192    /// let x = Comment::new().set_or_clear_creator(None::<Actor>);
2193    /// ```
2194    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
2195    where
2196        T: std::convert::Into<crate::model::Actor>,
2197    {
2198        self.creator = v.map(|x| x.into());
2199        self
2200    }
2201
2202    /// Sets the value of [body][crate::model::Comment::body].
2203    ///
2204    /// # Example
2205    /// ```ignore,no_run
2206    /// # use google_cloud_support_v2::model::Comment;
2207    /// let x = Comment::new().set_body("example");
2208    /// ```
2209    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2210        self.body = v.into();
2211        self
2212    }
2213
2214    /// Sets the value of [plain_text_body][crate::model::Comment::plain_text_body].
2215    ///
2216    /// # Example
2217    /// ```ignore,no_run
2218    /// # use google_cloud_support_v2::model::Comment;
2219    /// let x = Comment::new().set_plain_text_body("example");
2220    /// ```
2221    #[deprecated]
2222    pub fn set_plain_text_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2223        self.plain_text_body = v.into();
2224        self
2225    }
2226}
2227
2228impl wkt::message::Message for Comment {
2229    fn typename() -> &'static str {
2230        "type.googleapis.com/google.cloud.support.v2.Comment"
2231    }
2232}
2233
2234/// The request message for the ListComments endpoint.
2235#[derive(Clone, Default, PartialEq)]
2236#[non_exhaustive]
2237pub struct ListCommentsRequest {
2238    /// Required. The name of the case for which to list comments.
2239    pub parent: std::string::String,
2240
2241    /// The maximum number of comments to fetch. Defaults to 10.
2242    pub page_size: i32,
2243
2244    /// A token identifying the page of results to return. If unspecified, the
2245    /// first page is returned.
2246    pub page_token: std::string::String,
2247
2248    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2249}
2250
2251impl ListCommentsRequest {
2252    /// Creates a new default instance.
2253    pub fn new() -> Self {
2254        std::default::Default::default()
2255    }
2256
2257    /// Sets the value of [parent][crate::model::ListCommentsRequest::parent].
2258    ///
2259    /// # Example
2260    /// ```ignore,no_run
2261    /// # use google_cloud_support_v2::model::ListCommentsRequest;
2262    /// # let organization_id = "organization_id";
2263    /// # let case_id = "case_id";
2264    /// let x = ListCommentsRequest::new().set_parent(format!("organizations/{organization_id}/cases/{case_id}"));
2265    /// ```
2266    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2267        self.parent = v.into();
2268        self
2269    }
2270
2271    /// Sets the value of [page_size][crate::model::ListCommentsRequest::page_size].
2272    ///
2273    /// # Example
2274    /// ```ignore,no_run
2275    /// # use google_cloud_support_v2::model::ListCommentsRequest;
2276    /// let x = ListCommentsRequest::new().set_page_size(42);
2277    /// ```
2278    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2279        self.page_size = v.into();
2280        self
2281    }
2282
2283    /// Sets the value of [page_token][crate::model::ListCommentsRequest::page_token].
2284    ///
2285    /// # Example
2286    /// ```ignore,no_run
2287    /// # use google_cloud_support_v2::model::ListCommentsRequest;
2288    /// let x = ListCommentsRequest::new().set_page_token("example");
2289    /// ```
2290    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2291        self.page_token = v.into();
2292        self
2293    }
2294}
2295
2296impl wkt::message::Message for ListCommentsRequest {
2297    fn typename() -> &'static str {
2298        "type.googleapis.com/google.cloud.support.v2.ListCommentsRequest"
2299    }
2300}
2301
2302/// The response message for the ListComments endpoint.
2303#[derive(Clone, Default, PartialEq)]
2304#[non_exhaustive]
2305pub struct ListCommentsResponse {
2306    /// List of the comments associated with the case.
2307    pub comments: std::vec::Vec<crate::model::Comment>,
2308
2309    /// A token to retrieve the next page of results. Set this in the `page_token`
2310    /// field of subsequent `cases.comments.list` requests. If unspecified, there
2311    /// are no more results to retrieve.
2312    pub next_page_token: std::string::String,
2313
2314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2315}
2316
2317impl ListCommentsResponse {
2318    /// Creates a new default instance.
2319    pub fn new() -> Self {
2320        std::default::Default::default()
2321    }
2322
2323    /// Sets the value of [comments][crate::model::ListCommentsResponse::comments].
2324    ///
2325    /// # Example
2326    /// ```ignore,no_run
2327    /// # use google_cloud_support_v2::model::ListCommentsResponse;
2328    /// use google_cloud_support_v2::model::Comment;
2329    /// let x = ListCommentsResponse::new()
2330    ///     .set_comments([
2331    ///         Comment::default()/* use setters */,
2332    ///         Comment::default()/* use (different) setters */,
2333    ///     ]);
2334    /// ```
2335    pub fn set_comments<T, V>(mut self, v: T) -> Self
2336    where
2337        T: std::iter::IntoIterator<Item = V>,
2338        V: std::convert::Into<crate::model::Comment>,
2339    {
2340        use std::iter::Iterator;
2341        self.comments = v.into_iter().map(|i| i.into()).collect();
2342        self
2343    }
2344
2345    /// Sets the value of [next_page_token][crate::model::ListCommentsResponse::next_page_token].
2346    ///
2347    /// # Example
2348    /// ```ignore,no_run
2349    /// # use google_cloud_support_v2::model::ListCommentsResponse;
2350    /// let x = ListCommentsResponse::new().set_next_page_token("example");
2351    /// ```
2352    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2353        self.next_page_token = v.into();
2354        self
2355    }
2356}
2357
2358impl wkt::message::Message for ListCommentsResponse {
2359    fn typename() -> &'static str {
2360        "type.googleapis.com/google.cloud.support.v2.ListCommentsResponse"
2361    }
2362}
2363
2364#[doc(hidden)]
2365impl google_cloud_gax::paginator::internal::PageableResponse for ListCommentsResponse {
2366    type PageItem = crate::model::Comment;
2367
2368    fn items(self) -> std::vec::Vec<Self::PageItem> {
2369        self.comments
2370    }
2371
2372    fn next_page_token(&self) -> std::string::String {
2373        use std::clone::Clone;
2374        self.next_page_token.clone()
2375    }
2376}
2377
2378/// The request message for the CreateComment endpoint.
2379#[derive(Clone, Default, PartialEq)]
2380#[non_exhaustive]
2381pub struct CreateCommentRequest {
2382    /// Required. The name of the case to which the comment should be added.
2383    pub parent: std::string::String,
2384
2385    /// Required. The comment to be added.
2386    pub comment: std::option::Option<crate::model::Comment>,
2387
2388    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2389}
2390
2391impl CreateCommentRequest {
2392    /// Creates a new default instance.
2393    pub fn new() -> Self {
2394        std::default::Default::default()
2395    }
2396
2397    /// Sets the value of [parent][crate::model::CreateCommentRequest::parent].
2398    ///
2399    /// # Example
2400    /// ```ignore,no_run
2401    /// # use google_cloud_support_v2::model::CreateCommentRequest;
2402    /// # let organization_id = "organization_id";
2403    /// # let case_id = "case_id";
2404    /// let x = CreateCommentRequest::new().set_parent(format!("organizations/{organization_id}/cases/{case_id}"));
2405    /// ```
2406    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2407        self.parent = v.into();
2408        self
2409    }
2410
2411    /// Sets the value of [comment][crate::model::CreateCommentRequest::comment].
2412    ///
2413    /// # Example
2414    /// ```ignore,no_run
2415    /// # use google_cloud_support_v2::model::CreateCommentRequest;
2416    /// use google_cloud_support_v2::model::Comment;
2417    /// let x = CreateCommentRequest::new().set_comment(Comment::default()/* use setters */);
2418    /// ```
2419    pub fn set_comment<T>(mut self, v: T) -> Self
2420    where
2421        T: std::convert::Into<crate::model::Comment>,
2422    {
2423        self.comment = std::option::Option::Some(v.into());
2424        self
2425    }
2426
2427    /// Sets or clears the value of [comment][crate::model::CreateCommentRequest::comment].
2428    ///
2429    /// # Example
2430    /// ```ignore,no_run
2431    /// # use google_cloud_support_v2::model::CreateCommentRequest;
2432    /// use google_cloud_support_v2::model::Comment;
2433    /// let x = CreateCommentRequest::new().set_or_clear_comment(Some(Comment::default()/* use setters */));
2434    /// let x = CreateCommentRequest::new().set_or_clear_comment(None::<Comment>);
2435    /// ```
2436    pub fn set_or_clear_comment<T>(mut self, v: std::option::Option<T>) -> Self
2437    where
2438        T: std::convert::Into<crate::model::Comment>,
2439    {
2440        self.comment = v.map(|x| x.into());
2441        self
2442    }
2443}
2444
2445impl wkt::message::Message for CreateCommentRequest {
2446    fn typename() -> &'static str {
2447        "type.googleapis.com/google.cloud.support.v2.CreateCommentRequest"
2448    }
2449}
2450
2451/// The request message for the GetComment endpoint.
2452#[derive(Clone, Default, PartialEq)]
2453#[non_exhaustive]
2454pub struct GetCommentRequest {
2455    /// Required. The name of the comment to retrieve.
2456    pub name: std::string::String,
2457
2458    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2459}
2460
2461impl GetCommentRequest {
2462    /// Creates a new default instance.
2463    pub fn new() -> Self {
2464        std::default::Default::default()
2465    }
2466
2467    /// Sets the value of [name][crate::model::GetCommentRequest::name].
2468    ///
2469    /// # Example
2470    /// ```ignore,no_run
2471    /// # use google_cloud_support_v2::model::GetCommentRequest;
2472    /// # let organization_id = "organization_id";
2473    /// # let case_id = "case_id";
2474    /// # let comment_id = "comment_id";
2475    /// let x = GetCommentRequest::new().set_name(format!("organizations/{organization_id}/cases/{case_id}/comments/{comment_id}"));
2476    /// ```
2477    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2478        self.name = v.into();
2479        self
2480    }
2481}
2482
2483impl wkt::message::Message for GetCommentRequest {
2484    fn typename() -> &'static str {
2485        "type.googleapis.com/google.cloud.support.v2.GetCommentRequest"
2486    }
2487}
2488
2489/// An escalation of a support case.
2490#[derive(Clone, Default, PartialEq)]
2491#[non_exhaustive]
2492pub struct Escalation {
2493    /// Required. The reason why the Case is being escalated.
2494    pub reason: crate::model::escalation::Reason,
2495
2496    /// Required. A free text description to accompany the `reason` field above.
2497    /// Provides additional context on why the case is being escalated.
2498    pub justification: std::string::String,
2499
2500    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2501}
2502
2503impl Escalation {
2504    /// Creates a new default instance.
2505    pub fn new() -> Self {
2506        std::default::Default::default()
2507    }
2508
2509    /// Sets the value of [reason][crate::model::Escalation::reason].
2510    ///
2511    /// # Example
2512    /// ```ignore,no_run
2513    /// # use google_cloud_support_v2::model::Escalation;
2514    /// use google_cloud_support_v2::model::escalation::Reason;
2515    /// let x0 = Escalation::new().set_reason(Reason::ResolutionTime);
2516    /// let x1 = Escalation::new().set_reason(Reason::TechnicalExpertise);
2517    /// let x2 = Escalation::new().set_reason(Reason::BusinessImpact);
2518    /// ```
2519    pub fn set_reason<T: std::convert::Into<crate::model::escalation::Reason>>(
2520        mut self,
2521        v: T,
2522    ) -> Self {
2523        self.reason = v.into();
2524        self
2525    }
2526
2527    /// Sets the value of [justification][crate::model::Escalation::justification].
2528    ///
2529    /// # Example
2530    /// ```ignore,no_run
2531    /// # use google_cloud_support_v2::model::Escalation;
2532    /// let x = Escalation::new().set_justification("example");
2533    /// ```
2534    pub fn set_justification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2535        self.justification = v.into();
2536        self
2537    }
2538}
2539
2540impl wkt::message::Message for Escalation {
2541    fn typename() -> &'static str {
2542        "type.googleapis.com/google.cloud.support.v2.Escalation"
2543    }
2544}
2545
2546/// Defines additional types related to [Escalation].
2547pub mod escalation {
2548    #[allow(unused_imports)]
2549    use super::*;
2550
2551    /// An enum detailing the possible reasons a case may be escalated.
2552    ///
2553    /// # Working with unknown values
2554    ///
2555    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2556    /// additional enum variants at any time. Adding new variants is not considered
2557    /// a breaking change. Applications should write their code in anticipation of:
2558    ///
2559    /// - New values appearing in future releases of the client library, **and**
2560    /// - New values received dynamically, without application changes.
2561    ///
2562    /// Please consult the [Working with enums] section in the user guide for some
2563    /// guidelines.
2564    ///
2565    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2566    #[derive(Clone, Debug, PartialEq)]
2567    #[non_exhaustive]
2568    pub enum Reason {
2569        /// The escalation reason is in an unknown state or has not been specified.
2570        Unspecified,
2571        /// The case is taking too long to resolve.
2572        ResolutionTime,
2573        /// The support agent does not have the expertise required to successfully
2574        /// resolve the issue.
2575        TechnicalExpertise,
2576        /// The issue is having a significant business impact.
2577        BusinessImpact,
2578        /// If set, the enum was initialized with an unknown value.
2579        ///
2580        /// Applications can examine the value using [Reason::value] or
2581        /// [Reason::name].
2582        UnknownValue(reason::UnknownValue),
2583    }
2584
2585    #[doc(hidden)]
2586    pub mod reason {
2587        #[allow(unused_imports)]
2588        use super::*;
2589        #[derive(Clone, Debug, PartialEq)]
2590        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2591    }
2592
2593    impl Reason {
2594        /// Gets the enum value.
2595        ///
2596        /// Returns `None` if the enum contains an unknown value deserialized from
2597        /// the string representation of enums.
2598        pub fn value(&self) -> std::option::Option<i32> {
2599            match self {
2600                Self::Unspecified => std::option::Option::Some(0),
2601                Self::ResolutionTime => std::option::Option::Some(1),
2602                Self::TechnicalExpertise => std::option::Option::Some(2),
2603                Self::BusinessImpact => std::option::Option::Some(3),
2604                Self::UnknownValue(u) => u.0.value(),
2605            }
2606        }
2607
2608        /// Gets the enum value as a string.
2609        ///
2610        /// Returns `None` if the enum contains an unknown value deserialized from
2611        /// the integer representation of enums.
2612        pub fn name(&self) -> std::option::Option<&str> {
2613            match self {
2614                Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
2615                Self::ResolutionTime => std::option::Option::Some("RESOLUTION_TIME"),
2616                Self::TechnicalExpertise => std::option::Option::Some("TECHNICAL_EXPERTISE"),
2617                Self::BusinessImpact => std::option::Option::Some("BUSINESS_IMPACT"),
2618                Self::UnknownValue(u) => u.0.name(),
2619            }
2620        }
2621    }
2622
2623    impl std::default::Default for Reason {
2624        fn default() -> Self {
2625            use std::convert::From;
2626            Self::from(0)
2627        }
2628    }
2629
2630    impl std::fmt::Display for Reason {
2631        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2632            wkt::internal::display_enum(f, self.name(), self.value())
2633        }
2634    }
2635
2636    impl std::convert::From<i32> for Reason {
2637        fn from(value: i32) -> Self {
2638            match value {
2639                0 => Self::Unspecified,
2640                1 => Self::ResolutionTime,
2641                2 => Self::TechnicalExpertise,
2642                3 => Self::BusinessImpact,
2643                _ => Self::UnknownValue(reason::UnknownValue(
2644                    wkt::internal::UnknownEnumValue::Integer(value),
2645                )),
2646            }
2647        }
2648    }
2649
2650    impl std::convert::From<&str> for Reason {
2651        fn from(value: &str) -> Self {
2652            use std::string::ToString;
2653            match value {
2654                "REASON_UNSPECIFIED" => Self::Unspecified,
2655                "RESOLUTION_TIME" => Self::ResolutionTime,
2656                "TECHNICAL_EXPERTISE" => Self::TechnicalExpertise,
2657                "BUSINESS_IMPACT" => Self::BusinessImpact,
2658                _ => Self::UnknownValue(reason::UnknownValue(
2659                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2660                )),
2661            }
2662        }
2663    }
2664
2665    impl serde::ser::Serialize for Reason {
2666        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2667        where
2668            S: serde::Serializer,
2669        {
2670            match self {
2671                Self::Unspecified => serializer.serialize_i32(0),
2672                Self::ResolutionTime => serializer.serialize_i32(1),
2673                Self::TechnicalExpertise => serializer.serialize_i32(2),
2674                Self::BusinessImpact => serializer.serialize_i32(3),
2675                Self::UnknownValue(u) => u.0.serialize(serializer),
2676            }
2677        }
2678    }
2679
2680    impl<'de> serde::de::Deserialize<'de> for Reason {
2681        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2682        where
2683            D: serde::Deserializer<'de>,
2684        {
2685            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
2686                ".google.cloud.support.v2.Escalation.Reason",
2687            ))
2688        }
2689    }
2690}