google_cloud_type/
model.rs

1// Copyright 2024 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 bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27/// Represents a color in the RGBA color space. This representation is designed
28/// for simplicity of conversion to/from color representations in various
29/// languages over compactness. For example, the fields of this representation
30/// can be trivially provided to the constructor of `java.awt.Color` in Java; it
31/// can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
32/// method in iOS; and, with just a little work, it can be easily formatted into
33/// a CSS `rgba()` string in JavaScript.
34///
35/// This reference page doesn't carry information about the absolute color
36/// space
37/// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
38/// DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
39/// space.
40///
41/// When color equality needs to be decided, implementations, unless
42/// documented otherwise, treat two colors as equal if all their red,
43/// green, blue, and alpha values each differ by at most 1e-5.
44///
45/// Example (Java):
46///
47/// ```norust
48///  import com.google.type.Color;
49///
50///  // ...
51///  public static java.awt.Color fromProto(Color protocolor) {
52///    float alpha = protocolor.hasAlpha()
53///        ? protocolor.getAlpha().getValue()
54///        : 1.0;
55///
56///    return new java.awt.Color(
57///        protocolor.getRed(),
58///        protocolor.getGreen(),
59///        protocolor.getBlue(),
60///        alpha);
61///  }
62///
63///  public static Color toProto(java.awt.Color color) {
64///    float red = (float) color.getRed();
65///    float green = (float) color.getGreen();
66///    float blue = (float) color.getBlue();
67///    float denominator = 255.0;
68///    Color.Builder resultBuilder =
69///        Color
70///            .newBuilder()
71///            .setRed(red / denominator)
72///            .setGreen(green / denominator)
73///            .setBlue(blue / denominator);
74///    int alpha = color.getAlpha();
75///    if (alpha != 255) {
76///      result.setAlpha(
77///          FloatValue
78///              .newBuilder()
79///              .setValue(((float) alpha) / denominator)
80///              .build());
81///    }
82///    return resultBuilder.build();
83///  }
84///  // ...
85/// ```
86///
87/// Example (iOS / Obj-C):
88///
89/// ```norust
90///  // ...
91///  static UIColor* fromProto(Color* protocolor) {
92///     float red = [protocolor red];
93///     float green = [protocolor green];
94///     float blue = [protocolor blue];
95///     FloatValue* alpha_wrapper = [protocolor alpha];
96///     float alpha = 1.0;
97///     if (alpha_wrapper != nil) {
98///       alpha = [alpha_wrapper value];
99///     }
100///     return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
101///  }
102///
103///  static Color* toProto(UIColor* color) {
104///      CGFloat red, green, blue, alpha;
105///      if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
106///        return nil;
107///      }
108///      Color* result = [[Color alloc] init];
109///      [result setRed:red];
110///      [result setGreen:green];
111///      [result setBlue:blue];
112///      if (alpha <= 0.9999) {
113///        [result setAlpha:floatWrapperWithValue(alpha)];
114///      }
115///      [result autorelease];
116///      return result;
117/// }
118/// // ...
119/// ```
120///
121/// Example (JavaScript):
122///
123/// ```norust
124/// // ...
125///
126/// var protoToCssColor = function(rgb_color) {
127///    var redFrac = rgb_color.red || 0.0;
128///    var greenFrac = rgb_color.green || 0.0;
129///    var blueFrac = rgb_color.blue || 0.0;
130///    var red = Math.floor(redFrac * 255);
131///    var green = Math.floor(greenFrac * 255);
132///    var blue = Math.floor(blueFrac * 255);
133///
134///    if (!('alpha' in rgb_color)) {
135///       return rgbToCssColor(red, green, blue);
136///    }
137///
138///    var alphaFrac = rgb_color.alpha.value || 0.0;
139///    var rgbParams = [red, green, blue].join(',');
140///    return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
141/// };
142///
143/// var rgbToCssColor = function(red, green, blue) {
144///   var rgbNumber = new Number((red << 16) | (green << 8) | blue);
145///   var hexString = rgbNumber.toString(16);
146///   var missingZeros = 6 - hexString.length;
147///   var resultBuilder = ['#'];
148///   for (var i = 0; i < missingZeros; i++) {
149///      resultBuilder.push('0');
150///   }
151///   resultBuilder.push(hexString);
152///   return resultBuilder.join('');
153/// };
154///
155/// // ...
156/// ```
157#[derive(Clone, Default, PartialEq)]
158#[non_exhaustive]
159pub struct Color {
160    /// The amount of red in the color as a value in the interval [0, 1].
161    pub red: f32,
162
163    /// The amount of green in the color as a value in the interval [0, 1].
164    pub green: f32,
165
166    /// The amount of blue in the color as a value in the interval [0, 1].
167    pub blue: f32,
168
169    /// The fraction of this color that should be applied to the pixel. That is,
170    /// the final pixel color is defined by the equation:
171    ///
172    /// `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
173    ///
174    /// This means that a value of 1.0 corresponds to a solid color, whereas
175    /// a value of 0.0 corresponds to a completely transparent color. This
176    /// uses a wrapper message rather than a simple float scalar so that it is
177    /// possible to distinguish between a default value and the value being unset.
178    /// If omitted, this color object is rendered as a solid color
179    /// (as if the alpha value had been explicitly given a value of 1.0).
180    pub alpha: std::option::Option<wkt::FloatValue>,
181
182    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
183}
184
185impl Color {
186    pub fn new() -> Self {
187        std::default::Default::default()
188    }
189
190    /// Sets the value of [red][crate::model::Color::red].
191    pub fn set_red<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
192        self.red = v.into();
193        self
194    }
195
196    /// Sets the value of [green][crate::model::Color::green].
197    pub fn set_green<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
198        self.green = v.into();
199        self
200    }
201
202    /// Sets the value of [blue][crate::model::Color::blue].
203    pub fn set_blue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
204        self.blue = v.into();
205        self
206    }
207
208    /// Sets the value of [alpha][crate::model::Color::alpha].
209    pub fn set_alpha<T>(mut self, v: T) -> Self
210    where
211        T: std::convert::Into<wkt::FloatValue>,
212    {
213        self.alpha = std::option::Option::Some(v.into());
214        self
215    }
216
217    /// Sets or clears the value of [alpha][crate::model::Color::alpha].
218    pub fn set_or_clear_alpha<T>(mut self, v: std::option::Option<T>) -> Self
219    where
220        T: std::convert::Into<wkt::FloatValue>,
221    {
222        self.alpha = v.map(|x| x.into());
223        self
224    }
225}
226
227impl wkt::message::Message for Color {
228    fn typename() -> &'static str {
229        "type.googleapis.com/google.type.Color"
230    }
231}
232
233#[doc(hidden)]
234impl<'de> serde::de::Deserialize<'de> for Color {
235    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
236    where
237        D: serde::Deserializer<'de>,
238    {
239        #[allow(non_camel_case_types)]
240        #[doc(hidden)]
241        #[derive(PartialEq, Eq, Hash)]
242        enum __FieldTag {
243            __red,
244            __green,
245            __blue,
246            __alpha,
247            Unknown(std::string::String),
248        }
249        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
250            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
251            where
252                D: serde::Deserializer<'de>,
253            {
254                struct Visitor;
255                impl<'de> serde::de::Visitor<'de> for Visitor {
256                    type Value = __FieldTag;
257                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
258                        formatter.write_str("a field name for Color")
259                    }
260                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
261                    where
262                        E: serde::de::Error,
263                    {
264                        use std::result::Result::Ok;
265                        use std::string::ToString;
266                        match value {
267                            "red" => Ok(__FieldTag::__red),
268                            "green" => Ok(__FieldTag::__green),
269                            "blue" => Ok(__FieldTag::__blue),
270                            "alpha" => Ok(__FieldTag::__alpha),
271                            _ => Ok(__FieldTag::Unknown(value.to_string())),
272                        }
273                    }
274                }
275                deserializer.deserialize_identifier(Visitor)
276            }
277        }
278        struct Visitor;
279        impl<'de> serde::de::Visitor<'de> for Visitor {
280            type Value = Color;
281            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
282                formatter.write_str("struct Color")
283            }
284            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
285            where
286                A: serde::de::MapAccess<'de>,
287            {
288                #[allow(unused_imports)]
289                use serde::de::Error;
290                use std::option::Option::Some;
291                let mut fields = std::collections::HashSet::new();
292                let mut result = Self::Value::new();
293                while let Some(tag) = map.next_key::<__FieldTag>()? {
294                    #[allow(clippy::match_single_binding)]
295                    match tag {
296                        __FieldTag::__red => {
297                            if !fields.insert(__FieldTag::__red) {
298                                return std::result::Result::Err(A::Error::duplicate_field(
299                                    "multiple values for red",
300                                ));
301                            }
302                            struct __With(std::option::Option<f32>);
303                            impl<'de> serde::de::Deserialize<'de> for __With {
304                                fn deserialize<D>(
305                                    deserializer: D,
306                                ) -> std::result::Result<Self, D::Error>
307                                where
308                                    D: serde::de::Deserializer<'de>,
309                                {
310                                    serde_with::As::< std::option::Option<wkt::internal::F32> >::deserialize(deserializer).map(__With)
311                                }
312                            }
313                            result.red = map.next_value::<__With>()?.0.unwrap_or_default();
314                        }
315                        __FieldTag::__green => {
316                            if !fields.insert(__FieldTag::__green) {
317                                return std::result::Result::Err(A::Error::duplicate_field(
318                                    "multiple values for green",
319                                ));
320                            }
321                            struct __With(std::option::Option<f32>);
322                            impl<'de> serde::de::Deserialize<'de> for __With {
323                                fn deserialize<D>(
324                                    deserializer: D,
325                                ) -> std::result::Result<Self, D::Error>
326                                where
327                                    D: serde::de::Deserializer<'de>,
328                                {
329                                    serde_with::As::< std::option::Option<wkt::internal::F32> >::deserialize(deserializer).map(__With)
330                                }
331                            }
332                            result.green = map.next_value::<__With>()?.0.unwrap_or_default();
333                        }
334                        __FieldTag::__blue => {
335                            if !fields.insert(__FieldTag::__blue) {
336                                return std::result::Result::Err(A::Error::duplicate_field(
337                                    "multiple values for blue",
338                                ));
339                            }
340                            struct __With(std::option::Option<f32>);
341                            impl<'de> serde::de::Deserialize<'de> for __With {
342                                fn deserialize<D>(
343                                    deserializer: D,
344                                ) -> std::result::Result<Self, D::Error>
345                                where
346                                    D: serde::de::Deserializer<'de>,
347                                {
348                                    serde_with::As::< std::option::Option<wkt::internal::F32> >::deserialize(deserializer).map(__With)
349                                }
350                            }
351                            result.blue = map.next_value::<__With>()?.0.unwrap_or_default();
352                        }
353                        __FieldTag::__alpha => {
354                            if !fields.insert(__FieldTag::__alpha) {
355                                return std::result::Result::Err(A::Error::duplicate_field(
356                                    "multiple values for alpha",
357                                ));
358                            }
359                            struct __With(std::option::Option<wkt::FloatValue>);
360                            impl<'de> serde::de::Deserialize<'de> for __With {
361                                fn deserialize<D>(
362                                    deserializer: D,
363                                ) -> std::result::Result<Self, D::Error>
364                                where
365                                    D: serde::de::Deserializer<'de>,
366                                {
367                                    serde_with::As::< std::option::Option<wkt::internal::F32> >::deserialize(deserializer).map(__With)
368                                }
369                            }
370                            result.alpha = map.next_value::<__With>()?.0;
371                        }
372                        __FieldTag::Unknown(key) => {
373                            let value = map.next_value::<serde_json::Value>()?;
374                            result._unknown_fields.insert(key, value);
375                        }
376                    }
377                }
378                std::result::Result::Ok(result)
379            }
380        }
381        deserializer.deserialize_any(Visitor)
382    }
383}
384
385#[doc(hidden)]
386impl serde::ser::Serialize for Color {
387    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
388    where
389        S: serde::ser::Serializer,
390    {
391        use serde::ser::SerializeMap;
392        #[allow(unused_imports)]
393        use std::option::Option::Some;
394        let mut state = serializer.serialize_map(std::option::Option::None)?;
395        if !wkt::internal::is_default(&self.red) {
396            struct __With<'a>(&'a f32);
397            impl<'a> serde::ser::Serialize for __With<'a> {
398                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
399                where
400                    S: serde::ser::Serializer,
401                {
402                    serde_with::As::<wkt::internal::F32>::serialize(self.0, serializer)
403                }
404            }
405            state.serialize_entry("red", &__With(&self.red))?;
406        }
407        if !wkt::internal::is_default(&self.green) {
408            struct __With<'a>(&'a f32);
409            impl<'a> serde::ser::Serialize for __With<'a> {
410                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
411                where
412                    S: serde::ser::Serializer,
413                {
414                    serde_with::As::<wkt::internal::F32>::serialize(self.0, serializer)
415                }
416            }
417            state.serialize_entry("green", &__With(&self.green))?;
418        }
419        if !wkt::internal::is_default(&self.blue) {
420            struct __With<'a>(&'a f32);
421            impl<'a> serde::ser::Serialize for __With<'a> {
422                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
423                where
424                    S: serde::ser::Serializer,
425                {
426                    serde_with::As::<wkt::internal::F32>::serialize(self.0, serializer)
427                }
428            }
429            state.serialize_entry("blue", &__With(&self.blue))?;
430        }
431        if self.alpha.is_some() {
432            struct __With<'a>(&'a std::option::Option<wkt::FloatValue>);
433            impl<'a> serde::ser::Serialize for __With<'a> {
434                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
435                where
436                    S: serde::ser::Serializer,
437                {
438                    serde_with::As::<std::option::Option<wkt::internal::F32>>::serialize(
439                        self.0, serializer,
440                    )
441                }
442            }
443            state.serialize_entry("alpha", &__With(&self.alpha))?;
444        }
445        if !self._unknown_fields.is_empty() {
446            for (key, value) in self._unknown_fields.iter() {
447                state.serialize_entry(key, &value)?;
448            }
449        }
450        state.end()
451    }
452}
453
454impl std::fmt::Debug for Color {
455    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
456        let mut debug_struct = f.debug_struct("Color");
457        debug_struct.field("red", &self.red);
458        debug_struct.field("green", &self.green);
459        debug_struct.field("blue", &self.blue);
460        debug_struct.field("alpha", &self.alpha);
461        if !self._unknown_fields.is_empty() {
462            debug_struct.field("_unknown_fields", &self._unknown_fields);
463        }
464        debug_struct.finish()
465    }
466}
467
468/// Represents a whole or partial calendar date, such as a birthday. The time of
469/// day and time zone are either specified elsewhere or are insignificant. The
470/// date is relative to the Gregorian Calendar. This can represent one of the
471/// following:
472///
473/// * A full date, with non-zero year, month, and day values
474/// * A month and day value, with a zero year, such as an anniversary
475/// * A year on its own, with zero month and day values
476/// * A year and month value, with a zero day, such as a credit card expiration
477///   date
478///
479/// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
480/// `google.protobuf.Timestamp`.
481///
482/// [google.type.TimeOfDay]: crate::model::TimeOfDay
483#[derive(Clone, Default, PartialEq)]
484#[non_exhaustive]
485pub struct Date {
486    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without
487    /// a year.
488    pub year: i32,
489
490    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a
491    /// month and day.
492    pub month: i32,
493
494    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
495    /// to specify a year by itself or a year and month where the day isn't
496    /// significant.
497    pub day: i32,
498
499    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
500}
501
502impl Date {
503    pub fn new() -> Self {
504        std::default::Default::default()
505    }
506
507    /// Sets the value of [year][crate::model::Date::year].
508    pub fn set_year<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
509        self.year = v.into();
510        self
511    }
512
513    /// Sets the value of [month][crate::model::Date::month].
514    pub fn set_month<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
515        self.month = v.into();
516        self
517    }
518
519    /// Sets the value of [day][crate::model::Date::day].
520    pub fn set_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
521        self.day = v.into();
522        self
523    }
524}
525
526impl wkt::message::Message for Date {
527    fn typename() -> &'static str {
528        "type.googleapis.com/google.type.Date"
529    }
530}
531
532#[doc(hidden)]
533impl<'de> serde::de::Deserialize<'de> for Date {
534    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
535    where
536        D: serde::Deserializer<'de>,
537    {
538        #[allow(non_camel_case_types)]
539        #[doc(hidden)]
540        #[derive(PartialEq, Eq, Hash)]
541        enum __FieldTag {
542            __year,
543            __month,
544            __day,
545            Unknown(std::string::String),
546        }
547        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
548            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
549            where
550                D: serde::Deserializer<'de>,
551            {
552                struct Visitor;
553                impl<'de> serde::de::Visitor<'de> for Visitor {
554                    type Value = __FieldTag;
555                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
556                        formatter.write_str("a field name for Date")
557                    }
558                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
559                    where
560                        E: serde::de::Error,
561                    {
562                        use std::result::Result::Ok;
563                        use std::string::ToString;
564                        match value {
565                            "year" => Ok(__FieldTag::__year),
566                            "month" => Ok(__FieldTag::__month),
567                            "day" => Ok(__FieldTag::__day),
568                            _ => Ok(__FieldTag::Unknown(value.to_string())),
569                        }
570                    }
571                }
572                deserializer.deserialize_identifier(Visitor)
573            }
574        }
575        struct Visitor;
576        impl<'de> serde::de::Visitor<'de> for Visitor {
577            type Value = Date;
578            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
579                formatter.write_str("struct Date")
580            }
581            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
582            where
583                A: serde::de::MapAccess<'de>,
584            {
585                #[allow(unused_imports)]
586                use serde::de::Error;
587                use std::option::Option::Some;
588                let mut fields = std::collections::HashSet::new();
589                let mut result = Self::Value::new();
590                while let Some(tag) = map.next_key::<__FieldTag>()? {
591                    #[allow(clippy::match_single_binding)]
592                    match tag {
593                        __FieldTag::__year => {
594                            if !fields.insert(__FieldTag::__year) {
595                                return std::result::Result::Err(A::Error::duplicate_field(
596                                    "multiple values for year",
597                                ));
598                            }
599                            struct __With(std::option::Option<i32>);
600                            impl<'de> serde::de::Deserialize<'de> for __With {
601                                fn deserialize<D>(
602                                    deserializer: D,
603                                ) -> std::result::Result<Self, D::Error>
604                                where
605                                    D: serde::de::Deserializer<'de>,
606                                {
607                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
608                                }
609                            }
610                            result.year = map.next_value::<__With>()?.0.unwrap_or_default();
611                        }
612                        __FieldTag::__month => {
613                            if !fields.insert(__FieldTag::__month) {
614                                return std::result::Result::Err(A::Error::duplicate_field(
615                                    "multiple values for month",
616                                ));
617                            }
618                            struct __With(std::option::Option<i32>);
619                            impl<'de> serde::de::Deserialize<'de> for __With {
620                                fn deserialize<D>(
621                                    deserializer: D,
622                                ) -> std::result::Result<Self, D::Error>
623                                where
624                                    D: serde::de::Deserializer<'de>,
625                                {
626                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
627                                }
628                            }
629                            result.month = map.next_value::<__With>()?.0.unwrap_or_default();
630                        }
631                        __FieldTag::__day => {
632                            if !fields.insert(__FieldTag::__day) {
633                                return std::result::Result::Err(A::Error::duplicate_field(
634                                    "multiple values for day",
635                                ));
636                            }
637                            struct __With(std::option::Option<i32>);
638                            impl<'de> serde::de::Deserialize<'de> for __With {
639                                fn deserialize<D>(
640                                    deserializer: D,
641                                ) -> std::result::Result<Self, D::Error>
642                                where
643                                    D: serde::de::Deserializer<'de>,
644                                {
645                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
646                                }
647                            }
648                            result.day = map.next_value::<__With>()?.0.unwrap_or_default();
649                        }
650                        __FieldTag::Unknown(key) => {
651                            let value = map.next_value::<serde_json::Value>()?;
652                            result._unknown_fields.insert(key, value);
653                        }
654                    }
655                }
656                std::result::Result::Ok(result)
657            }
658        }
659        deserializer.deserialize_any(Visitor)
660    }
661}
662
663#[doc(hidden)]
664impl serde::ser::Serialize for Date {
665    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
666    where
667        S: serde::ser::Serializer,
668    {
669        use serde::ser::SerializeMap;
670        #[allow(unused_imports)]
671        use std::option::Option::Some;
672        let mut state = serializer.serialize_map(std::option::Option::None)?;
673        if !wkt::internal::is_default(&self.year) {
674            struct __With<'a>(&'a i32);
675            impl<'a> serde::ser::Serialize for __With<'a> {
676                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
677                where
678                    S: serde::ser::Serializer,
679                {
680                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
681                }
682            }
683            state.serialize_entry("year", &__With(&self.year))?;
684        }
685        if !wkt::internal::is_default(&self.month) {
686            struct __With<'a>(&'a i32);
687            impl<'a> serde::ser::Serialize for __With<'a> {
688                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
689                where
690                    S: serde::ser::Serializer,
691                {
692                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
693                }
694            }
695            state.serialize_entry("month", &__With(&self.month))?;
696        }
697        if !wkt::internal::is_default(&self.day) {
698            struct __With<'a>(&'a i32);
699            impl<'a> serde::ser::Serialize for __With<'a> {
700                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
701                where
702                    S: serde::ser::Serializer,
703                {
704                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
705                }
706            }
707            state.serialize_entry("day", &__With(&self.day))?;
708        }
709        if !self._unknown_fields.is_empty() {
710            for (key, value) in self._unknown_fields.iter() {
711                state.serialize_entry(key, &value)?;
712            }
713        }
714        state.end()
715    }
716}
717
718impl std::fmt::Debug for Date {
719    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
720        let mut debug_struct = f.debug_struct("Date");
721        debug_struct.field("year", &self.year);
722        debug_struct.field("month", &self.month);
723        debug_struct.field("day", &self.day);
724        if !self._unknown_fields.is_empty() {
725            debug_struct.field("_unknown_fields", &self._unknown_fields);
726        }
727        debug_struct.finish()
728    }
729}
730
731/// Represents civil time (or occasionally physical time).
732///
733/// This type can represent a civil time in one of a few possible ways:
734///
735/// * When utc_offset is set and time_zone is unset: a civil time on a calendar
736///   day with a particular offset from UTC.
737/// * When time_zone is set and utc_offset is unset: a civil time on a calendar
738///   day in a particular time zone.
739/// * When neither time_zone nor utc_offset is set: a civil time on a calendar
740///   day in local time.
741///
742/// The date is relative to the Proleptic Gregorian Calendar.
743///
744/// If year is 0, the DateTime is considered not to have a specific year. month
745/// and day must have valid, non-zero values.
746///
747/// This type may also be used to represent a physical time if all the date and
748/// time fields are set and either case of the `time_offset` oneof is set.
749/// Consider using `Timestamp` message for physical time instead. If your use
750/// case also would like to store the user's timezone, that can be done in
751/// another field.
752///
753/// This type is more flexible than some applications may want. Make sure to
754/// document and validate your application's limitations.
755#[derive(Clone, Default, PartialEq)]
756#[non_exhaustive]
757pub struct DateTime {
758    /// Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a
759    /// datetime without a year.
760    pub year: i32,
761
762    /// Required. Month of year. Must be from 1 to 12.
763    pub month: i32,
764
765    /// Required. Day of month. Must be from 1 to 31 and valid for the year and
766    /// month.
767    pub day: i32,
768
769    /// Required. Hours of day in 24 hour format. Should be from 0 to 23. An API
770    /// may choose to allow the value "24:00:00" for scenarios like business
771    /// closing time.
772    pub hours: i32,
773
774    /// Required. Minutes of hour of day. Must be from 0 to 59.
775    pub minutes: i32,
776
777    /// Required. Seconds of minutes of the time. Must normally be from 0 to 59. An
778    /// API may allow the value 60 if it allows leap-seconds.
779    pub seconds: i32,
780
781    /// Required. Fractions of seconds in nanoseconds. Must be from 0 to
782    /// 999,999,999.
783    pub nanos: i32,
784
785    /// Optional. Specifies either the UTC offset or the time zone of the DateTime.
786    /// Choose carefully between them, considering that time zone data may change
787    /// in the future (for example, a country modifies their DST start/end dates,
788    /// and future DateTimes in the affected range had already been stored).
789    /// If omitted, the DateTime is considered to be in local time.
790    pub time_offset: std::option::Option<crate::model::date_time::TimeOffset>,
791
792    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
793}
794
795impl DateTime {
796    pub fn new() -> Self {
797        std::default::Default::default()
798    }
799
800    /// Sets the value of [year][crate::model::DateTime::year].
801    pub fn set_year<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
802        self.year = v.into();
803        self
804    }
805
806    /// Sets the value of [month][crate::model::DateTime::month].
807    pub fn set_month<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
808        self.month = v.into();
809        self
810    }
811
812    /// Sets the value of [day][crate::model::DateTime::day].
813    pub fn set_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
814        self.day = v.into();
815        self
816    }
817
818    /// Sets the value of [hours][crate::model::DateTime::hours].
819    pub fn set_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
820        self.hours = v.into();
821        self
822    }
823
824    /// Sets the value of [minutes][crate::model::DateTime::minutes].
825    pub fn set_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
826        self.minutes = v.into();
827        self
828    }
829
830    /// Sets the value of [seconds][crate::model::DateTime::seconds].
831    pub fn set_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
832        self.seconds = v.into();
833        self
834    }
835
836    /// Sets the value of [nanos][crate::model::DateTime::nanos].
837    pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
838        self.nanos = v.into();
839        self
840    }
841
842    /// Sets the value of [time_offset][crate::model::DateTime::time_offset].
843    ///
844    /// Note that all the setters affecting `time_offset` are mutually
845    /// exclusive.
846    pub fn set_time_offset<
847        T: std::convert::Into<std::option::Option<crate::model::date_time::TimeOffset>>,
848    >(
849        mut self,
850        v: T,
851    ) -> Self {
852        self.time_offset = v.into();
853        self
854    }
855
856    /// The value of [time_offset][crate::model::DateTime::time_offset]
857    /// if it holds a `UtcOffset`, `None` if the field is not set or
858    /// holds a different branch.
859    pub fn utc_offset(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
860        #[allow(unreachable_patterns)]
861        self.time_offset.as_ref().and_then(|v| match v {
862            crate::model::date_time::TimeOffset::UtcOffset(v) => std::option::Option::Some(v),
863            _ => std::option::Option::None,
864        })
865    }
866
867    /// Sets the value of [time_offset][crate::model::DateTime::time_offset]
868    /// to hold a `UtcOffset`.
869    ///
870    /// Note that all the setters affecting `time_offset` are
871    /// mutually exclusive.
872    pub fn set_utc_offset<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
873        mut self,
874        v: T,
875    ) -> Self {
876        self.time_offset =
877            std::option::Option::Some(crate::model::date_time::TimeOffset::UtcOffset(v.into()));
878        self
879    }
880
881    /// The value of [time_offset][crate::model::DateTime::time_offset]
882    /// if it holds a `TimeZone`, `None` if the field is not set or
883    /// holds a different branch.
884    pub fn time_zone(&self) -> std::option::Option<&std::boxed::Box<crate::model::TimeZone>> {
885        #[allow(unreachable_patterns)]
886        self.time_offset.as_ref().and_then(|v| match v {
887            crate::model::date_time::TimeOffset::TimeZone(v) => std::option::Option::Some(v),
888            _ => std::option::Option::None,
889        })
890    }
891
892    /// Sets the value of [time_offset][crate::model::DateTime::time_offset]
893    /// to hold a `TimeZone`.
894    ///
895    /// Note that all the setters affecting `time_offset` are
896    /// mutually exclusive.
897    pub fn set_time_zone<T: std::convert::Into<std::boxed::Box<crate::model::TimeZone>>>(
898        mut self,
899        v: T,
900    ) -> Self {
901        self.time_offset =
902            std::option::Option::Some(crate::model::date_time::TimeOffset::TimeZone(v.into()));
903        self
904    }
905}
906
907impl wkt::message::Message for DateTime {
908    fn typename() -> &'static str {
909        "type.googleapis.com/google.type.DateTime"
910    }
911}
912
913#[doc(hidden)]
914impl<'de> serde::de::Deserialize<'de> for DateTime {
915    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
916    where
917        D: serde::Deserializer<'de>,
918    {
919        #[allow(non_camel_case_types)]
920        #[doc(hidden)]
921        #[derive(PartialEq, Eq, Hash)]
922        enum __FieldTag {
923            __year,
924            __month,
925            __day,
926            __hours,
927            __minutes,
928            __seconds,
929            __nanos,
930            __utc_offset,
931            __time_zone,
932            Unknown(std::string::String),
933        }
934        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
935            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
936            where
937                D: serde::Deserializer<'de>,
938            {
939                struct Visitor;
940                impl<'de> serde::de::Visitor<'de> for Visitor {
941                    type Value = __FieldTag;
942                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
943                        formatter.write_str("a field name for DateTime")
944                    }
945                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
946                    where
947                        E: serde::de::Error,
948                    {
949                        use std::result::Result::Ok;
950                        use std::string::ToString;
951                        match value {
952                            "year" => Ok(__FieldTag::__year),
953                            "month" => Ok(__FieldTag::__month),
954                            "day" => Ok(__FieldTag::__day),
955                            "hours" => Ok(__FieldTag::__hours),
956                            "minutes" => Ok(__FieldTag::__minutes),
957                            "seconds" => Ok(__FieldTag::__seconds),
958                            "nanos" => Ok(__FieldTag::__nanos),
959                            "utcOffset" => Ok(__FieldTag::__utc_offset),
960                            "utc_offset" => Ok(__FieldTag::__utc_offset),
961                            "timeZone" => Ok(__FieldTag::__time_zone),
962                            "time_zone" => Ok(__FieldTag::__time_zone),
963                            _ => Ok(__FieldTag::Unknown(value.to_string())),
964                        }
965                    }
966                }
967                deserializer.deserialize_identifier(Visitor)
968            }
969        }
970        struct Visitor;
971        impl<'de> serde::de::Visitor<'de> for Visitor {
972            type Value = DateTime;
973            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
974                formatter.write_str("struct DateTime")
975            }
976            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
977            where
978                A: serde::de::MapAccess<'de>,
979            {
980                #[allow(unused_imports)]
981                use serde::de::Error;
982                use std::option::Option::Some;
983                let mut fields = std::collections::HashSet::new();
984                let mut result = Self::Value::new();
985                while let Some(tag) = map.next_key::<__FieldTag>()? {
986                    #[allow(clippy::match_single_binding)]
987                    match tag {
988                        __FieldTag::__year => {
989                            if !fields.insert(__FieldTag::__year) {
990                                return std::result::Result::Err(A::Error::duplicate_field(
991                                    "multiple values for year",
992                                ));
993                            }
994                            struct __With(std::option::Option<i32>);
995                            impl<'de> serde::de::Deserialize<'de> for __With {
996                                fn deserialize<D>(
997                                    deserializer: D,
998                                ) -> std::result::Result<Self, D::Error>
999                                where
1000                                    D: serde::de::Deserializer<'de>,
1001                                {
1002                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1003                                }
1004                            }
1005                            result.year = map.next_value::<__With>()?.0.unwrap_or_default();
1006                        }
1007                        __FieldTag::__month => {
1008                            if !fields.insert(__FieldTag::__month) {
1009                                return std::result::Result::Err(A::Error::duplicate_field(
1010                                    "multiple values for month",
1011                                ));
1012                            }
1013                            struct __With(std::option::Option<i32>);
1014                            impl<'de> serde::de::Deserialize<'de> for __With {
1015                                fn deserialize<D>(
1016                                    deserializer: D,
1017                                ) -> std::result::Result<Self, D::Error>
1018                                where
1019                                    D: serde::de::Deserializer<'de>,
1020                                {
1021                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1022                                }
1023                            }
1024                            result.month = map.next_value::<__With>()?.0.unwrap_or_default();
1025                        }
1026                        __FieldTag::__day => {
1027                            if !fields.insert(__FieldTag::__day) {
1028                                return std::result::Result::Err(A::Error::duplicate_field(
1029                                    "multiple values for day",
1030                                ));
1031                            }
1032                            struct __With(std::option::Option<i32>);
1033                            impl<'de> serde::de::Deserialize<'de> for __With {
1034                                fn deserialize<D>(
1035                                    deserializer: D,
1036                                ) -> std::result::Result<Self, D::Error>
1037                                where
1038                                    D: serde::de::Deserializer<'de>,
1039                                {
1040                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1041                                }
1042                            }
1043                            result.day = map.next_value::<__With>()?.0.unwrap_or_default();
1044                        }
1045                        __FieldTag::__hours => {
1046                            if !fields.insert(__FieldTag::__hours) {
1047                                return std::result::Result::Err(A::Error::duplicate_field(
1048                                    "multiple values for hours",
1049                                ));
1050                            }
1051                            struct __With(std::option::Option<i32>);
1052                            impl<'de> serde::de::Deserialize<'de> for __With {
1053                                fn deserialize<D>(
1054                                    deserializer: D,
1055                                ) -> std::result::Result<Self, D::Error>
1056                                where
1057                                    D: serde::de::Deserializer<'de>,
1058                                {
1059                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1060                                }
1061                            }
1062                            result.hours = map.next_value::<__With>()?.0.unwrap_or_default();
1063                        }
1064                        __FieldTag::__minutes => {
1065                            if !fields.insert(__FieldTag::__minutes) {
1066                                return std::result::Result::Err(A::Error::duplicate_field(
1067                                    "multiple values for minutes",
1068                                ));
1069                            }
1070                            struct __With(std::option::Option<i32>);
1071                            impl<'de> serde::de::Deserialize<'de> for __With {
1072                                fn deserialize<D>(
1073                                    deserializer: D,
1074                                ) -> std::result::Result<Self, D::Error>
1075                                where
1076                                    D: serde::de::Deserializer<'de>,
1077                                {
1078                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1079                                }
1080                            }
1081                            result.minutes = map.next_value::<__With>()?.0.unwrap_or_default();
1082                        }
1083                        __FieldTag::__seconds => {
1084                            if !fields.insert(__FieldTag::__seconds) {
1085                                return std::result::Result::Err(A::Error::duplicate_field(
1086                                    "multiple values for seconds",
1087                                ));
1088                            }
1089                            struct __With(std::option::Option<i32>);
1090                            impl<'de> serde::de::Deserialize<'de> for __With {
1091                                fn deserialize<D>(
1092                                    deserializer: D,
1093                                ) -> std::result::Result<Self, D::Error>
1094                                where
1095                                    D: serde::de::Deserializer<'de>,
1096                                {
1097                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1098                                }
1099                            }
1100                            result.seconds = map.next_value::<__With>()?.0.unwrap_or_default();
1101                        }
1102                        __FieldTag::__nanos => {
1103                            if !fields.insert(__FieldTag::__nanos) {
1104                                return std::result::Result::Err(A::Error::duplicate_field(
1105                                    "multiple values for nanos",
1106                                ));
1107                            }
1108                            struct __With(std::option::Option<i32>);
1109                            impl<'de> serde::de::Deserialize<'de> for __With {
1110                                fn deserialize<D>(
1111                                    deserializer: D,
1112                                ) -> std::result::Result<Self, D::Error>
1113                                where
1114                                    D: serde::de::Deserializer<'de>,
1115                                {
1116                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1117                                }
1118                            }
1119                            result.nanos = map.next_value::<__With>()?.0.unwrap_or_default();
1120                        }
1121                        __FieldTag::__utc_offset => {
1122                            if !fields.insert(__FieldTag::__utc_offset) {
1123                                return std::result::Result::Err(A::Error::duplicate_field(
1124                                    "multiple values for utc_offset",
1125                                ));
1126                            }
1127                            if result.time_offset.is_some() {
1128                                return std::result::Result::Err(A::Error::duplicate_field(
1129                                    "multiple values for `time_offset`, a oneof with full ID .google.type.DateTime.utc_offset, latest field was utcOffset",
1130                                ));
1131                            }
1132                            result.time_offset = std::option::Option::Some(
1133                                crate::model::date_time::TimeOffset::UtcOffset(
1134                                    map.next_value::<std::option::Option<std::boxed::Box<wkt::Duration>>>()?.unwrap_or_default()
1135                                ),
1136                            );
1137                        }
1138                        __FieldTag::__time_zone => {
1139                            if !fields.insert(__FieldTag::__time_zone) {
1140                                return std::result::Result::Err(A::Error::duplicate_field(
1141                                    "multiple values for time_zone",
1142                                ));
1143                            }
1144                            if result.time_offset.is_some() {
1145                                return std::result::Result::Err(A::Error::duplicate_field(
1146                                    "multiple values for `time_offset`, a oneof with full ID .google.type.DateTime.time_zone, latest field was timeZone",
1147                                ));
1148                            }
1149                            result.time_offset = std::option::Option::Some(
1150                                crate::model::date_time::TimeOffset::TimeZone(
1151                                    map.next_value::<std::option::Option<
1152                                        std::boxed::Box<crate::model::TimeZone>,
1153                                    >>()?
1154                                    .unwrap_or_default(),
1155                                ),
1156                            );
1157                        }
1158                        __FieldTag::Unknown(key) => {
1159                            let value = map.next_value::<serde_json::Value>()?;
1160                            result._unknown_fields.insert(key, value);
1161                        }
1162                    }
1163                }
1164                std::result::Result::Ok(result)
1165            }
1166        }
1167        deserializer.deserialize_any(Visitor)
1168    }
1169}
1170
1171#[doc(hidden)]
1172impl serde::ser::Serialize for DateTime {
1173    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1174    where
1175        S: serde::ser::Serializer,
1176    {
1177        use serde::ser::SerializeMap;
1178        #[allow(unused_imports)]
1179        use std::option::Option::Some;
1180        let mut state = serializer.serialize_map(std::option::Option::None)?;
1181        if !wkt::internal::is_default(&self.year) {
1182            struct __With<'a>(&'a i32);
1183            impl<'a> serde::ser::Serialize for __With<'a> {
1184                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1185                where
1186                    S: serde::ser::Serializer,
1187                {
1188                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1189                }
1190            }
1191            state.serialize_entry("year", &__With(&self.year))?;
1192        }
1193        if !wkt::internal::is_default(&self.month) {
1194            struct __With<'a>(&'a i32);
1195            impl<'a> serde::ser::Serialize for __With<'a> {
1196                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1197                where
1198                    S: serde::ser::Serializer,
1199                {
1200                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1201                }
1202            }
1203            state.serialize_entry("month", &__With(&self.month))?;
1204        }
1205        if !wkt::internal::is_default(&self.day) {
1206            struct __With<'a>(&'a i32);
1207            impl<'a> serde::ser::Serialize for __With<'a> {
1208                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1209                where
1210                    S: serde::ser::Serializer,
1211                {
1212                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1213                }
1214            }
1215            state.serialize_entry("day", &__With(&self.day))?;
1216        }
1217        if !wkt::internal::is_default(&self.hours) {
1218            struct __With<'a>(&'a i32);
1219            impl<'a> serde::ser::Serialize for __With<'a> {
1220                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1221                where
1222                    S: serde::ser::Serializer,
1223                {
1224                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1225                }
1226            }
1227            state.serialize_entry("hours", &__With(&self.hours))?;
1228        }
1229        if !wkt::internal::is_default(&self.minutes) {
1230            struct __With<'a>(&'a i32);
1231            impl<'a> serde::ser::Serialize for __With<'a> {
1232                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1233                where
1234                    S: serde::ser::Serializer,
1235                {
1236                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1237                }
1238            }
1239            state.serialize_entry("minutes", &__With(&self.minutes))?;
1240        }
1241        if !wkt::internal::is_default(&self.seconds) {
1242            struct __With<'a>(&'a i32);
1243            impl<'a> serde::ser::Serialize for __With<'a> {
1244                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1245                where
1246                    S: serde::ser::Serializer,
1247                {
1248                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1249                }
1250            }
1251            state.serialize_entry("seconds", &__With(&self.seconds))?;
1252        }
1253        if !wkt::internal::is_default(&self.nanos) {
1254            struct __With<'a>(&'a i32);
1255            impl<'a> serde::ser::Serialize for __With<'a> {
1256                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1257                where
1258                    S: serde::ser::Serializer,
1259                {
1260                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1261                }
1262            }
1263            state.serialize_entry("nanos", &__With(&self.nanos))?;
1264        }
1265        if let Some(value) = self.utc_offset() {
1266            state.serialize_entry("utcOffset", value)?;
1267        }
1268        if let Some(value) = self.time_zone() {
1269            state.serialize_entry("timeZone", value)?;
1270        }
1271        if !self._unknown_fields.is_empty() {
1272            for (key, value) in self._unknown_fields.iter() {
1273                state.serialize_entry(key, &value)?;
1274            }
1275        }
1276        state.end()
1277    }
1278}
1279
1280impl std::fmt::Debug for DateTime {
1281    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1282        let mut debug_struct = f.debug_struct("DateTime");
1283        debug_struct.field("year", &self.year);
1284        debug_struct.field("month", &self.month);
1285        debug_struct.field("day", &self.day);
1286        debug_struct.field("hours", &self.hours);
1287        debug_struct.field("minutes", &self.minutes);
1288        debug_struct.field("seconds", &self.seconds);
1289        debug_struct.field("nanos", &self.nanos);
1290        debug_struct.field("time_offset", &self.time_offset);
1291        if !self._unknown_fields.is_empty() {
1292            debug_struct.field("_unknown_fields", &self._unknown_fields);
1293        }
1294        debug_struct.finish()
1295    }
1296}
1297
1298/// Defines additional types related to [DateTime].
1299pub mod date_time {
1300    #[allow(unused_imports)]
1301    use super::*;
1302
1303    /// Optional. Specifies either the UTC offset or the time zone of the DateTime.
1304    /// Choose carefully between them, considering that time zone data may change
1305    /// in the future (for example, a country modifies their DST start/end dates,
1306    /// and future DateTimes in the affected range had already been stored).
1307    /// If omitted, the DateTime is considered to be in local time.
1308    #[derive(Clone, Debug, PartialEq)]
1309    #[non_exhaustive]
1310    pub enum TimeOffset {
1311        /// UTC offset. Must be whole seconds, between -18 hours and +18 hours.
1312        /// For example, a UTC offset of -4:00 would be represented as
1313        /// { seconds: -14400 }.
1314        UtcOffset(std::boxed::Box<wkt::Duration>),
1315        /// Time zone.
1316        TimeZone(std::boxed::Box<crate::model::TimeZone>),
1317    }
1318}
1319
1320/// Represents a time zone from the
1321/// [IANA Time Zone Database](https://www.iana.org/time-zones).
1322#[derive(Clone, Default, PartialEq)]
1323#[non_exhaustive]
1324pub struct TimeZone {
1325    /// IANA Time Zone Database time zone, e.g. "America/New_York".
1326    pub id: std::string::String,
1327
1328    /// Optional. IANA Time Zone Database version number, e.g. "2019a".
1329    pub version: std::string::String,
1330
1331    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1332}
1333
1334impl TimeZone {
1335    pub fn new() -> Self {
1336        std::default::Default::default()
1337    }
1338
1339    /// Sets the value of [id][crate::model::TimeZone::id].
1340    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1341        self.id = v.into();
1342        self
1343    }
1344
1345    /// Sets the value of [version][crate::model::TimeZone::version].
1346    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1347        self.version = v.into();
1348        self
1349    }
1350}
1351
1352impl wkt::message::Message for TimeZone {
1353    fn typename() -> &'static str {
1354        "type.googleapis.com/google.type.TimeZone"
1355    }
1356}
1357
1358#[doc(hidden)]
1359impl<'de> serde::de::Deserialize<'de> for TimeZone {
1360    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1361    where
1362        D: serde::Deserializer<'de>,
1363    {
1364        #[allow(non_camel_case_types)]
1365        #[doc(hidden)]
1366        #[derive(PartialEq, Eq, Hash)]
1367        enum __FieldTag {
1368            __id,
1369            __version,
1370            Unknown(std::string::String),
1371        }
1372        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1373            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1374            where
1375                D: serde::Deserializer<'de>,
1376            {
1377                struct Visitor;
1378                impl<'de> serde::de::Visitor<'de> for Visitor {
1379                    type Value = __FieldTag;
1380                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1381                        formatter.write_str("a field name for TimeZone")
1382                    }
1383                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1384                    where
1385                        E: serde::de::Error,
1386                    {
1387                        use std::result::Result::Ok;
1388                        use std::string::ToString;
1389                        match value {
1390                            "id" => Ok(__FieldTag::__id),
1391                            "version" => Ok(__FieldTag::__version),
1392                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1393                        }
1394                    }
1395                }
1396                deserializer.deserialize_identifier(Visitor)
1397            }
1398        }
1399        struct Visitor;
1400        impl<'de> serde::de::Visitor<'de> for Visitor {
1401            type Value = TimeZone;
1402            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1403                formatter.write_str("struct TimeZone")
1404            }
1405            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1406            where
1407                A: serde::de::MapAccess<'de>,
1408            {
1409                #[allow(unused_imports)]
1410                use serde::de::Error;
1411                use std::option::Option::Some;
1412                let mut fields = std::collections::HashSet::new();
1413                let mut result = Self::Value::new();
1414                while let Some(tag) = map.next_key::<__FieldTag>()? {
1415                    #[allow(clippy::match_single_binding)]
1416                    match tag {
1417                        __FieldTag::__id => {
1418                            if !fields.insert(__FieldTag::__id) {
1419                                return std::result::Result::Err(A::Error::duplicate_field(
1420                                    "multiple values for id",
1421                                ));
1422                            }
1423                            result.id = map
1424                                .next_value::<std::option::Option<std::string::String>>()?
1425                                .unwrap_or_default();
1426                        }
1427                        __FieldTag::__version => {
1428                            if !fields.insert(__FieldTag::__version) {
1429                                return std::result::Result::Err(A::Error::duplicate_field(
1430                                    "multiple values for version",
1431                                ));
1432                            }
1433                            result.version = map
1434                                .next_value::<std::option::Option<std::string::String>>()?
1435                                .unwrap_or_default();
1436                        }
1437                        __FieldTag::Unknown(key) => {
1438                            let value = map.next_value::<serde_json::Value>()?;
1439                            result._unknown_fields.insert(key, value);
1440                        }
1441                    }
1442                }
1443                std::result::Result::Ok(result)
1444            }
1445        }
1446        deserializer.deserialize_any(Visitor)
1447    }
1448}
1449
1450#[doc(hidden)]
1451impl serde::ser::Serialize for TimeZone {
1452    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1453    where
1454        S: serde::ser::Serializer,
1455    {
1456        use serde::ser::SerializeMap;
1457        #[allow(unused_imports)]
1458        use std::option::Option::Some;
1459        let mut state = serializer.serialize_map(std::option::Option::None)?;
1460        if !self.id.is_empty() {
1461            state.serialize_entry("id", &self.id)?;
1462        }
1463        if !self.version.is_empty() {
1464            state.serialize_entry("version", &self.version)?;
1465        }
1466        if !self._unknown_fields.is_empty() {
1467            for (key, value) in self._unknown_fields.iter() {
1468                state.serialize_entry(key, &value)?;
1469            }
1470        }
1471        state.end()
1472    }
1473}
1474
1475impl std::fmt::Debug for TimeZone {
1476    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1477        let mut debug_struct = f.debug_struct("TimeZone");
1478        debug_struct.field("id", &self.id);
1479        debug_struct.field("version", &self.version);
1480        if !self._unknown_fields.is_empty() {
1481            debug_struct.field("_unknown_fields", &self._unknown_fields);
1482        }
1483        debug_struct.finish()
1484    }
1485}
1486
1487/// A representation of a decimal value, such as 2.5. Clients may convert values
1488/// into language-native decimal formats, such as Java's [BigDecimal][] or
1489/// Python's [decimal.Decimal][].
1490///
1491/// [BigDecimal]:
1492///  https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
1493/// [decimal.Decimal]:
1494///  https://docs.python.org/3/library/decimal.html
1495#[derive(Clone, Default, PartialEq)]
1496#[non_exhaustive]
1497pub struct Decimal {
1498    /// The decimal value, as a string.
1499    ///
1500    /// The string representation consists of an optional sign, `+` (`U+002B`)
1501    /// or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
1502    /// ("the integer"), optionally followed by a fraction, optionally followed
1503    /// by an exponent.
1504    ///
1505    /// The fraction consists of a decimal point followed by zero or more decimal
1506    /// digits. The string must contain at least one digit in either the integer
1507    /// or the fraction. The number formed by the sign, the integer and the
1508    /// fraction is referred to as the significand.
1509    ///
1510    /// The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
1511    /// followed by one or more decimal digits.
1512    ///
1513    /// Services **should** normalize decimal values before storing them by:
1514    ///
1515    /// - Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`).
1516    /// - Replacing a zero-length integer value with `0` (`.5` -> `0.5`).
1517    /// - Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`).
1518    /// - Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`).
1519    ///
1520    /// Services **may** perform additional normalization based on its own needs
1521    /// and the internal decimal implementation selected, such as shifting the
1522    /// decimal point and exponent value together (example: `2.5e-1` <-> `0.25`).
1523    /// Additionally, services **may** preserve trailing zeroes in the fraction
1524    /// to indicate increased precision, but are not required to do so.
1525    ///
1526    /// Note that only the `.` character is supported to divide the integer
1527    /// and the fraction; `,` **should not** be supported regardless of locale.
1528    /// Additionally, thousand separators **should not** be supported. If a
1529    /// service does support them, values **must** be normalized.
1530    ///
1531    /// The ENBF grammar is:
1532    ///
1533    /// ```norust
1534    /// DecimalString =
1535    ///   [Sign] Significand [Exponent];
1536    ///
1537    /// Sign = '+' | '-';
1538    ///
1539    /// Significand =
1540    ///   Digits ['.'] [Digits] | [Digits] '.' Digits;
1541    ///
1542    /// Exponent = ('e' | 'E') [Sign] Digits;
1543    ///
1544    /// Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };
1545    /// ```
1546    ///
1547    /// Services **should** clearly document the range of supported values, the
1548    /// maximum supported precision (total number of digits), and, if applicable,
1549    /// the scale (number of digits after the decimal point), as well as how it
1550    /// behaves when receiving out-of-bounds values.
1551    ///
1552    /// Services **may** choose to accept values passed as input even when the
1553    /// value has a higher precision or scale than the service supports, and
1554    /// **should** round the value to fit the supported scale. Alternatively, the
1555    /// service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
1556    /// if precision would be lost.
1557    ///
1558    /// Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
1559    /// gRPC) if the service receives a value outside of the supported range.
1560    pub value: std::string::String,
1561
1562    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1563}
1564
1565impl Decimal {
1566    pub fn new() -> Self {
1567        std::default::Default::default()
1568    }
1569
1570    /// Sets the value of [value][crate::model::Decimal::value].
1571    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1572        self.value = v.into();
1573        self
1574    }
1575}
1576
1577impl wkt::message::Message for Decimal {
1578    fn typename() -> &'static str {
1579        "type.googleapis.com/google.type.Decimal"
1580    }
1581}
1582
1583#[doc(hidden)]
1584impl<'de> serde::de::Deserialize<'de> for Decimal {
1585    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1586    where
1587        D: serde::Deserializer<'de>,
1588    {
1589        #[allow(non_camel_case_types)]
1590        #[doc(hidden)]
1591        #[derive(PartialEq, Eq, Hash)]
1592        enum __FieldTag {
1593            __value,
1594            Unknown(std::string::String),
1595        }
1596        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1597            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1598            where
1599                D: serde::Deserializer<'de>,
1600            {
1601                struct Visitor;
1602                impl<'de> serde::de::Visitor<'de> for Visitor {
1603                    type Value = __FieldTag;
1604                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1605                        formatter.write_str("a field name for Decimal")
1606                    }
1607                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1608                    where
1609                        E: serde::de::Error,
1610                    {
1611                        use std::result::Result::Ok;
1612                        use std::string::ToString;
1613                        match value {
1614                            "value" => Ok(__FieldTag::__value),
1615                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1616                        }
1617                    }
1618                }
1619                deserializer.deserialize_identifier(Visitor)
1620            }
1621        }
1622        struct Visitor;
1623        impl<'de> serde::de::Visitor<'de> for Visitor {
1624            type Value = Decimal;
1625            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1626                formatter.write_str("struct Decimal")
1627            }
1628            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1629            where
1630                A: serde::de::MapAccess<'de>,
1631            {
1632                #[allow(unused_imports)]
1633                use serde::de::Error;
1634                use std::option::Option::Some;
1635                let mut fields = std::collections::HashSet::new();
1636                let mut result = Self::Value::new();
1637                while let Some(tag) = map.next_key::<__FieldTag>()? {
1638                    #[allow(clippy::match_single_binding)]
1639                    match tag {
1640                        __FieldTag::__value => {
1641                            if !fields.insert(__FieldTag::__value) {
1642                                return std::result::Result::Err(A::Error::duplicate_field(
1643                                    "multiple values for value",
1644                                ));
1645                            }
1646                            result.value = map
1647                                .next_value::<std::option::Option<std::string::String>>()?
1648                                .unwrap_or_default();
1649                        }
1650                        __FieldTag::Unknown(key) => {
1651                            let value = map.next_value::<serde_json::Value>()?;
1652                            result._unknown_fields.insert(key, value);
1653                        }
1654                    }
1655                }
1656                std::result::Result::Ok(result)
1657            }
1658        }
1659        deserializer.deserialize_any(Visitor)
1660    }
1661}
1662
1663#[doc(hidden)]
1664impl serde::ser::Serialize for Decimal {
1665    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1666    where
1667        S: serde::ser::Serializer,
1668    {
1669        use serde::ser::SerializeMap;
1670        #[allow(unused_imports)]
1671        use std::option::Option::Some;
1672        let mut state = serializer.serialize_map(std::option::Option::None)?;
1673        if !self.value.is_empty() {
1674            state.serialize_entry("value", &self.value)?;
1675        }
1676        if !self._unknown_fields.is_empty() {
1677            for (key, value) in self._unknown_fields.iter() {
1678                state.serialize_entry(key, &value)?;
1679            }
1680        }
1681        state.end()
1682    }
1683}
1684
1685impl std::fmt::Debug for Decimal {
1686    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1687        let mut debug_struct = f.debug_struct("Decimal");
1688        debug_struct.field("value", &self.value);
1689        if !self._unknown_fields.is_empty() {
1690            debug_struct.field("_unknown_fields", &self._unknown_fields);
1691        }
1692        debug_struct.finish()
1693    }
1694}
1695
1696/// Represents a textual expression in the Common Expression Language (CEL)
1697/// syntax. CEL is a C-like expression language. The syntax and semantics of CEL
1698/// are documented at <https://github.com/google/cel-spec>.
1699///
1700/// Example (Comparison):
1701///
1702/// ```norust
1703/// title: "Summary size limit"
1704/// description: "Determines if a summary is less than 100 chars"
1705/// expression: "document.summary.size() < 100"
1706/// ```
1707///
1708/// Example (Equality):
1709///
1710/// ```norust
1711/// title: "Requestor is owner"
1712/// description: "Determines if requestor is the document owner"
1713/// expression: "document.owner == request.auth.claims.email"
1714/// ```
1715///
1716/// Example (Logic):
1717///
1718/// ```norust
1719/// title: "Public documents"
1720/// description: "Determine whether the document should be publicly visible"
1721/// expression: "document.type != 'private' && document.type != 'internal'"
1722/// ```
1723///
1724/// Example (Data Manipulation):
1725///
1726/// ```norust
1727/// title: "Notification string"
1728/// description: "Create a notification string with a timestamp."
1729/// expression: "'New message received at ' + string(document.create_time)"
1730/// ```
1731///
1732/// The exact variables and functions that may be referenced within an expression
1733/// are determined by the service that evaluates it. See the service
1734/// documentation for additional information.
1735#[derive(Clone, Default, PartialEq)]
1736#[non_exhaustive]
1737pub struct Expr {
1738    /// Textual representation of an expression in Common Expression Language
1739    /// syntax.
1740    pub expression: std::string::String,
1741
1742    /// Optional. Title for the expression, i.e. a short string describing
1743    /// its purpose. This can be used e.g. in UIs which allow to enter the
1744    /// expression.
1745    pub title: std::string::String,
1746
1747    /// Optional. Description of the expression. This is a longer text which
1748    /// describes the expression, e.g. when hovered over it in a UI.
1749    pub description: std::string::String,
1750
1751    /// Optional. String indicating the location of the expression for error
1752    /// reporting, e.g. a file name and a position in the file.
1753    pub location: std::string::String,
1754
1755    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1756}
1757
1758impl Expr {
1759    pub fn new() -> Self {
1760        std::default::Default::default()
1761    }
1762
1763    /// Sets the value of [expression][crate::model::Expr::expression].
1764    pub fn set_expression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1765        self.expression = v.into();
1766        self
1767    }
1768
1769    /// Sets the value of [title][crate::model::Expr::title].
1770    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1771        self.title = v.into();
1772        self
1773    }
1774
1775    /// Sets the value of [description][crate::model::Expr::description].
1776    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1777        self.description = v.into();
1778        self
1779    }
1780
1781    /// Sets the value of [location][crate::model::Expr::location].
1782    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1783        self.location = v.into();
1784        self
1785    }
1786}
1787
1788impl wkt::message::Message for Expr {
1789    fn typename() -> &'static str {
1790        "type.googleapis.com/google.type.Expr"
1791    }
1792}
1793
1794#[doc(hidden)]
1795impl<'de> serde::de::Deserialize<'de> for Expr {
1796    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1797    where
1798        D: serde::Deserializer<'de>,
1799    {
1800        #[allow(non_camel_case_types)]
1801        #[doc(hidden)]
1802        #[derive(PartialEq, Eq, Hash)]
1803        enum __FieldTag {
1804            __expression,
1805            __title,
1806            __description,
1807            __location,
1808            Unknown(std::string::String),
1809        }
1810        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1811            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1812            where
1813                D: serde::Deserializer<'de>,
1814            {
1815                struct Visitor;
1816                impl<'de> serde::de::Visitor<'de> for Visitor {
1817                    type Value = __FieldTag;
1818                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1819                        formatter.write_str("a field name for Expr")
1820                    }
1821                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1822                    where
1823                        E: serde::de::Error,
1824                    {
1825                        use std::result::Result::Ok;
1826                        use std::string::ToString;
1827                        match value {
1828                            "expression" => Ok(__FieldTag::__expression),
1829                            "title" => Ok(__FieldTag::__title),
1830                            "description" => Ok(__FieldTag::__description),
1831                            "location" => Ok(__FieldTag::__location),
1832                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1833                        }
1834                    }
1835                }
1836                deserializer.deserialize_identifier(Visitor)
1837            }
1838        }
1839        struct Visitor;
1840        impl<'de> serde::de::Visitor<'de> for Visitor {
1841            type Value = Expr;
1842            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1843                formatter.write_str("struct Expr")
1844            }
1845            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1846            where
1847                A: serde::de::MapAccess<'de>,
1848            {
1849                #[allow(unused_imports)]
1850                use serde::de::Error;
1851                use std::option::Option::Some;
1852                let mut fields = std::collections::HashSet::new();
1853                let mut result = Self::Value::new();
1854                while let Some(tag) = map.next_key::<__FieldTag>()? {
1855                    #[allow(clippy::match_single_binding)]
1856                    match tag {
1857                        __FieldTag::__expression => {
1858                            if !fields.insert(__FieldTag::__expression) {
1859                                return std::result::Result::Err(A::Error::duplicate_field(
1860                                    "multiple values for expression",
1861                                ));
1862                            }
1863                            result.expression = map
1864                                .next_value::<std::option::Option<std::string::String>>()?
1865                                .unwrap_or_default();
1866                        }
1867                        __FieldTag::__title => {
1868                            if !fields.insert(__FieldTag::__title) {
1869                                return std::result::Result::Err(A::Error::duplicate_field(
1870                                    "multiple values for title",
1871                                ));
1872                            }
1873                            result.title = map
1874                                .next_value::<std::option::Option<std::string::String>>()?
1875                                .unwrap_or_default();
1876                        }
1877                        __FieldTag::__description => {
1878                            if !fields.insert(__FieldTag::__description) {
1879                                return std::result::Result::Err(A::Error::duplicate_field(
1880                                    "multiple values for description",
1881                                ));
1882                            }
1883                            result.description = map
1884                                .next_value::<std::option::Option<std::string::String>>()?
1885                                .unwrap_or_default();
1886                        }
1887                        __FieldTag::__location => {
1888                            if !fields.insert(__FieldTag::__location) {
1889                                return std::result::Result::Err(A::Error::duplicate_field(
1890                                    "multiple values for location",
1891                                ));
1892                            }
1893                            result.location = map
1894                                .next_value::<std::option::Option<std::string::String>>()?
1895                                .unwrap_or_default();
1896                        }
1897                        __FieldTag::Unknown(key) => {
1898                            let value = map.next_value::<serde_json::Value>()?;
1899                            result._unknown_fields.insert(key, value);
1900                        }
1901                    }
1902                }
1903                std::result::Result::Ok(result)
1904            }
1905        }
1906        deserializer.deserialize_any(Visitor)
1907    }
1908}
1909
1910#[doc(hidden)]
1911impl serde::ser::Serialize for Expr {
1912    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1913    where
1914        S: serde::ser::Serializer,
1915    {
1916        use serde::ser::SerializeMap;
1917        #[allow(unused_imports)]
1918        use std::option::Option::Some;
1919        let mut state = serializer.serialize_map(std::option::Option::None)?;
1920        if !self.expression.is_empty() {
1921            state.serialize_entry("expression", &self.expression)?;
1922        }
1923        if !self.title.is_empty() {
1924            state.serialize_entry("title", &self.title)?;
1925        }
1926        if !self.description.is_empty() {
1927            state.serialize_entry("description", &self.description)?;
1928        }
1929        if !self.location.is_empty() {
1930            state.serialize_entry("location", &self.location)?;
1931        }
1932        if !self._unknown_fields.is_empty() {
1933            for (key, value) in self._unknown_fields.iter() {
1934                state.serialize_entry(key, &value)?;
1935            }
1936        }
1937        state.end()
1938    }
1939}
1940
1941impl std::fmt::Debug for Expr {
1942    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1943        let mut debug_struct = f.debug_struct("Expr");
1944        debug_struct.field("expression", &self.expression);
1945        debug_struct.field("title", &self.title);
1946        debug_struct.field("description", &self.description);
1947        debug_struct.field("location", &self.location);
1948        if !self._unknown_fields.is_empty() {
1949            debug_struct.field("_unknown_fields", &self._unknown_fields);
1950        }
1951        debug_struct.finish()
1952    }
1953}
1954
1955/// Represents a fraction in terms of a numerator divided by a denominator.
1956#[derive(Clone, Default, PartialEq)]
1957#[non_exhaustive]
1958pub struct Fraction {
1959    /// The numerator in the fraction, e.g. 2 in 2/3.
1960    pub numerator: i64,
1961
1962    /// The value by which the numerator is divided, e.g. 3 in 2/3. Must be
1963    /// positive.
1964    pub denominator: i64,
1965
1966    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1967}
1968
1969impl Fraction {
1970    pub fn new() -> Self {
1971        std::default::Default::default()
1972    }
1973
1974    /// Sets the value of [numerator][crate::model::Fraction::numerator].
1975    pub fn set_numerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1976        self.numerator = v.into();
1977        self
1978    }
1979
1980    /// Sets the value of [denominator][crate::model::Fraction::denominator].
1981    pub fn set_denominator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1982        self.denominator = v.into();
1983        self
1984    }
1985}
1986
1987impl wkt::message::Message for Fraction {
1988    fn typename() -> &'static str {
1989        "type.googleapis.com/google.type.Fraction"
1990    }
1991}
1992
1993#[doc(hidden)]
1994impl<'de> serde::de::Deserialize<'de> for Fraction {
1995    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1996    where
1997        D: serde::Deserializer<'de>,
1998    {
1999        #[allow(non_camel_case_types)]
2000        #[doc(hidden)]
2001        #[derive(PartialEq, Eq, Hash)]
2002        enum __FieldTag {
2003            __numerator,
2004            __denominator,
2005            Unknown(std::string::String),
2006        }
2007        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2008            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2009            where
2010                D: serde::Deserializer<'de>,
2011            {
2012                struct Visitor;
2013                impl<'de> serde::de::Visitor<'de> for Visitor {
2014                    type Value = __FieldTag;
2015                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2016                        formatter.write_str("a field name for Fraction")
2017                    }
2018                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2019                    where
2020                        E: serde::de::Error,
2021                    {
2022                        use std::result::Result::Ok;
2023                        use std::string::ToString;
2024                        match value {
2025                            "numerator" => Ok(__FieldTag::__numerator),
2026                            "denominator" => Ok(__FieldTag::__denominator),
2027                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2028                        }
2029                    }
2030                }
2031                deserializer.deserialize_identifier(Visitor)
2032            }
2033        }
2034        struct Visitor;
2035        impl<'de> serde::de::Visitor<'de> for Visitor {
2036            type Value = Fraction;
2037            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2038                formatter.write_str("struct Fraction")
2039            }
2040            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2041            where
2042                A: serde::de::MapAccess<'de>,
2043            {
2044                #[allow(unused_imports)]
2045                use serde::de::Error;
2046                use std::option::Option::Some;
2047                let mut fields = std::collections::HashSet::new();
2048                let mut result = Self::Value::new();
2049                while let Some(tag) = map.next_key::<__FieldTag>()? {
2050                    #[allow(clippy::match_single_binding)]
2051                    match tag {
2052                        __FieldTag::__numerator => {
2053                            if !fields.insert(__FieldTag::__numerator) {
2054                                return std::result::Result::Err(A::Error::duplicate_field(
2055                                    "multiple values for numerator",
2056                                ));
2057                            }
2058                            struct __With(std::option::Option<i64>);
2059                            impl<'de> serde::de::Deserialize<'de> for __With {
2060                                fn deserialize<D>(
2061                                    deserializer: D,
2062                                ) -> std::result::Result<Self, D::Error>
2063                                where
2064                                    D: serde::de::Deserializer<'de>,
2065                                {
2066                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2067                                }
2068                            }
2069                            result.numerator = map.next_value::<__With>()?.0.unwrap_or_default();
2070                        }
2071                        __FieldTag::__denominator => {
2072                            if !fields.insert(__FieldTag::__denominator) {
2073                                return std::result::Result::Err(A::Error::duplicate_field(
2074                                    "multiple values for denominator",
2075                                ));
2076                            }
2077                            struct __With(std::option::Option<i64>);
2078                            impl<'de> serde::de::Deserialize<'de> for __With {
2079                                fn deserialize<D>(
2080                                    deserializer: D,
2081                                ) -> std::result::Result<Self, D::Error>
2082                                where
2083                                    D: serde::de::Deserializer<'de>,
2084                                {
2085                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2086                                }
2087                            }
2088                            result.denominator = map.next_value::<__With>()?.0.unwrap_or_default();
2089                        }
2090                        __FieldTag::Unknown(key) => {
2091                            let value = map.next_value::<serde_json::Value>()?;
2092                            result._unknown_fields.insert(key, value);
2093                        }
2094                    }
2095                }
2096                std::result::Result::Ok(result)
2097            }
2098        }
2099        deserializer.deserialize_any(Visitor)
2100    }
2101}
2102
2103#[doc(hidden)]
2104impl serde::ser::Serialize for Fraction {
2105    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2106    where
2107        S: serde::ser::Serializer,
2108    {
2109        use serde::ser::SerializeMap;
2110        #[allow(unused_imports)]
2111        use std::option::Option::Some;
2112        let mut state = serializer.serialize_map(std::option::Option::None)?;
2113        if !wkt::internal::is_default(&self.numerator) {
2114            struct __With<'a>(&'a i64);
2115            impl<'a> serde::ser::Serialize for __With<'a> {
2116                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2117                where
2118                    S: serde::ser::Serializer,
2119                {
2120                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2121                }
2122            }
2123            state.serialize_entry("numerator", &__With(&self.numerator))?;
2124        }
2125        if !wkt::internal::is_default(&self.denominator) {
2126            struct __With<'a>(&'a i64);
2127            impl<'a> serde::ser::Serialize for __With<'a> {
2128                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2129                where
2130                    S: serde::ser::Serializer,
2131                {
2132                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2133                }
2134            }
2135            state.serialize_entry("denominator", &__With(&self.denominator))?;
2136        }
2137        if !self._unknown_fields.is_empty() {
2138            for (key, value) in self._unknown_fields.iter() {
2139                state.serialize_entry(key, &value)?;
2140            }
2141        }
2142        state.end()
2143    }
2144}
2145
2146impl std::fmt::Debug for Fraction {
2147    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2148        let mut debug_struct = f.debug_struct("Fraction");
2149        debug_struct.field("numerator", &self.numerator);
2150        debug_struct.field("denominator", &self.denominator);
2151        if !self._unknown_fields.is_empty() {
2152            debug_struct.field("_unknown_fields", &self._unknown_fields);
2153        }
2154        debug_struct.finish()
2155    }
2156}
2157
2158/// Represents a time interval, encoded as a Timestamp start (inclusive) and a
2159/// Timestamp end (exclusive).
2160///
2161/// The start must be less than or equal to the end.
2162/// When the start equals the end, the interval is empty (matches no time).
2163/// When both start and end are unspecified, the interval matches any time.
2164#[derive(Clone, Default, PartialEq)]
2165#[non_exhaustive]
2166pub struct Interval {
2167    /// Optional. Inclusive start of the interval.
2168    ///
2169    /// If specified, a Timestamp matching this interval will have to be the same
2170    /// or after the start.
2171    pub start_time: std::option::Option<wkt::Timestamp>,
2172
2173    /// Optional. Exclusive end of the interval.
2174    ///
2175    /// If specified, a Timestamp matching this interval will have to be before the
2176    /// end.
2177    pub end_time: std::option::Option<wkt::Timestamp>,
2178
2179    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2180}
2181
2182impl Interval {
2183    pub fn new() -> Self {
2184        std::default::Default::default()
2185    }
2186
2187    /// Sets the value of [start_time][crate::model::Interval::start_time].
2188    pub fn set_start_time<T>(mut self, v: T) -> Self
2189    where
2190        T: std::convert::Into<wkt::Timestamp>,
2191    {
2192        self.start_time = std::option::Option::Some(v.into());
2193        self
2194    }
2195
2196    /// Sets or clears the value of [start_time][crate::model::Interval::start_time].
2197    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2198    where
2199        T: std::convert::Into<wkt::Timestamp>,
2200    {
2201        self.start_time = v.map(|x| x.into());
2202        self
2203    }
2204
2205    /// Sets the value of [end_time][crate::model::Interval::end_time].
2206    pub fn set_end_time<T>(mut self, v: T) -> Self
2207    where
2208        T: std::convert::Into<wkt::Timestamp>,
2209    {
2210        self.end_time = std::option::Option::Some(v.into());
2211        self
2212    }
2213
2214    /// Sets or clears the value of [end_time][crate::model::Interval::end_time].
2215    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2216    where
2217        T: std::convert::Into<wkt::Timestamp>,
2218    {
2219        self.end_time = v.map(|x| x.into());
2220        self
2221    }
2222}
2223
2224impl wkt::message::Message for Interval {
2225    fn typename() -> &'static str {
2226        "type.googleapis.com/google.type.Interval"
2227    }
2228}
2229
2230#[doc(hidden)]
2231impl<'de> serde::de::Deserialize<'de> for Interval {
2232    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2233    where
2234        D: serde::Deserializer<'de>,
2235    {
2236        #[allow(non_camel_case_types)]
2237        #[doc(hidden)]
2238        #[derive(PartialEq, Eq, Hash)]
2239        enum __FieldTag {
2240            __start_time,
2241            __end_time,
2242            Unknown(std::string::String),
2243        }
2244        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2245            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2246            where
2247                D: serde::Deserializer<'de>,
2248            {
2249                struct Visitor;
2250                impl<'de> serde::de::Visitor<'de> for Visitor {
2251                    type Value = __FieldTag;
2252                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2253                        formatter.write_str("a field name for Interval")
2254                    }
2255                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2256                    where
2257                        E: serde::de::Error,
2258                    {
2259                        use std::result::Result::Ok;
2260                        use std::string::ToString;
2261                        match value {
2262                            "startTime" => Ok(__FieldTag::__start_time),
2263                            "start_time" => Ok(__FieldTag::__start_time),
2264                            "endTime" => Ok(__FieldTag::__end_time),
2265                            "end_time" => Ok(__FieldTag::__end_time),
2266                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2267                        }
2268                    }
2269                }
2270                deserializer.deserialize_identifier(Visitor)
2271            }
2272        }
2273        struct Visitor;
2274        impl<'de> serde::de::Visitor<'de> for Visitor {
2275            type Value = Interval;
2276            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2277                formatter.write_str("struct Interval")
2278            }
2279            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2280            where
2281                A: serde::de::MapAccess<'de>,
2282            {
2283                #[allow(unused_imports)]
2284                use serde::de::Error;
2285                use std::option::Option::Some;
2286                let mut fields = std::collections::HashSet::new();
2287                let mut result = Self::Value::new();
2288                while let Some(tag) = map.next_key::<__FieldTag>()? {
2289                    #[allow(clippy::match_single_binding)]
2290                    match tag {
2291                        __FieldTag::__start_time => {
2292                            if !fields.insert(__FieldTag::__start_time) {
2293                                return std::result::Result::Err(A::Error::duplicate_field(
2294                                    "multiple values for start_time",
2295                                ));
2296                            }
2297                            result.start_time =
2298                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2299                        }
2300                        __FieldTag::__end_time => {
2301                            if !fields.insert(__FieldTag::__end_time) {
2302                                return std::result::Result::Err(A::Error::duplicate_field(
2303                                    "multiple values for end_time",
2304                                ));
2305                            }
2306                            result.end_time =
2307                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2308                        }
2309                        __FieldTag::Unknown(key) => {
2310                            let value = map.next_value::<serde_json::Value>()?;
2311                            result._unknown_fields.insert(key, value);
2312                        }
2313                    }
2314                }
2315                std::result::Result::Ok(result)
2316            }
2317        }
2318        deserializer.deserialize_any(Visitor)
2319    }
2320}
2321
2322#[doc(hidden)]
2323impl serde::ser::Serialize for Interval {
2324    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2325    where
2326        S: serde::ser::Serializer,
2327    {
2328        use serde::ser::SerializeMap;
2329        #[allow(unused_imports)]
2330        use std::option::Option::Some;
2331        let mut state = serializer.serialize_map(std::option::Option::None)?;
2332        if self.start_time.is_some() {
2333            state.serialize_entry("startTime", &self.start_time)?;
2334        }
2335        if self.end_time.is_some() {
2336            state.serialize_entry("endTime", &self.end_time)?;
2337        }
2338        if !self._unknown_fields.is_empty() {
2339            for (key, value) in self._unknown_fields.iter() {
2340                state.serialize_entry(key, &value)?;
2341            }
2342        }
2343        state.end()
2344    }
2345}
2346
2347impl std::fmt::Debug for Interval {
2348    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2349        let mut debug_struct = f.debug_struct("Interval");
2350        debug_struct.field("start_time", &self.start_time);
2351        debug_struct.field("end_time", &self.end_time);
2352        if !self._unknown_fields.is_empty() {
2353            debug_struct.field("_unknown_fields", &self._unknown_fields);
2354        }
2355        debug_struct.finish()
2356    }
2357}
2358
2359/// An object that represents a latitude/longitude pair. This is expressed as a
2360/// pair of doubles to represent degrees latitude and degrees longitude. Unless
2361/// specified otherwise, this must conform to the
2362/// <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
2363/// standard</a>. Values must be within normalized ranges.
2364#[derive(Clone, Default, PartialEq)]
2365#[non_exhaustive]
2366pub struct LatLng {
2367    /// The latitude in degrees. It must be in the range [-90.0, +90.0].
2368    pub latitude: f64,
2369
2370    /// The longitude in degrees. It must be in the range [-180.0, +180.0].
2371    pub longitude: f64,
2372
2373    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2374}
2375
2376impl LatLng {
2377    pub fn new() -> Self {
2378        std::default::Default::default()
2379    }
2380
2381    /// Sets the value of [latitude][crate::model::LatLng::latitude].
2382    pub fn set_latitude<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2383        self.latitude = v.into();
2384        self
2385    }
2386
2387    /// Sets the value of [longitude][crate::model::LatLng::longitude].
2388    pub fn set_longitude<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2389        self.longitude = v.into();
2390        self
2391    }
2392}
2393
2394impl wkt::message::Message for LatLng {
2395    fn typename() -> &'static str {
2396        "type.googleapis.com/google.type.LatLng"
2397    }
2398}
2399
2400#[doc(hidden)]
2401impl<'de> serde::de::Deserialize<'de> for LatLng {
2402    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2403    where
2404        D: serde::Deserializer<'de>,
2405    {
2406        #[allow(non_camel_case_types)]
2407        #[doc(hidden)]
2408        #[derive(PartialEq, Eq, Hash)]
2409        enum __FieldTag {
2410            __latitude,
2411            __longitude,
2412            Unknown(std::string::String),
2413        }
2414        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2415            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2416            where
2417                D: serde::Deserializer<'de>,
2418            {
2419                struct Visitor;
2420                impl<'de> serde::de::Visitor<'de> for Visitor {
2421                    type Value = __FieldTag;
2422                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2423                        formatter.write_str("a field name for LatLng")
2424                    }
2425                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2426                    where
2427                        E: serde::de::Error,
2428                    {
2429                        use std::result::Result::Ok;
2430                        use std::string::ToString;
2431                        match value {
2432                            "latitude" => Ok(__FieldTag::__latitude),
2433                            "longitude" => Ok(__FieldTag::__longitude),
2434                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2435                        }
2436                    }
2437                }
2438                deserializer.deserialize_identifier(Visitor)
2439            }
2440        }
2441        struct Visitor;
2442        impl<'de> serde::de::Visitor<'de> for Visitor {
2443            type Value = LatLng;
2444            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2445                formatter.write_str("struct LatLng")
2446            }
2447            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2448            where
2449                A: serde::de::MapAccess<'de>,
2450            {
2451                #[allow(unused_imports)]
2452                use serde::de::Error;
2453                use std::option::Option::Some;
2454                let mut fields = std::collections::HashSet::new();
2455                let mut result = Self::Value::new();
2456                while let Some(tag) = map.next_key::<__FieldTag>()? {
2457                    #[allow(clippy::match_single_binding)]
2458                    match tag {
2459                        __FieldTag::__latitude => {
2460                            if !fields.insert(__FieldTag::__latitude) {
2461                                return std::result::Result::Err(A::Error::duplicate_field(
2462                                    "multiple values for latitude",
2463                                ));
2464                            }
2465                            struct __With(std::option::Option<f64>);
2466                            impl<'de> serde::de::Deserialize<'de> for __With {
2467                                fn deserialize<D>(
2468                                    deserializer: D,
2469                                ) -> std::result::Result<Self, D::Error>
2470                                where
2471                                    D: serde::de::Deserializer<'de>,
2472                                {
2473                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
2474                                }
2475                            }
2476                            result.latitude = map.next_value::<__With>()?.0.unwrap_or_default();
2477                        }
2478                        __FieldTag::__longitude => {
2479                            if !fields.insert(__FieldTag::__longitude) {
2480                                return std::result::Result::Err(A::Error::duplicate_field(
2481                                    "multiple values for longitude",
2482                                ));
2483                            }
2484                            struct __With(std::option::Option<f64>);
2485                            impl<'de> serde::de::Deserialize<'de> for __With {
2486                                fn deserialize<D>(
2487                                    deserializer: D,
2488                                ) -> std::result::Result<Self, D::Error>
2489                                where
2490                                    D: serde::de::Deserializer<'de>,
2491                                {
2492                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
2493                                }
2494                            }
2495                            result.longitude = map.next_value::<__With>()?.0.unwrap_or_default();
2496                        }
2497                        __FieldTag::Unknown(key) => {
2498                            let value = map.next_value::<serde_json::Value>()?;
2499                            result._unknown_fields.insert(key, value);
2500                        }
2501                    }
2502                }
2503                std::result::Result::Ok(result)
2504            }
2505        }
2506        deserializer.deserialize_any(Visitor)
2507    }
2508}
2509
2510#[doc(hidden)]
2511impl serde::ser::Serialize for LatLng {
2512    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2513    where
2514        S: serde::ser::Serializer,
2515    {
2516        use serde::ser::SerializeMap;
2517        #[allow(unused_imports)]
2518        use std::option::Option::Some;
2519        let mut state = serializer.serialize_map(std::option::Option::None)?;
2520        if !wkt::internal::is_default(&self.latitude) {
2521            struct __With<'a>(&'a f64);
2522            impl<'a> serde::ser::Serialize for __With<'a> {
2523                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2524                where
2525                    S: serde::ser::Serializer,
2526                {
2527                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
2528                }
2529            }
2530            state.serialize_entry("latitude", &__With(&self.latitude))?;
2531        }
2532        if !wkt::internal::is_default(&self.longitude) {
2533            struct __With<'a>(&'a f64);
2534            impl<'a> serde::ser::Serialize for __With<'a> {
2535                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2536                where
2537                    S: serde::ser::Serializer,
2538                {
2539                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
2540                }
2541            }
2542            state.serialize_entry("longitude", &__With(&self.longitude))?;
2543        }
2544        if !self._unknown_fields.is_empty() {
2545            for (key, value) in self._unknown_fields.iter() {
2546                state.serialize_entry(key, &value)?;
2547            }
2548        }
2549        state.end()
2550    }
2551}
2552
2553impl std::fmt::Debug for LatLng {
2554    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2555        let mut debug_struct = f.debug_struct("LatLng");
2556        debug_struct.field("latitude", &self.latitude);
2557        debug_struct.field("longitude", &self.longitude);
2558        if !self._unknown_fields.is_empty() {
2559            debug_struct.field("_unknown_fields", &self._unknown_fields);
2560        }
2561        debug_struct.finish()
2562    }
2563}
2564
2565/// Localized variant of a text in a particular language.
2566#[derive(Clone, Default, PartialEq)]
2567#[non_exhaustive]
2568pub struct LocalizedText {
2569    /// Localized string in the language corresponding to `language_code' below.
2570    pub text: std::string::String,
2571
2572    /// The text's BCP-47 language code, such as "en-US" or "sr-Latn".
2573    ///
2574    /// For more information, see
2575    /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier>.
2576    pub language_code: std::string::String,
2577
2578    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2579}
2580
2581impl LocalizedText {
2582    pub fn new() -> Self {
2583        std::default::Default::default()
2584    }
2585
2586    /// Sets the value of [text][crate::model::LocalizedText::text].
2587    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2588        self.text = v.into();
2589        self
2590    }
2591
2592    /// Sets the value of [language_code][crate::model::LocalizedText::language_code].
2593    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2594        self.language_code = v.into();
2595        self
2596    }
2597}
2598
2599impl wkt::message::Message for LocalizedText {
2600    fn typename() -> &'static str {
2601        "type.googleapis.com/google.type.LocalizedText"
2602    }
2603}
2604
2605#[doc(hidden)]
2606impl<'de> serde::de::Deserialize<'de> for LocalizedText {
2607    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2608    where
2609        D: serde::Deserializer<'de>,
2610    {
2611        #[allow(non_camel_case_types)]
2612        #[doc(hidden)]
2613        #[derive(PartialEq, Eq, Hash)]
2614        enum __FieldTag {
2615            __text,
2616            __language_code,
2617            Unknown(std::string::String),
2618        }
2619        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2620            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2621            where
2622                D: serde::Deserializer<'de>,
2623            {
2624                struct Visitor;
2625                impl<'de> serde::de::Visitor<'de> for Visitor {
2626                    type Value = __FieldTag;
2627                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2628                        formatter.write_str("a field name for LocalizedText")
2629                    }
2630                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2631                    where
2632                        E: serde::de::Error,
2633                    {
2634                        use std::result::Result::Ok;
2635                        use std::string::ToString;
2636                        match value {
2637                            "text" => Ok(__FieldTag::__text),
2638                            "languageCode" => Ok(__FieldTag::__language_code),
2639                            "language_code" => Ok(__FieldTag::__language_code),
2640                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2641                        }
2642                    }
2643                }
2644                deserializer.deserialize_identifier(Visitor)
2645            }
2646        }
2647        struct Visitor;
2648        impl<'de> serde::de::Visitor<'de> for Visitor {
2649            type Value = LocalizedText;
2650            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2651                formatter.write_str("struct LocalizedText")
2652            }
2653            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2654            where
2655                A: serde::de::MapAccess<'de>,
2656            {
2657                #[allow(unused_imports)]
2658                use serde::de::Error;
2659                use std::option::Option::Some;
2660                let mut fields = std::collections::HashSet::new();
2661                let mut result = Self::Value::new();
2662                while let Some(tag) = map.next_key::<__FieldTag>()? {
2663                    #[allow(clippy::match_single_binding)]
2664                    match tag {
2665                        __FieldTag::__text => {
2666                            if !fields.insert(__FieldTag::__text) {
2667                                return std::result::Result::Err(A::Error::duplicate_field(
2668                                    "multiple values for text",
2669                                ));
2670                            }
2671                            result.text = map
2672                                .next_value::<std::option::Option<std::string::String>>()?
2673                                .unwrap_or_default();
2674                        }
2675                        __FieldTag::__language_code => {
2676                            if !fields.insert(__FieldTag::__language_code) {
2677                                return std::result::Result::Err(A::Error::duplicate_field(
2678                                    "multiple values for language_code",
2679                                ));
2680                            }
2681                            result.language_code = map
2682                                .next_value::<std::option::Option<std::string::String>>()?
2683                                .unwrap_or_default();
2684                        }
2685                        __FieldTag::Unknown(key) => {
2686                            let value = map.next_value::<serde_json::Value>()?;
2687                            result._unknown_fields.insert(key, value);
2688                        }
2689                    }
2690                }
2691                std::result::Result::Ok(result)
2692            }
2693        }
2694        deserializer.deserialize_any(Visitor)
2695    }
2696}
2697
2698#[doc(hidden)]
2699impl serde::ser::Serialize for LocalizedText {
2700    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2701    where
2702        S: serde::ser::Serializer,
2703    {
2704        use serde::ser::SerializeMap;
2705        #[allow(unused_imports)]
2706        use std::option::Option::Some;
2707        let mut state = serializer.serialize_map(std::option::Option::None)?;
2708        if !self.text.is_empty() {
2709            state.serialize_entry("text", &self.text)?;
2710        }
2711        if !self.language_code.is_empty() {
2712            state.serialize_entry("languageCode", &self.language_code)?;
2713        }
2714        if !self._unknown_fields.is_empty() {
2715            for (key, value) in self._unknown_fields.iter() {
2716                state.serialize_entry(key, &value)?;
2717            }
2718        }
2719        state.end()
2720    }
2721}
2722
2723impl std::fmt::Debug for LocalizedText {
2724    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2725        let mut debug_struct = f.debug_struct("LocalizedText");
2726        debug_struct.field("text", &self.text);
2727        debug_struct.field("language_code", &self.language_code);
2728        if !self._unknown_fields.is_empty() {
2729            debug_struct.field("_unknown_fields", &self._unknown_fields);
2730        }
2731        debug_struct.finish()
2732    }
2733}
2734
2735/// Represents an amount of money with its currency type.
2736#[derive(Clone, Default, PartialEq)]
2737#[non_exhaustive]
2738pub struct Money {
2739    /// The three-letter currency code defined in ISO 4217.
2740    pub currency_code: std::string::String,
2741
2742    /// The whole units of the amount.
2743    /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
2744    pub units: i64,
2745
2746    /// Number of nano (10^-9) units of the amount.
2747    /// The value must be between -999,999,999 and +999,999,999 inclusive.
2748    /// If `units` is positive, `nanos` must be positive or zero.
2749    /// If `units` is zero, `nanos` can be positive, zero, or negative.
2750    /// If `units` is negative, `nanos` must be negative or zero.
2751    /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
2752    pub nanos: i32,
2753
2754    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2755}
2756
2757impl Money {
2758    pub fn new() -> Self {
2759        std::default::Default::default()
2760    }
2761
2762    /// Sets the value of [currency_code][crate::model::Money::currency_code].
2763    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2764        self.currency_code = v.into();
2765        self
2766    }
2767
2768    /// Sets the value of [units][crate::model::Money::units].
2769    pub fn set_units<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2770        self.units = v.into();
2771        self
2772    }
2773
2774    /// Sets the value of [nanos][crate::model::Money::nanos].
2775    pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2776        self.nanos = v.into();
2777        self
2778    }
2779}
2780
2781impl wkt::message::Message for Money {
2782    fn typename() -> &'static str {
2783        "type.googleapis.com/google.type.Money"
2784    }
2785}
2786
2787#[doc(hidden)]
2788impl<'de> serde::de::Deserialize<'de> for Money {
2789    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2790    where
2791        D: serde::Deserializer<'de>,
2792    {
2793        #[allow(non_camel_case_types)]
2794        #[doc(hidden)]
2795        #[derive(PartialEq, Eq, Hash)]
2796        enum __FieldTag {
2797            __currency_code,
2798            __units,
2799            __nanos,
2800            Unknown(std::string::String),
2801        }
2802        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2803            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2804            where
2805                D: serde::Deserializer<'de>,
2806            {
2807                struct Visitor;
2808                impl<'de> serde::de::Visitor<'de> for Visitor {
2809                    type Value = __FieldTag;
2810                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2811                        formatter.write_str("a field name for Money")
2812                    }
2813                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2814                    where
2815                        E: serde::de::Error,
2816                    {
2817                        use std::result::Result::Ok;
2818                        use std::string::ToString;
2819                        match value {
2820                            "currencyCode" => Ok(__FieldTag::__currency_code),
2821                            "currency_code" => Ok(__FieldTag::__currency_code),
2822                            "units" => Ok(__FieldTag::__units),
2823                            "nanos" => Ok(__FieldTag::__nanos),
2824                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2825                        }
2826                    }
2827                }
2828                deserializer.deserialize_identifier(Visitor)
2829            }
2830        }
2831        struct Visitor;
2832        impl<'de> serde::de::Visitor<'de> for Visitor {
2833            type Value = Money;
2834            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2835                formatter.write_str("struct Money")
2836            }
2837            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2838            where
2839                A: serde::de::MapAccess<'de>,
2840            {
2841                #[allow(unused_imports)]
2842                use serde::de::Error;
2843                use std::option::Option::Some;
2844                let mut fields = std::collections::HashSet::new();
2845                let mut result = Self::Value::new();
2846                while let Some(tag) = map.next_key::<__FieldTag>()? {
2847                    #[allow(clippy::match_single_binding)]
2848                    match tag {
2849                        __FieldTag::__currency_code => {
2850                            if !fields.insert(__FieldTag::__currency_code) {
2851                                return std::result::Result::Err(A::Error::duplicate_field(
2852                                    "multiple values for currency_code",
2853                                ));
2854                            }
2855                            result.currency_code = map
2856                                .next_value::<std::option::Option<std::string::String>>()?
2857                                .unwrap_or_default();
2858                        }
2859                        __FieldTag::__units => {
2860                            if !fields.insert(__FieldTag::__units) {
2861                                return std::result::Result::Err(A::Error::duplicate_field(
2862                                    "multiple values for units",
2863                                ));
2864                            }
2865                            struct __With(std::option::Option<i64>);
2866                            impl<'de> serde::de::Deserialize<'de> for __With {
2867                                fn deserialize<D>(
2868                                    deserializer: D,
2869                                ) -> std::result::Result<Self, D::Error>
2870                                where
2871                                    D: serde::de::Deserializer<'de>,
2872                                {
2873                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2874                                }
2875                            }
2876                            result.units = map.next_value::<__With>()?.0.unwrap_or_default();
2877                        }
2878                        __FieldTag::__nanos => {
2879                            if !fields.insert(__FieldTag::__nanos) {
2880                                return std::result::Result::Err(A::Error::duplicate_field(
2881                                    "multiple values for nanos",
2882                                ));
2883                            }
2884                            struct __With(std::option::Option<i32>);
2885                            impl<'de> serde::de::Deserialize<'de> for __With {
2886                                fn deserialize<D>(
2887                                    deserializer: D,
2888                                ) -> std::result::Result<Self, D::Error>
2889                                where
2890                                    D: serde::de::Deserializer<'de>,
2891                                {
2892                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2893                                }
2894                            }
2895                            result.nanos = map.next_value::<__With>()?.0.unwrap_or_default();
2896                        }
2897                        __FieldTag::Unknown(key) => {
2898                            let value = map.next_value::<serde_json::Value>()?;
2899                            result._unknown_fields.insert(key, value);
2900                        }
2901                    }
2902                }
2903                std::result::Result::Ok(result)
2904            }
2905        }
2906        deserializer.deserialize_any(Visitor)
2907    }
2908}
2909
2910#[doc(hidden)]
2911impl serde::ser::Serialize for Money {
2912    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2913    where
2914        S: serde::ser::Serializer,
2915    {
2916        use serde::ser::SerializeMap;
2917        #[allow(unused_imports)]
2918        use std::option::Option::Some;
2919        let mut state = serializer.serialize_map(std::option::Option::None)?;
2920        if !self.currency_code.is_empty() {
2921            state.serialize_entry("currencyCode", &self.currency_code)?;
2922        }
2923        if !wkt::internal::is_default(&self.units) {
2924            struct __With<'a>(&'a i64);
2925            impl<'a> serde::ser::Serialize for __With<'a> {
2926                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2927                where
2928                    S: serde::ser::Serializer,
2929                {
2930                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2931                }
2932            }
2933            state.serialize_entry("units", &__With(&self.units))?;
2934        }
2935        if !wkt::internal::is_default(&self.nanos) {
2936            struct __With<'a>(&'a i32);
2937            impl<'a> serde::ser::Serialize for __With<'a> {
2938                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2939                where
2940                    S: serde::ser::Serializer,
2941                {
2942                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2943                }
2944            }
2945            state.serialize_entry("nanos", &__With(&self.nanos))?;
2946        }
2947        if !self._unknown_fields.is_empty() {
2948            for (key, value) in self._unknown_fields.iter() {
2949                state.serialize_entry(key, &value)?;
2950            }
2951        }
2952        state.end()
2953    }
2954}
2955
2956impl std::fmt::Debug for Money {
2957    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2958        let mut debug_struct = f.debug_struct("Money");
2959        debug_struct.field("currency_code", &self.currency_code);
2960        debug_struct.field("units", &self.units);
2961        debug_struct.field("nanos", &self.nanos);
2962        if !self._unknown_fields.is_empty() {
2963            debug_struct.field("_unknown_fields", &self._unknown_fields);
2964        }
2965        debug_struct.finish()
2966    }
2967}
2968
2969/// An object representing a phone number, suitable as an API wire format.
2970///
2971/// This representation:
2972///
2973/// - should not be used for locale-specific formatting of a phone number, such
2974///   as "+1 (650) 253-0000 ext. 123"
2975///
2976/// - is not designed for efficient storage
2977///
2978/// - may not be suitable for dialing - specialized libraries (see references)
2979///   should be used to parse the number for that purpose
2980///
2981///
2982/// To do something meaningful with this number, such as format it for various
2983/// use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.
2984///
2985/// For instance, in Java this would be:
2986///
2987/// com.google.type.PhoneNumber wireProto =
2988/// com.google.type.PhoneNumber.newBuilder().build();
2989/// com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =
2990/// PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ");
2991/// if (!wireProto.getExtension().isEmpty()) {
2992/// phoneNumber.setExtension(wireProto.getExtension());
2993/// }
2994///
2995/// Reference(s):
2996///
2997/// - <https://github.com/google/libphonenumber>
2998#[derive(Clone, Default, PartialEq)]
2999#[non_exhaustive]
3000pub struct PhoneNumber {
3001    /// The phone number's extension. The extension is not standardized in ITU
3002    /// recommendations, except for being defined as a series of numbers with a
3003    /// maximum length of 40 digits. Other than digits, some other dialing
3004    /// characters such as ',' (indicating a wait) or '#' may be stored here.
3005    ///
3006    /// Note that no regions currently use extensions with short codes, so this
3007    /// field is normally only set in conjunction with an E.164 number. It is held
3008    /// separately from the E.164 number to allow for short code extensions in the
3009    /// future.
3010    pub extension: std::string::String,
3011
3012    /// Required.  Either a regular number, or a short code.  New fields may be
3013    /// added to the oneof below in the future, so clients should ignore phone
3014    /// numbers for which none of the fields they coded against are set.
3015    pub kind: std::option::Option<crate::model::phone_number::Kind>,
3016
3017    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3018}
3019
3020impl PhoneNumber {
3021    pub fn new() -> Self {
3022        std::default::Default::default()
3023    }
3024
3025    /// Sets the value of [extension][crate::model::PhoneNumber::extension].
3026    pub fn set_extension<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3027        self.extension = v.into();
3028        self
3029    }
3030
3031    /// Sets the value of [kind][crate::model::PhoneNumber::kind].
3032    ///
3033    /// Note that all the setters affecting `kind` are mutually
3034    /// exclusive.
3035    pub fn set_kind<
3036        T: std::convert::Into<std::option::Option<crate::model::phone_number::Kind>>,
3037    >(
3038        mut self,
3039        v: T,
3040    ) -> Self {
3041        self.kind = v.into();
3042        self
3043    }
3044
3045    /// The value of [kind][crate::model::PhoneNumber::kind]
3046    /// if it holds a `E164Number`, `None` if the field is not set or
3047    /// holds a different branch.
3048    pub fn e164_number(&self) -> std::option::Option<&std::string::String> {
3049        #[allow(unreachable_patterns)]
3050        self.kind.as_ref().and_then(|v| match v {
3051            crate::model::phone_number::Kind::E164Number(v) => std::option::Option::Some(v),
3052            _ => std::option::Option::None,
3053        })
3054    }
3055
3056    /// Sets the value of [kind][crate::model::PhoneNumber::kind]
3057    /// to hold a `E164Number`.
3058    ///
3059    /// Note that all the setters affecting `kind` are
3060    /// mutually exclusive.
3061    pub fn set_e164_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3062        self.kind =
3063            std::option::Option::Some(crate::model::phone_number::Kind::E164Number(v.into()));
3064        self
3065    }
3066
3067    /// The value of [kind][crate::model::PhoneNumber::kind]
3068    /// if it holds a `ShortCode`, `None` if the field is not set or
3069    /// holds a different branch.
3070    pub fn short_code(
3071        &self,
3072    ) -> std::option::Option<&std::boxed::Box<crate::model::phone_number::ShortCode>> {
3073        #[allow(unreachable_patterns)]
3074        self.kind.as_ref().and_then(|v| match v {
3075            crate::model::phone_number::Kind::ShortCode(v) => std::option::Option::Some(v),
3076            _ => std::option::Option::None,
3077        })
3078    }
3079
3080    /// Sets the value of [kind][crate::model::PhoneNumber::kind]
3081    /// to hold a `ShortCode`.
3082    ///
3083    /// Note that all the setters affecting `kind` are
3084    /// mutually exclusive.
3085    pub fn set_short_code<
3086        T: std::convert::Into<std::boxed::Box<crate::model::phone_number::ShortCode>>,
3087    >(
3088        mut self,
3089        v: T,
3090    ) -> Self {
3091        self.kind =
3092            std::option::Option::Some(crate::model::phone_number::Kind::ShortCode(v.into()));
3093        self
3094    }
3095}
3096
3097impl wkt::message::Message for PhoneNumber {
3098    fn typename() -> &'static str {
3099        "type.googleapis.com/google.type.PhoneNumber"
3100    }
3101}
3102
3103#[doc(hidden)]
3104impl<'de> serde::de::Deserialize<'de> for PhoneNumber {
3105    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3106    where
3107        D: serde::Deserializer<'de>,
3108    {
3109        #[allow(non_camel_case_types)]
3110        #[doc(hidden)]
3111        #[derive(PartialEq, Eq, Hash)]
3112        enum __FieldTag {
3113            __e164_number,
3114            __short_code,
3115            __extension,
3116            Unknown(std::string::String),
3117        }
3118        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3119            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3120            where
3121                D: serde::Deserializer<'de>,
3122            {
3123                struct Visitor;
3124                impl<'de> serde::de::Visitor<'de> for Visitor {
3125                    type Value = __FieldTag;
3126                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3127                        formatter.write_str("a field name for PhoneNumber")
3128                    }
3129                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3130                    where
3131                        E: serde::de::Error,
3132                    {
3133                        use std::result::Result::Ok;
3134                        use std::string::ToString;
3135                        match value {
3136                            "e164Number" => Ok(__FieldTag::__e164_number),
3137                            "e164_number" => Ok(__FieldTag::__e164_number),
3138                            "shortCode" => Ok(__FieldTag::__short_code),
3139                            "short_code" => Ok(__FieldTag::__short_code),
3140                            "extension" => Ok(__FieldTag::__extension),
3141                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3142                        }
3143                    }
3144                }
3145                deserializer.deserialize_identifier(Visitor)
3146            }
3147        }
3148        struct Visitor;
3149        impl<'de> serde::de::Visitor<'de> for Visitor {
3150            type Value = PhoneNumber;
3151            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3152                formatter.write_str("struct PhoneNumber")
3153            }
3154            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3155            where
3156                A: serde::de::MapAccess<'de>,
3157            {
3158                #[allow(unused_imports)]
3159                use serde::de::Error;
3160                use std::option::Option::Some;
3161                let mut fields = std::collections::HashSet::new();
3162                let mut result = Self::Value::new();
3163                while let Some(tag) = map.next_key::<__FieldTag>()? {
3164                    #[allow(clippy::match_single_binding)]
3165                    match tag {
3166                        __FieldTag::__e164_number => {
3167                            if !fields.insert(__FieldTag::__e164_number) {
3168                                return std::result::Result::Err(A::Error::duplicate_field(
3169                                    "multiple values for e164_number",
3170                                ));
3171                            }
3172                            if result.kind.is_some() {
3173                                return std::result::Result::Err(A::Error::duplicate_field(
3174                                    "multiple values for `kind`, a oneof with full ID .google.type.PhoneNumber.e164_number, latest field was e164Number",
3175                                ));
3176                            }
3177                            result.kind = std::option::Option::Some(
3178                                crate::model::phone_number::Kind::E164Number(
3179                                    map.next_value::<std::option::Option<std::string::String>>()?
3180                                        .unwrap_or_default(),
3181                                ),
3182                            );
3183                        }
3184                        __FieldTag::__short_code => {
3185                            if !fields.insert(__FieldTag::__short_code) {
3186                                return std::result::Result::Err(A::Error::duplicate_field(
3187                                    "multiple values for short_code",
3188                                ));
3189                            }
3190                            if result.kind.is_some() {
3191                                return std::result::Result::Err(A::Error::duplicate_field(
3192                                    "multiple values for `kind`, a oneof with full ID .google.type.PhoneNumber.short_code, latest field was shortCode",
3193                                ));
3194                            }
3195                            result.kind = std::option::Option::Some(
3196                                crate::model::phone_number::Kind::ShortCode(
3197                                    map.next_value::<std::option::Option<
3198                                        std::boxed::Box<crate::model::phone_number::ShortCode>,
3199                                    >>()?
3200                                    .unwrap_or_default(),
3201                                ),
3202                            );
3203                        }
3204                        __FieldTag::__extension => {
3205                            if !fields.insert(__FieldTag::__extension) {
3206                                return std::result::Result::Err(A::Error::duplicate_field(
3207                                    "multiple values for extension",
3208                                ));
3209                            }
3210                            result.extension = map
3211                                .next_value::<std::option::Option<std::string::String>>()?
3212                                .unwrap_or_default();
3213                        }
3214                        __FieldTag::Unknown(key) => {
3215                            let value = map.next_value::<serde_json::Value>()?;
3216                            result._unknown_fields.insert(key, value);
3217                        }
3218                    }
3219                }
3220                std::result::Result::Ok(result)
3221            }
3222        }
3223        deserializer.deserialize_any(Visitor)
3224    }
3225}
3226
3227#[doc(hidden)]
3228impl serde::ser::Serialize for PhoneNumber {
3229    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3230    where
3231        S: serde::ser::Serializer,
3232    {
3233        use serde::ser::SerializeMap;
3234        #[allow(unused_imports)]
3235        use std::option::Option::Some;
3236        let mut state = serializer.serialize_map(std::option::Option::None)?;
3237        if let Some(value) = self.e164_number() {
3238            state.serialize_entry("e164Number", value)?;
3239        }
3240        if let Some(value) = self.short_code() {
3241            state.serialize_entry("shortCode", value)?;
3242        }
3243        if !self.extension.is_empty() {
3244            state.serialize_entry("extension", &self.extension)?;
3245        }
3246        if !self._unknown_fields.is_empty() {
3247            for (key, value) in self._unknown_fields.iter() {
3248                state.serialize_entry(key, &value)?;
3249            }
3250        }
3251        state.end()
3252    }
3253}
3254
3255impl std::fmt::Debug for PhoneNumber {
3256    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3257        let mut debug_struct = f.debug_struct("PhoneNumber");
3258        debug_struct.field("extension", &self.extension);
3259        debug_struct.field("kind", &self.kind);
3260        if !self._unknown_fields.is_empty() {
3261            debug_struct.field("_unknown_fields", &self._unknown_fields);
3262        }
3263        debug_struct.finish()
3264    }
3265}
3266
3267/// Defines additional types related to [PhoneNumber].
3268pub mod phone_number {
3269    #[allow(unused_imports)]
3270    use super::*;
3271
3272    /// An object representing a short code, which is a phone number that is
3273    /// typically much shorter than regular phone numbers and can be used to
3274    /// address messages in MMS and SMS systems, as well as for abbreviated dialing
3275    /// (e.g. "Text 611 to see how many minutes you have remaining on your plan.").
3276    ///
3277    /// Short codes are restricted to a region and are not internationally
3278    /// dialable, which means the same short code can exist in different regions,
3279    /// with different usage and pricing, even if those regions share the same
3280    /// country calling code (e.g. US and CA).
3281    #[derive(Clone, Default, PartialEq)]
3282    #[non_exhaustive]
3283    pub struct ShortCode {
3284        /// Required. The BCP-47 region code of the location where calls to this
3285        /// short code can be made, such as "US" and "BB".
3286        ///
3287        /// Reference(s):
3288        ///
3289        /// - <http://www.unicode.org/reports/tr35/#unicode_region_subtag>
3290        pub region_code: std::string::String,
3291
3292        /// Required. The short code digits, without a leading plus ('+') or country
3293        /// calling code, e.g. "611".
3294        pub number: std::string::String,
3295
3296        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3297    }
3298
3299    impl ShortCode {
3300        pub fn new() -> Self {
3301            std::default::Default::default()
3302        }
3303
3304        /// Sets the value of [region_code][crate::model::phone_number::ShortCode::region_code].
3305        pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3306            self.region_code = v.into();
3307            self
3308        }
3309
3310        /// Sets the value of [number][crate::model::phone_number::ShortCode::number].
3311        pub fn set_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3312            self.number = v.into();
3313            self
3314        }
3315    }
3316
3317    impl wkt::message::Message for ShortCode {
3318        fn typename() -> &'static str {
3319            "type.googleapis.com/google.type.PhoneNumber.ShortCode"
3320        }
3321    }
3322
3323    #[doc(hidden)]
3324    impl<'de> serde::de::Deserialize<'de> for ShortCode {
3325        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3326        where
3327            D: serde::Deserializer<'de>,
3328        {
3329            #[allow(non_camel_case_types)]
3330            #[doc(hidden)]
3331            #[derive(PartialEq, Eq, Hash)]
3332            enum __FieldTag {
3333                __region_code,
3334                __number,
3335                Unknown(std::string::String),
3336            }
3337            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3338                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3339                where
3340                    D: serde::Deserializer<'de>,
3341                {
3342                    struct Visitor;
3343                    impl<'de> serde::de::Visitor<'de> for Visitor {
3344                        type Value = __FieldTag;
3345                        fn expecting(
3346                            &self,
3347                            formatter: &mut std::fmt::Formatter,
3348                        ) -> std::fmt::Result {
3349                            formatter.write_str("a field name for ShortCode")
3350                        }
3351                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3352                        where
3353                            E: serde::de::Error,
3354                        {
3355                            use std::result::Result::Ok;
3356                            use std::string::ToString;
3357                            match value {
3358                                "regionCode" => Ok(__FieldTag::__region_code),
3359                                "region_code" => Ok(__FieldTag::__region_code),
3360                                "number" => Ok(__FieldTag::__number),
3361                                _ => Ok(__FieldTag::Unknown(value.to_string())),
3362                            }
3363                        }
3364                    }
3365                    deserializer.deserialize_identifier(Visitor)
3366                }
3367            }
3368            struct Visitor;
3369            impl<'de> serde::de::Visitor<'de> for Visitor {
3370                type Value = ShortCode;
3371                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3372                    formatter.write_str("struct ShortCode")
3373                }
3374                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3375                where
3376                    A: serde::de::MapAccess<'de>,
3377                {
3378                    #[allow(unused_imports)]
3379                    use serde::de::Error;
3380                    use std::option::Option::Some;
3381                    let mut fields = std::collections::HashSet::new();
3382                    let mut result = Self::Value::new();
3383                    while let Some(tag) = map.next_key::<__FieldTag>()? {
3384                        #[allow(clippy::match_single_binding)]
3385                        match tag {
3386                            __FieldTag::__region_code => {
3387                                if !fields.insert(__FieldTag::__region_code) {
3388                                    return std::result::Result::Err(A::Error::duplicate_field(
3389                                        "multiple values for region_code",
3390                                    ));
3391                                }
3392                                result.region_code = map
3393                                    .next_value::<std::option::Option<std::string::String>>()?
3394                                    .unwrap_or_default();
3395                            }
3396                            __FieldTag::__number => {
3397                                if !fields.insert(__FieldTag::__number) {
3398                                    return std::result::Result::Err(A::Error::duplicate_field(
3399                                        "multiple values for number",
3400                                    ));
3401                                }
3402                                result.number = map
3403                                    .next_value::<std::option::Option<std::string::String>>()?
3404                                    .unwrap_or_default();
3405                            }
3406                            __FieldTag::Unknown(key) => {
3407                                let value = map.next_value::<serde_json::Value>()?;
3408                                result._unknown_fields.insert(key, value);
3409                            }
3410                        }
3411                    }
3412                    std::result::Result::Ok(result)
3413                }
3414            }
3415            deserializer.deserialize_any(Visitor)
3416        }
3417    }
3418
3419    #[doc(hidden)]
3420    impl serde::ser::Serialize for ShortCode {
3421        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3422        where
3423            S: serde::ser::Serializer,
3424        {
3425            use serde::ser::SerializeMap;
3426            #[allow(unused_imports)]
3427            use std::option::Option::Some;
3428            let mut state = serializer.serialize_map(std::option::Option::None)?;
3429            if !self.region_code.is_empty() {
3430                state.serialize_entry("regionCode", &self.region_code)?;
3431            }
3432            if !self.number.is_empty() {
3433                state.serialize_entry("number", &self.number)?;
3434            }
3435            if !self._unknown_fields.is_empty() {
3436                for (key, value) in self._unknown_fields.iter() {
3437                    state.serialize_entry(key, &value)?;
3438                }
3439            }
3440            state.end()
3441        }
3442    }
3443
3444    impl std::fmt::Debug for ShortCode {
3445        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3446            let mut debug_struct = f.debug_struct("ShortCode");
3447            debug_struct.field("region_code", &self.region_code);
3448            debug_struct.field("number", &self.number);
3449            if !self._unknown_fields.is_empty() {
3450                debug_struct.field("_unknown_fields", &self._unknown_fields);
3451            }
3452            debug_struct.finish()
3453        }
3454    }
3455
3456    /// Required.  Either a regular number, or a short code.  New fields may be
3457    /// added to the oneof below in the future, so clients should ignore phone
3458    /// numbers for which none of the fields they coded against are set.
3459    #[derive(Clone, Debug, PartialEq)]
3460    #[non_exhaustive]
3461    pub enum Kind {
3462        /// The phone number, represented as a leading plus sign ('+'), followed by a
3463        /// phone number that uses a relaxed ITU E.164 format consisting of the
3464        /// country calling code (1 to 3 digits) and the subscriber number, with no
3465        /// additional spaces or formatting, e.g.:
3466        ///
3467        /// - correct: "+15552220123"
3468        /// - incorrect: "+1 (555) 222-01234 x123".
3469        ///
3470        /// The ITU E.164 format limits the latter to 12 digits, but in practice not
3471        /// all countries respect that, so we relax that restriction here.
3472        /// National-only numbers are not allowed.
3473        ///
3474        /// References:
3475        ///
3476        /// - <https://www.itu.int/rec/T-REC-E.164-201011-I>
3477        /// - <https://en.wikipedia.org/wiki/E.164>.
3478        /// - <https://en.wikipedia.org/wiki/List_of_country_calling_codes>
3479        E164Number(std::string::String),
3480        /// A short code.
3481        ///
3482        /// Reference(s):
3483        ///
3484        /// - <https://en.wikipedia.org/wiki/Short_code>
3485        ShortCode(std::boxed::Box<crate::model::phone_number::ShortCode>),
3486    }
3487}
3488
3489/// Represents a postal address, e.g. for postal delivery or payments addresses.
3490/// Given a postal address, a postal service can deliver items to a premise, P.O.
3491/// Box or similar.
3492/// It is not intended to model geographical locations (roads, towns,
3493/// mountains).
3494///
3495/// In typical usage an address would be created via user input or from importing
3496/// existing data, depending on the type of process.
3497///
3498/// Advice on address input / editing:
3499///
3500/// - Use an i18n-ready address widget such as
3501///   <https://github.com/google/libaddressinput>)
3502/// - Users should not be presented with UI elements for input or editing of
3503///   fields outside countries where that field is used.
3504///
3505/// For more guidance on how to use this schema, please see:
3506/// <https://support.google.com/business/answer/6397478>
3507#[derive(Clone, Default, PartialEq)]
3508#[non_exhaustive]
3509pub struct PostalAddress {
3510    /// The schema revision of the `PostalAddress`. This must be set to 0, which is
3511    /// the latest revision.
3512    ///
3513    /// All new revisions **must** be backward compatible with old revisions.
3514    pub revision: i32,
3515
3516    /// Required. CLDR region code of the country/region of the address. This
3517    /// is never inferred and it is up to the user to ensure the value is
3518    /// correct. See <http://cldr.unicode.org/> and
3519    /// <http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html>
3520    /// for details. Example: "CH" for Switzerland.
3521    pub region_code: std::string::String,
3522
3523    /// Optional. BCP-47 language code of the contents of this address (if
3524    /// known). This is often the UI language of the input form or is expected
3525    /// to match one of the languages used in the address' country/region, or their
3526    /// transliterated equivalents.
3527    /// This can affect formatting in certain countries, but is not critical
3528    /// to the correctness of the data and will never affect any validation or
3529    /// other non-formatting related operations.
3530    ///
3531    /// If this value is not known, it should be omitted (rather than specifying a
3532    /// possibly incorrect default).
3533    ///
3534    /// Examples: "zh-Hant", "ja", "ja-Latn", "en".
3535    pub language_code: std::string::String,
3536
3537    /// Optional. Postal code of the address. Not all countries use or require
3538    /// postal codes to be present, but where they are used, they may trigger
3539    /// additional validation with other parts of the address (e.g. state/zip
3540    /// validation in the U.S.A.).
3541    pub postal_code: std::string::String,
3542
3543    /// Optional. Additional, country-specific, sorting code. This is not used
3544    /// in most regions. Where it is used, the value is either a string like
3545    /// "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number
3546    /// alone, representing the "sector code" (Jamaica), "delivery area indicator"
3547    /// (Malawi) or "post office indicator" (e.g. Côte d'Ivoire).
3548    pub sorting_code: std::string::String,
3549
3550    /// Optional. Highest administrative subdivision which is used for postal
3551    /// addresses of a country or region.
3552    /// For example, this can be a state, a province, an oblast, or a prefecture.
3553    /// Specifically, for Spain this is the province and not the autonomous
3554    /// community (e.g. "Barcelona" and not "Catalonia").
3555    /// Many countries don't use an administrative area in postal addresses. E.g.
3556    /// in Switzerland this should be left unpopulated.
3557    pub administrative_area: std::string::String,
3558
3559    /// Optional. Generally refers to the city/town portion of the address.
3560    /// Examples: US city, IT comune, UK post town.
3561    /// In regions of the world where localities are not well defined or do not fit
3562    /// into this structure well, leave locality empty and use address_lines.
3563    pub locality: std::string::String,
3564
3565    /// Optional. Sublocality of the address.
3566    /// For example, this can be neighborhoods, boroughs, districts.
3567    pub sublocality: std::string::String,
3568
3569    /// Unstructured address lines describing the lower levels of an address.
3570    ///
3571    /// Because values in address_lines do not have type information and may
3572    /// sometimes contain multiple values in a single field (e.g.
3573    /// "Austin, TX"), it is important that the line order is clear. The order of
3574    /// address lines should be "envelope order" for the country/region of the
3575    /// address. In places where this can vary (e.g. Japan), address_language is
3576    /// used to make it explicit (e.g. "ja" for large-to-small ordering and
3577    /// "ja-Latn" or "en" for small-to-large). This way, the most specific line of
3578    /// an address can be selected based on the language.
3579    ///
3580    /// The minimum permitted structural representation of an address consists
3581    /// of a region_code with all remaining information placed in the
3582    /// address_lines. It would be possible to format such an address very
3583    /// approximately without geocoding, but no semantic reasoning could be
3584    /// made about any of the address components until it was at least
3585    /// partially resolved.
3586    ///
3587    /// Creating an address only containing a region_code and address_lines, and
3588    /// then geocoding is the recommended way to handle completely unstructured
3589    /// addresses (as opposed to guessing which parts of the address should be
3590    /// localities or administrative areas).
3591    pub address_lines: std::vec::Vec<std::string::String>,
3592
3593    /// Optional. The recipient at the address.
3594    /// This field may, under certain circumstances, contain multiline information.
3595    /// For example, it might contain "care of" information.
3596    pub recipients: std::vec::Vec<std::string::String>,
3597
3598    /// Optional. The name of the organization at the address.
3599    pub organization: std::string::String,
3600
3601    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3602}
3603
3604impl PostalAddress {
3605    pub fn new() -> Self {
3606        std::default::Default::default()
3607    }
3608
3609    /// Sets the value of [revision][crate::model::PostalAddress::revision].
3610    pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3611        self.revision = v.into();
3612        self
3613    }
3614
3615    /// Sets the value of [region_code][crate::model::PostalAddress::region_code].
3616    pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3617        self.region_code = v.into();
3618        self
3619    }
3620
3621    /// Sets the value of [language_code][crate::model::PostalAddress::language_code].
3622    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3623        self.language_code = v.into();
3624        self
3625    }
3626
3627    /// Sets the value of [postal_code][crate::model::PostalAddress::postal_code].
3628    pub fn set_postal_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3629        self.postal_code = v.into();
3630        self
3631    }
3632
3633    /// Sets the value of [sorting_code][crate::model::PostalAddress::sorting_code].
3634    pub fn set_sorting_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3635        self.sorting_code = v.into();
3636        self
3637    }
3638
3639    /// Sets the value of [administrative_area][crate::model::PostalAddress::administrative_area].
3640    pub fn set_administrative_area<T: std::convert::Into<std::string::String>>(
3641        mut self,
3642        v: T,
3643    ) -> Self {
3644        self.administrative_area = v.into();
3645        self
3646    }
3647
3648    /// Sets the value of [locality][crate::model::PostalAddress::locality].
3649    pub fn set_locality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3650        self.locality = v.into();
3651        self
3652    }
3653
3654    /// Sets the value of [sublocality][crate::model::PostalAddress::sublocality].
3655    pub fn set_sublocality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3656        self.sublocality = v.into();
3657        self
3658    }
3659
3660    /// Sets the value of [address_lines][crate::model::PostalAddress::address_lines].
3661    pub fn set_address_lines<T, V>(mut self, v: T) -> Self
3662    where
3663        T: std::iter::IntoIterator<Item = V>,
3664        V: std::convert::Into<std::string::String>,
3665    {
3666        use std::iter::Iterator;
3667        self.address_lines = v.into_iter().map(|i| i.into()).collect();
3668        self
3669    }
3670
3671    /// Sets the value of [recipients][crate::model::PostalAddress::recipients].
3672    pub fn set_recipients<T, V>(mut self, v: T) -> Self
3673    where
3674        T: std::iter::IntoIterator<Item = V>,
3675        V: std::convert::Into<std::string::String>,
3676    {
3677        use std::iter::Iterator;
3678        self.recipients = v.into_iter().map(|i| i.into()).collect();
3679        self
3680    }
3681
3682    /// Sets the value of [organization][crate::model::PostalAddress::organization].
3683    pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3684        self.organization = v.into();
3685        self
3686    }
3687}
3688
3689impl wkt::message::Message for PostalAddress {
3690    fn typename() -> &'static str {
3691        "type.googleapis.com/google.type.PostalAddress"
3692    }
3693}
3694
3695#[doc(hidden)]
3696impl<'de> serde::de::Deserialize<'de> for PostalAddress {
3697    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3698    where
3699        D: serde::Deserializer<'de>,
3700    {
3701        #[allow(non_camel_case_types)]
3702        #[doc(hidden)]
3703        #[derive(PartialEq, Eq, Hash)]
3704        enum __FieldTag {
3705            __revision,
3706            __region_code,
3707            __language_code,
3708            __postal_code,
3709            __sorting_code,
3710            __administrative_area,
3711            __locality,
3712            __sublocality,
3713            __address_lines,
3714            __recipients,
3715            __organization,
3716            Unknown(std::string::String),
3717        }
3718        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3719            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3720            where
3721                D: serde::Deserializer<'de>,
3722            {
3723                struct Visitor;
3724                impl<'de> serde::de::Visitor<'de> for Visitor {
3725                    type Value = __FieldTag;
3726                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3727                        formatter.write_str("a field name for PostalAddress")
3728                    }
3729                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3730                    where
3731                        E: serde::de::Error,
3732                    {
3733                        use std::result::Result::Ok;
3734                        use std::string::ToString;
3735                        match value {
3736                            "revision" => Ok(__FieldTag::__revision),
3737                            "regionCode" => Ok(__FieldTag::__region_code),
3738                            "region_code" => Ok(__FieldTag::__region_code),
3739                            "languageCode" => Ok(__FieldTag::__language_code),
3740                            "language_code" => Ok(__FieldTag::__language_code),
3741                            "postalCode" => Ok(__FieldTag::__postal_code),
3742                            "postal_code" => Ok(__FieldTag::__postal_code),
3743                            "sortingCode" => Ok(__FieldTag::__sorting_code),
3744                            "sorting_code" => Ok(__FieldTag::__sorting_code),
3745                            "administrativeArea" => Ok(__FieldTag::__administrative_area),
3746                            "administrative_area" => Ok(__FieldTag::__administrative_area),
3747                            "locality" => Ok(__FieldTag::__locality),
3748                            "sublocality" => Ok(__FieldTag::__sublocality),
3749                            "addressLines" => Ok(__FieldTag::__address_lines),
3750                            "address_lines" => Ok(__FieldTag::__address_lines),
3751                            "recipients" => Ok(__FieldTag::__recipients),
3752                            "organization" => Ok(__FieldTag::__organization),
3753                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3754                        }
3755                    }
3756                }
3757                deserializer.deserialize_identifier(Visitor)
3758            }
3759        }
3760        struct Visitor;
3761        impl<'de> serde::de::Visitor<'de> for Visitor {
3762            type Value = PostalAddress;
3763            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3764                formatter.write_str("struct PostalAddress")
3765            }
3766            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3767            where
3768                A: serde::de::MapAccess<'de>,
3769            {
3770                #[allow(unused_imports)]
3771                use serde::de::Error;
3772                use std::option::Option::Some;
3773                let mut fields = std::collections::HashSet::new();
3774                let mut result = Self::Value::new();
3775                while let Some(tag) = map.next_key::<__FieldTag>()? {
3776                    #[allow(clippy::match_single_binding)]
3777                    match tag {
3778                        __FieldTag::__revision => {
3779                            if !fields.insert(__FieldTag::__revision) {
3780                                return std::result::Result::Err(A::Error::duplicate_field(
3781                                    "multiple values for revision",
3782                                ));
3783                            }
3784                            struct __With(std::option::Option<i32>);
3785                            impl<'de> serde::de::Deserialize<'de> for __With {
3786                                fn deserialize<D>(
3787                                    deserializer: D,
3788                                ) -> std::result::Result<Self, D::Error>
3789                                where
3790                                    D: serde::de::Deserializer<'de>,
3791                                {
3792                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3793                                }
3794                            }
3795                            result.revision = map.next_value::<__With>()?.0.unwrap_or_default();
3796                        }
3797                        __FieldTag::__region_code => {
3798                            if !fields.insert(__FieldTag::__region_code) {
3799                                return std::result::Result::Err(A::Error::duplicate_field(
3800                                    "multiple values for region_code",
3801                                ));
3802                            }
3803                            result.region_code = map
3804                                .next_value::<std::option::Option<std::string::String>>()?
3805                                .unwrap_or_default();
3806                        }
3807                        __FieldTag::__language_code => {
3808                            if !fields.insert(__FieldTag::__language_code) {
3809                                return std::result::Result::Err(A::Error::duplicate_field(
3810                                    "multiple values for language_code",
3811                                ));
3812                            }
3813                            result.language_code = map
3814                                .next_value::<std::option::Option<std::string::String>>()?
3815                                .unwrap_or_default();
3816                        }
3817                        __FieldTag::__postal_code => {
3818                            if !fields.insert(__FieldTag::__postal_code) {
3819                                return std::result::Result::Err(A::Error::duplicate_field(
3820                                    "multiple values for postal_code",
3821                                ));
3822                            }
3823                            result.postal_code = map
3824                                .next_value::<std::option::Option<std::string::String>>()?
3825                                .unwrap_or_default();
3826                        }
3827                        __FieldTag::__sorting_code => {
3828                            if !fields.insert(__FieldTag::__sorting_code) {
3829                                return std::result::Result::Err(A::Error::duplicate_field(
3830                                    "multiple values for sorting_code",
3831                                ));
3832                            }
3833                            result.sorting_code = map
3834                                .next_value::<std::option::Option<std::string::String>>()?
3835                                .unwrap_or_default();
3836                        }
3837                        __FieldTag::__administrative_area => {
3838                            if !fields.insert(__FieldTag::__administrative_area) {
3839                                return std::result::Result::Err(A::Error::duplicate_field(
3840                                    "multiple values for administrative_area",
3841                                ));
3842                            }
3843                            result.administrative_area = map
3844                                .next_value::<std::option::Option<std::string::String>>()?
3845                                .unwrap_or_default();
3846                        }
3847                        __FieldTag::__locality => {
3848                            if !fields.insert(__FieldTag::__locality) {
3849                                return std::result::Result::Err(A::Error::duplicate_field(
3850                                    "multiple values for locality",
3851                                ));
3852                            }
3853                            result.locality = map
3854                                .next_value::<std::option::Option<std::string::String>>()?
3855                                .unwrap_or_default();
3856                        }
3857                        __FieldTag::__sublocality => {
3858                            if !fields.insert(__FieldTag::__sublocality) {
3859                                return std::result::Result::Err(A::Error::duplicate_field(
3860                                    "multiple values for sublocality",
3861                                ));
3862                            }
3863                            result.sublocality = map
3864                                .next_value::<std::option::Option<std::string::String>>()?
3865                                .unwrap_or_default();
3866                        }
3867                        __FieldTag::__address_lines => {
3868                            if !fields.insert(__FieldTag::__address_lines) {
3869                                return std::result::Result::Err(A::Error::duplicate_field(
3870                                    "multiple values for address_lines",
3871                                ));
3872                            }
3873                            result.address_lines = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3874                        }
3875                        __FieldTag::__recipients => {
3876                            if !fields.insert(__FieldTag::__recipients) {
3877                                return std::result::Result::Err(A::Error::duplicate_field(
3878                                    "multiple values for recipients",
3879                                ));
3880                            }
3881                            result.recipients = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3882                        }
3883                        __FieldTag::__organization => {
3884                            if !fields.insert(__FieldTag::__organization) {
3885                                return std::result::Result::Err(A::Error::duplicate_field(
3886                                    "multiple values for organization",
3887                                ));
3888                            }
3889                            result.organization = map
3890                                .next_value::<std::option::Option<std::string::String>>()?
3891                                .unwrap_or_default();
3892                        }
3893                        __FieldTag::Unknown(key) => {
3894                            let value = map.next_value::<serde_json::Value>()?;
3895                            result._unknown_fields.insert(key, value);
3896                        }
3897                    }
3898                }
3899                std::result::Result::Ok(result)
3900            }
3901        }
3902        deserializer.deserialize_any(Visitor)
3903    }
3904}
3905
3906#[doc(hidden)]
3907impl serde::ser::Serialize for PostalAddress {
3908    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3909    where
3910        S: serde::ser::Serializer,
3911    {
3912        use serde::ser::SerializeMap;
3913        #[allow(unused_imports)]
3914        use std::option::Option::Some;
3915        let mut state = serializer.serialize_map(std::option::Option::None)?;
3916        if !wkt::internal::is_default(&self.revision) {
3917            struct __With<'a>(&'a i32);
3918            impl<'a> serde::ser::Serialize for __With<'a> {
3919                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3920                where
3921                    S: serde::ser::Serializer,
3922                {
3923                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3924                }
3925            }
3926            state.serialize_entry("revision", &__With(&self.revision))?;
3927        }
3928        if !self.region_code.is_empty() {
3929            state.serialize_entry("regionCode", &self.region_code)?;
3930        }
3931        if !self.language_code.is_empty() {
3932            state.serialize_entry("languageCode", &self.language_code)?;
3933        }
3934        if !self.postal_code.is_empty() {
3935            state.serialize_entry("postalCode", &self.postal_code)?;
3936        }
3937        if !self.sorting_code.is_empty() {
3938            state.serialize_entry("sortingCode", &self.sorting_code)?;
3939        }
3940        if !self.administrative_area.is_empty() {
3941            state.serialize_entry("administrativeArea", &self.administrative_area)?;
3942        }
3943        if !self.locality.is_empty() {
3944            state.serialize_entry("locality", &self.locality)?;
3945        }
3946        if !self.sublocality.is_empty() {
3947            state.serialize_entry("sublocality", &self.sublocality)?;
3948        }
3949        if !self.address_lines.is_empty() {
3950            state.serialize_entry("addressLines", &self.address_lines)?;
3951        }
3952        if !self.recipients.is_empty() {
3953            state.serialize_entry("recipients", &self.recipients)?;
3954        }
3955        if !self.organization.is_empty() {
3956            state.serialize_entry("organization", &self.organization)?;
3957        }
3958        if !self._unknown_fields.is_empty() {
3959            for (key, value) in self._unknown_fields.iter() {
3960                state.serialize_entry(key, &value)?;
3961            }
3962        }
3963        state.end()
3964    }
3965}
3966
3967impl std::fmt::Debug for PostalAddress {
3968    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3969        let mut debug_struct = f.debug_struct("PostalAddress");
3970        debug_struct.field("revision", &self.revision);
3971        debug_struct.field("region_code", &self.region_code);
3972        debug_struct.field("language_code", &self.language_code);
3973        debug_struct.field("postal_code", &self.postal_code);
3974        debug_struct.field("sorting_code", &self.sorting_code);
3975        debug_struct.field("administrative_area", &self.administrative_area);
3976        debug_struct.field("locality", &self.locality);
3977        debug_struct.field("sublocality", &self.sublocality);
3978        debug_struct.field("address_lines", &self.address_lines);
3979        debug_struct.field("recipients", &self.recipients);
3980        debug_struct.field("organization", &self.organization);
3981        if !self._unknown_fields.is_empty() {
3982            debug_struct.field("_unknown_fields", &self._unknown_fields);
3983        }
3984        debug_struct.finish()
3985    }
3986}
3987
3988/// A quaternion is defined as the quotient of two directed lines in a
3989/// three-dimensional space or equivalently as the quotient of two Euclidean
3990/// vectors (<https://en.wikipedia.org/wiki/Quaternion>).
3991///
3992/// Quaternions are often used in calculations involving three-dimensional
3993/// rotations (<https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>),
3994/// as they provide greater mathematical robustness by avoiding the gimbal lock
3995/// problems that can be encountered when using Euler angles
3996/// (<https://en.wikipedia.org/wiki/Gimbal_lock>).
3997///
3998/// Quaternions are generally represented in this form:
3999///
4000/// ```norust
4001/// w + xi + yj + zk
4002/// ```
4003///
4004/// where x, y, z, and w are real numbers, and i, j, and k are three imaginary
4005/// numbers.
4006///
4007/// Our naming choice `(x, y, z, w)` comes from the desire to avoid confusion for
4008/// those interested in the geometric properties of the quaternion in the 3D
4009/// Cartesian space. Other texts often use alternative names or subscripts, such
4010/// as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps
4011/// better suited for mathematical interpretations.
4012///
4013/// To avoid any confusion, as well as to maintain compatibility with a large
4014/// number of software libraries, the quaternions represented using the protocol
4015/// buffer below *must* follow the Hamilton convention, which defines `ij = k`
4016/// (i.e. a right-handed algebra), and therefore:
4017///
4018/// ```norust
4019/// i^2 = j^2 = k^2 = ijk = −1
4020/// ij = −ji = k
4021/// jk = −kj = i
4022/// ki = −ik = j
4023/// ```
4024///
4025/// Please DO NOT use this to represent quaternions that follow the JPL
4026/// convention, or any of the other quaternion flavors out there.
4027///
4028/// Definitions:
4029///
4030/// - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`.
4031/// - Unit (or normalized) quaternion: a quaternion whose norm is 1.
4032/// - Pure quaternion: a quaternion whose scalar component (`w`) is 0.
4033/// - Rotation quaternion: a unit quaternion used to represent rotation.
4034/// - Orientation quaternion: a unit quaternion used to represent orientation.
4035///
4036/// A quaternion can be normalized by dividing it by its norm. The resulting
4037/// quaternion maintains the same direction, but has a norm of 1, i.e. it moves
4038/// on the unit sphere. This is generally necessary for rotation and orientation
4039/// quaternions, to avoid rounding errors:
4040/// <https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions>
4041///
4042/// Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation,
4043/// but normalization would be even more useful, e.g. for comparison purposes, if
4044/// it would produce a unique representation. It is thus recommended that `w` be
4045/// kept positive, which can be achieved by changing all the signs when `w` is
4046/// negative.
4047#[derive(Clone, Default, PartialEq)]
4048#[non_exhaustive]
4049pub struct Quaternion {
4050    /// The x component.
4051    pub x: f64,
4052
4053    /// The y component.
4054    pub y: f64,
4055
4056    /// The z component.
4057    pub z: f64,
4058
4059    /// The scalar component.
4060    pub w: f64,
4061
4062    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4063}
4064
4065impl Quaternion {
4066    pub fn new() -> Self {
4067        std::default::Default::default()
4068    }
4069
4070    /// Sets the value of [x][crate::model::Quaternion::x].
4071    pub fn set_x<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4072        self.x = v.into();
4073        self
4074    }
4075
4076    /// Sets the value of [y][crate::model::Quaternion::y].
4077    pub fn set_y<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4078        self.y = v.into();
4079        self
4080    }
4081
4082    /// Sets the value of [z][crate::model::Quaternion::z].
4083    pub fn set_z<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4084        self.z = v.into();
4085        self
4086    }
4087
4088    /// Sets the value of [w][crate::model::Quaternion::w].
4089    pub fn set_w<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4090        self.w = v.into();
4091        self
4092    }
4093}
4094
4095impl wkt::message::Message for Quaternion {
4096    fn typename() -> &'static str {
4097        "type.googleapis.com/google.type.Quaternion"
4098    }
4099}
4100
4101#[doc(hidden)]
4102impl<'de> serde::de::Deserialize<'de> for Quaternion {
4103    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4104    where
4105        D: serde::Deserializer<'de>,
4106    {
4107        #[allow(non_camel_case_types)]
4108        #[doc(hidden)]
4109        #[derive(PartialEq, Eq, Hash)]
4110        enum __FieldTag {
4111            __x,
4112            __y,
4113            __z,
4114            __w,
4115            Unknown(std::string::String),
4116        }
4117        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4118            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4119            where
4120                D: serde::Deserializer<'de>,
4121            {
4122                struct Visitor;
4123                impl<'de> serde::de::Visitor<'de> for Visitor {
4124                    type Value = __FieldTag;
4125                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4126                        formatter.write_str("a field name for Quaternion")
4127                    }
4128                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4129                    where
4130                        E: serde::de::Error,
4131                    {
4132                        use std::result::Result::Ok;
4133                        use std::string::ToString;
4134                        match value {
4135                            "x" => Ok(__FieldTag::__x),
4136                            "y" => Ok(__FieldTag::__y),
4137                            "z" => Ok(__FieldTag::__z),
4138                            "w" => Ok(__FieldTag::__w),
4139                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4140                        }
4141                    }
4142                }
4143                deserializer.deserialize_identifier(Visitor)
4144            }
4145        }
4146        struct Visitor;
4147        impl<'de> serde::de::Visitor<'de> for Visitor {
4148            type Value = Quaternion;
4149            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4150                formatter.write_str("struct Quaternion")
4151            }
4152            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4153            where
4154                A: serde::de::MapAccess<'de>,
4155            {
4156                #[allow(unused_imports)]
4157                use serde::de::Error;
4158                use std::option::Option::Some;
4159                let mut fields = std::collections::HashSet::new();
4160                let mut result = Self::Value::new();
4161                while let Some(tag) = map.next_key::<__FieldTag>()? {
4162                    #[allow(clippy::match_single_binding)]
4163                    match tag {
4164                        __FieldTag::__x => {
4165                            if !fields.insert(__FieldTag::__x) {
4166                                return std::result::Result::Err(A::Error::duplicate_field(
4167                                    "multiple values for x",
4168                                ));
4169                            }
4170                            struct __With(std::option::Option<f64>);
4171                            impl<'de> serde::de::Deserialize<'de> for __With {
4172                                fn deserialize<D>(
4173                                    deserializer: D,
4174                                ) -> std::result::Result<Self, D::Error>
4175                                where
4176                                    D: serde::de::Deserializer<'de>,
4177                                {
4178                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
4179                                }
4180                            }
4181                            result.x = map.next_value::<__With>()?.0.unwrap_or_default();
4182                        }
4183                        __FieldTag::__y => {
4184                            if !fields.insert(__FieldTag::__y) {
4185                                return std::result::Result::Err(A::Error::duplicate_field(
4186                                    "multiple values for y",
4187                                ));
4188                            }
4189                            struct __With(std::option::Option<f64>);
4190                            impl<'de> serde::de::Deserialize<'de> for __With {
4191                                fn deserialize<D>(
4192                                    deserializer: D,
4193                                ) -> std::result::Result<Self, D::Error>
4194                                where
4195                                    D: serde::de::Deserializer<'de>,
4196                                {
4197                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
4198                                }
4199                            }
4200                            result.y = map.next_value::<__With>()?.0.unwrap_or_default();
4201                        }
4202                        __FieldTag::__z => {
4203                            if !fields.insert(__FieldTag::__z) {
4204                                return std::result::Result::Err(A::Error::duplicate_field(
4205                                    "multiple values for z",
4206                                ));
4207                            }
4208                            struct __With(std::option::Option<f64>);
4209                            impl<'de> serde::de::Deserialize<'de> for __With {
4210                                fn deserialize<D>(
4211                                    deserializer: D,
4212                                ) -> std::result::Result<Self, D::Error>
4213                                where
4214                                    D: serde::de::Deserializer<'de>,
4215                                {
4216                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
4217                                }
4218                            }
4219                            result.z = map.next_value::<__With>()?.0.unwrap_or_default();
4220                        }
4221                        __FieldTag::__w => {
4222                            if !fields.insert(__FieldTag::__w) {
4223                                return std::result::Result::Err(A::Error::duplicate_field(
4224                                    "multiple values for w",
4225                                ));
4226                            }
4227                            struct __With(std::option::Option<f64>);
4228                            impl<'de> serde::de::Deserialize<'de> for __With {
4229                                fn deserialize<D>(
4230                                    deserializer: D,
4231                                ) -> std::result::Result<Self, D::Error>
4232                                where
4233                                    D: serde::de::Deserializer<'de>,
4234                                {
4235                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
4236                                }
4237                            }
4238                            result.w = map.next_value::<__With>()?.0.unwrap_or_default();
4239                        }
4240                        __FieldTag::Unknown(key) => {
4241                            let value = map.next_value::<serde_json::Value>()?;
4242                            result._unknown_fields.insert(key, value);
4243                        }
4244                    }
4245                }
4246                std::result::Result::Ok(result)
4247            }
4248        }
4249        deserializer.deserialize_any(Visitor)
4250    }
4251}
4252
4253#[doc(hidden)]
4254impl serde::ser::Serialize for Quaternion {
4255    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4256    where
4257        S: serde::ser::Serializer,
4258    {
4259        use serde::ser::SerializeMap;
4260        #[allow(unused_imports)]
4261        use std::option::Option::Some;
4262        let mut state = serializer.serialize_map(std::option::Option::None)?;
4263        if !wkt::internal::is_default(&self.x) {
4264            struct __With<'a>(&'a f64);
4265            impl<'a> serde::ser::Serialize for __With<'a> {
4266                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4267                where
4268                    S: serde::ser::Serializer,
4269                {
4270                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
4271                }
4272            }
4273            state.serialize_entry("x", &__With(&self.x))?;
4274        }
4275        if !wkt::internal::is_default(&self.y) {
4276            struct __With<'a>(&'a f64);
4277            impl<'a> serde::ser::Serialize for __With<'a> {
4278                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4279                where
4280                    S: serde::ser::Serializer,
4281                {
4282                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
4283                }
4284            }
4285            state.serialize_entry("y", &__With(&self.y))?;
4286        }
4287        if !wkt::internal::is_default(&self.z) {
4288            struct __With<'a>(&'a f64);
4289            impl<'a> serde::ser::Serialize for __With<'a> {
4290                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4291                where
4292                    S: serde::ser::Serializer,
4293                {
4294                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
4295                }
4296            }
4297            state.serialize_entry("z", &__With(&self.z))?;
4298        }
4299        if !wkt::internal::is_default(&self.w) {
4300            struct __With<'a>(&'a f64);
4301            impl<'a> serde::ser::Serialize for __With<'a> {
4302                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4303                where
4304                    S: serde::ser::Serializer,
4305                {
4306                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
4307                }
4308            }
4309            state.serialize_entry("w", &__With(&self.w))?;
4310        }
4311        if !self._unknown_fields.is_empty() {
4312            for (key, value) in self._unknown_fields.iter() {
4313                state.serialize_entry(key, &value)?;
4314            }
4315        }
4316        state.end()
4317    }
4318}
4319
4320impl std::fmt::Debug for Quaternion {
4321    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4322        let mut debug_struct = f.debug_struct("Quaternion");
4323        debug_struct.field("x", &self.x);
4324        debug_struct.field("y", &self.y);
4325        debug_struct.field("z", &self.z);
4326        debug_struct.field("w", &self.w);
4327        if !self._unknown_fields.is_empty() {
4328            debug_struct.field("_unknown_fields", &self._unknown_fields);
4329        }
4330        debug_struct.finish()
4331    }
4332}
4333
4334/// Represents a time of day. The date and time zone are either not significant
4335/// or are specified elsewhere. An API may choose to allow leap seconds. Related
4336/// types are [google.type.Date][google.type.Date] and
4337/// `google.protobuf.Timestamp`.
4338///
4339/// [google.type.Date]: crate::model::Date
4340#[derive(Clone, Default, PartialEq)]
4341#[non_exhaustive]
4342pub struct TimeOfDay {
4343    /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
4344    /// to allow the value "24:00:00" for scenarios like business closing time.
4345    pub hours: i32,
4346
4347    /// Minutes of hour of day. Must be from 0 to 59.
4348    pub minutes: i32,
4349
4350    /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may
4351    /// allow the value 60 if it allows leap-seconds.
4352    pub seconds: i32,
4353
4354    /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
4355    pub nanos: i32,
4356
4357    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4358}
4359
4360impl TimeOfDay {
4361    pub fn new() -> Self {
4362        std::default::Default::default()
4363    }
4364
4365    /// Sets the value of [hours][crate::model::TimeOfDay::hours].
4366    pub fn set_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4367        self.hours = v.into();
4368        self
4369    }
4370
4371    /// Sets the value of [minutes][crate::model::TimeOfDay::minutes].
4372    pub fn set_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4373        self.minutes = v.into();
4374        self
4375    }
4376
4377    /// Sets the value of [seconds][crate::model::TimeOfDay::seconds].
4378    pub fn set_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4379        self.seconds = v.into();
4380        self
4381    }
4382
4383    /// Sets the value of [nanos][crate::model::TimeOfDay::nanos].
4384    pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4385        self.nanos = v.into();
4386        self
4387    }
4388}
4389
4390impl wkt::message::Message for TimeOfDay {
4391    fn typename() -> &'static str {
4392        "type.googleapis.com/google.type.TimeOfDay"
4393    }
4394}
4395
4396#[doc(hidden)]
4397impl<'de> serde::de::Deserialize<'de> for TimeOfDay {
4398    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4399    where
4400        D: serde::Deserializer<'de>,
4401    {
4402        #[allow(non_camel_case_types)]
4403        #[doc(hidden)]
4404        #[derive(PartialEq, Eq, Hash)]
4405        enum __FieldTag {
4406            __hours,
4407            __minutes,
4408            __seconds,
4409            __nanos,
4410            Unknown(std::string::String),
4411        }
4412        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4413            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4414            where
4415                D: serde::Deserializer<'de>,
4416            {
4417                struct Visitor;
4418                impl<'de> serde::de::Visitor<'de> for Visitor {
4419                    type Value = __FieldTag;
4420                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4421                        formatter.write_str("a field name for TimeOfDay")
4422                    }
4423                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4424                    where
4425                        E: serde::de::Error,
4426                    {
4427                        use std::result::Result::Ok;
4428                        use std::string::ToString;
4429                        match value {
4430                            "hours" => Ok(__FieldTag::__hours),
4431                            "minutes" => Ok(__FieldTag::__minutes),
4432                            "seconds" => Ok(__FieldTag::__seconds),
4433                            "nanos" => Ok(__FieldTag::__nanos),
4434                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4435                        }
4436                    }
4437                }
4438                deserializer.deserialize_identifier(Visitor)
4439            }
4440        }
4441        struct Visitor;
4442        impl<'de> serde::de::Visitor<'de> for Visitor {
4443            type Value = TimeOfDay;
4444            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4445                formatter.write_str("struct TimeOfDay")
4446            }
4447            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4448            where
4449                A: serde::de::MapAccess<'de>,
4450            {
4451                #[allow(unused_imports)]
4452                use serde::de::Error;
4453                use std::option::Option::Some;
4454                let mut fields = std::collections::HashSet::new();
4455                let mut result = Self::Value::new();
4456                while let Some(tag) = map.next_key::<__FieldTag>()? {
4457                    #[allow(clippy::match_single_binding)]
4458                    match tag {
4459                        __FieldTag::__hours => {
4460                            if !fields.insert(__FieldTag::__hours) {
4461                                return std::result::Result::Err(A::Error::duplicate_field(
4462                                    "multiple values for hours",
4463                                ));
4464                            }
4465                            struct __With(std::option::Option<i32>);
4466                            impl<'de> serde::de::Deserialize<'de> for __With {
4467                                fn deserialize<D>(
4468                                    deserializer: D,
4469                                ) -> std::result::Result<Self, D::Error>
4470                                where
4471                                    D: serde::de::Deserializer<'de>,
4472                                {
4473                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4474                                }
4475                            }
4476                            result.hours = map.next_value::<__With>()?.0.unwrap_or_default();
4477                        }
4478                        __FieldTag::__minutes => {
4479                            if !fields.insert(__FieldTag::__minutes) {
4480                                return std::result::Result::Err(A::Error::duplicate_field(
4481                                    "multiple values for minutes",
4482                                ));
4483                            }
4484                            struct __With(std::option::Option<i32>);
4485                            impl<'de> serde::de::Deserialize<'de> for __With {
4486                                fn deserialize<D>(
4487                                    deserializer: D,
4488                                ) -> std::result::Result<Self, D::Error>
4489                                where
4490                                    D: serde::de::Deserializer<'de>,
4491                                {
4492                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4493                                }
4494                            }
4495                            result.minutes = map.next_value::<__With>()?.0.unwrap_or_default();
4496                        }
4497                        __FieldTag::__seconds => {
4498                            if !fields.insert(__FieldTag::__seconds) {
4499                                return std::result::Result::Err(A::Error::duplicate_field(
4500                                    "multiple values for seconds",
4501                                ));
4502                            }
4503                            struct __With(std::option::Option<i32>);
4504                            impl<'de> serde::de::Deserialize<'de> for __With {
4505                                fn deserialize<D>(
4506                                    deserializer: D,
4507                                ) -> std::result::Result<Self, D::Error>
4508                                where
4509                                    D: serde::de::Deserializer<'de>,
4510                                {
4511                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4512                                }
4513                            }
4514                            result.seconds = map.next_value::<__With>()?.0.unwrap_or_default();
4515                        }
4516                        __FieldTag::__nanos => {
4517                            if !fields.insert(__FieldTag::__nanos) {
4518                                return std::result::Result::Err(A::Error::duplicate_field(
4519                                    "multiple values for nanos",
4520                                ));
4521                            }
4522                            struct __With(std::option::Option<i32>);
4523                            impl<'de> serde::de::Deserialize<'de> for __With {
4524                                fn deserialize<D>(
4525                                    deserializer: D,
4526                                ) -> std::result::Result<Self, D::Error>
4527                                where
4528                                    D: serde::de::Deserializer<'de>,
4529                                {
4530                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4531                                }
4532                            }
4533                            result.nanos = map.next_value::<__With>()?.0.unwrap_or_default();
4534                        }
4535                        __FieldTag::Unknown(key) => {
4536                            let value = map.next_value::<serde_json::Value>()?;
4537                            result._unknown_fields.insert(key, value);
4538                        }
4539                    }
4540                }
4541                std::result::Result::Ok(result)
4542            }
4543        }
4544        deserializer.deserialize_any(Visitor)
4545    }
4546}
4547
4548#[doc(hidden)]
4549impl serde::ser::Serialize for TimeOfDay {
4550    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4551    where
4552        S: serde::ser::Serializer,
4553    {
4554        use serde::ser::SerializeMap;
4555        #[allow(unused_imports)]
4556        use std::option::Option::Some;
4557        let mut state = serializer.serialize_map(std::option::Option::None)?;
4558        if !wkt::internal::is_default(&self.hours) {
4559            struct __With<'a>(&'a i32);
4560            impl<'a> serde::ser::Serialize for __With<'a> {
4561                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4562                where
4563                    S: serde::ser::Serializer,
4564                {
4565                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4566                }
4567            }
4568            state.serialize_entry("hours", &__With(&self.hours))?;
4569        }
4570        if !wkt::internal::is_default(&self.minutes) {
4571            struct __With<'a>(&'a i32);
4572            impl<'a> serde::ser::Serialize for __With<'a> {
4573                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4574                where
4575                    S: serde::ser::Serializer,
4576                {
4577                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4578                }
4579            }
4580            state.serialize_entry("minutes", &__With(&self.minutes))?;
4581        }
4582        if !wkt::internal::is_default(&self.seconds) {
4583            struct __With<'a>(&'a i32);
4584            impl<'a> serde::ser::Serialize for __With<'a> {
4585                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4586                where
4587                    S: serde::ser::Serializer,
4588                {
4589                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4590                }
4591            }
4592            state.serialize_entry("seconds", &__With(&self.seconds))?;
4593        }
4594        if !wkt::internal::is_default(&self.nanos) {
4595            struct __With<'a>(&'a i32);
4596            impl<'a> serde::ser::Serialize for __With<'a> {
4597                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4598                where
4599                    S: serde::ser::Serializer,
4600                {
4601                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4602                }
4603            }
4604            state.serialize_entry("nanos", &__With(&self.nanos))?;
4605        }
4606        if !self._unknown_fields.is_empty() {
4607            for (key, value) in self._unknown_fields.iter() {
4608                state.serialize_entry(key, &value)?;
4609            }
4610        }
4611        state.end()
4612    }
4613}
4614
4615impl std::fmt::Debug for TimeOfDay {
4616    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4617        let mut debug_struct = f.debug_struct("TimeOfDay");
4618        debug_struct.field("hours", &self.hours);
4619        debug_struct.field("minutes", &self.minutes);
4620        debug_struct.field("seconds", &self.seconds);
4621        debug_struct.field("nanos", &self.nanos);
4622        if !self._unknown_fields.is_empty() {
4623            debug_struct.field("_unknown_fields", &self._unknown_fields);
4624        }
4625        debug_struct.finish()
4626    }
4627}
4628
4629/// A `CalendarPeriod` represents the abstract concept of a time period that has
4630/// a canonical start. Grammatically, "the start of the current
4631/// `CalendarPeriod`." All calendar times begin at midnight UTC.
4632///
4633/// # Working with unknown values
4634///
4635/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4636/// additional enum variants at any time. Adding new variants is not considered
4637/// a breaking change. Applications should write their code in anticipation of:
4638///
4639/// - New values appearing in future releases of the client library, **and**
4640/// - New values received dynamically, without application changes.
4641///
4642/// Please consult the [Working with enums] section in the user guide for some
4643/// guidelines.
4644///
4645/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4646#[derive(Clone, Debug, PartialEq)]
4647#[non_exhaustive]
4648pub enum CalendarPeriod {
4649    /// Undefined period, raises an error.
4650    Unspecified,
4651    /// A day.
4652    Day,
4653    /// A week. Weeks begin on Monday, following
4654    /// [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date).
4655    Week,
4656    /// A fortnight. The first calendar fortnight of the year begins at the start
4657    /// of week 1 according to
4658    /// [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date).
4659    Fortnight,
4660    /// A month.
4661    Month,
4662    /// A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each
4663    /// year.
4664    Quarter,
4665    /// A half-year. Half-years start on dates 1-Jan and 1-Jul.
4666    Half,
4667    /// A year.
4668    Year,
4669    /// If set, the enum was initialized with an unknown value.
4670    ///
4671    /// Applications can examine the value using [CalendarPeriod::value] or
4672    /// [CalendarPeriod::name].
4673    UnknownValue(calendar_period::UnknownValue),
4674}
4675
4676#[doc(hidden)]
4677pub mod calendar_period {
4678    #[allow(unused_imports)]
4679    use super::*;
4680    #[derive(Clone, Debug, PartialEq)]
4681    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4682}
4683
4684impl CalendarPeriod {
4685    /// Gets the enum value.
4686    ///
4687    /// Returns `None` if the enum contains an unknown value deserialized from
4688    /// the string representation of enums.
4689    pub fn value(&self) -> std::option::Option<i32> {
4690        match self {
4691            Self::Unspecified => std::option::Option::Some(0),
4692            Self::Day => std::option::Option::Some(1),
4693            Self::Week => std::option::Option::Some(2),
4694            Self::Fortnight => std::option::Option::Some(3),
4695            Self::Month => std::option::Option::Some(4),
4696            Self::Quarter => std::option::Option::Some(5),
4697            Self::Half => std::option::Option::Some(6),
4698            Self::Year => std::option::Option::Some(7),
4699            Self::UnknownValue(u) => u.0.value(),
4700        }
4701    }
4702
4703    /// Gets the enum value as a string.
4704    ///
4705    /// Returns `None` if the enum contains an unknown value deserialized from
4706    /// the integer representation of enums.
4707    pub fn name(&self) -> std::option::Option<&str> {
4708        match self {
4709            Self::Unspecified => std::option::Option::Some("CALENDAR_PERIOD_UNSPECIFIED"),
4710            Self::Day => std::option::Option::Some("DAY"),
4711            Self::Week => std::option::Option::Some("WEEK"),
4712            Self::Fortnight => std::option::Option::Some("FORTNIGHT"),
4713            Self::Month => std::option::Option::Some("MONTH"),
4714            Self::Quarter => std::option::Option::Some("QUARTER"),
4715            Self::Half => std::option::Option::Some("HALF"),
4716            Self::Year => std::option::Option::Some("YEAR"),
4717            Self::UnknownValue(u) => u.0.name(),
4718        }
4719    }
4720}
4721
4722impl std::default::Default for CalendarPeriod {
4723    fn default() -> Self {
4724        use std::convert::From;
4725        Self::from(0)
4726    }
4727}
4728
4729impl std::fmt::Display for CalendarPeriod {
4730    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4731        wkt::internal::display_enum(f, self.name(), self.value())
4732    }
4733}
4734
4735impl std::convert::From<i32> for CalendarPeriod {
4736    fn from(value: i32) -> Self {
4737        match value {
4738            0 => Self::Unspecified,
4739            1 => Self::Day,
4740            2 => Self::Week,
4741            3 => Self::Fortnight,
4742            4 => Self::Month,
4743            5 => Self::Quarter,
4744            6 => Self::Half,
4745            7 => Self::Year,
4746            _ => Self::UnknownValue(calendar_period::UnknownValue(
4747                wkt::internal::UnknownEnumValue::Integer(value),
4748            )),
4749        }
4750    }
4751}
4752
4753impl std::convert::From<&str> for CalendarPeriod {
4754    fn from(value: &str) -> Self {
4755        use std::string::ToString;
4756        match value {
4757            "CALENDAR_PERIOD_UNSPECIFIED" => Self::Unspecified,
4758            "DAY" => Self::Day,
4759            "WEEK" => Self::Week,
4760            "FORTNIGHT" => Self::Fortnight,
4761            "MONTH" => Self::Month,
4762            "QUARTER" => Self::Quarter,
4763            "HALF" => Self::Half,
4764            "YEAR" => Self::Year,
4765            _ => Self::UnknownValue(calendar_period::UnknownValue(
4766                wkt::internal::UnknownEnumValue::String(value.to_string()),
4767            )),
4768        }
4769    }
4770}
4771
4772impl serde::ser::Serialize for CalendarPeriod {
4773    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4774    where
4775        S: serde::Serializer,
4776    {
4777        match self {
4778            Self::Unspecified => serializer.serialize_i32(0),
4779            Self::Day => serializer.serialize_i32(1),
4780            Self::Week => serializer.serialize_i32(2),
4781            Self::Fortnight => serializer.serialize_i32(3),
4782            Self::Month => serializer.serialize_i32(4),
4783            Self::Quarter => serializer.serialize_i32(5),
4784            Self::Half => serializer.serialize_i32(6),
4785            Self::Year => serializer.serialize_i32(7),
4786            Self::UnknownValue(u) => u.0.serialize(serializer),
4787        }
4788    }
4789}
4790
4791impl<'de> serde::de::Deserialize<'de> for CalendarPeriod {
4792    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4793    where
4794        D: serde::Deserializer<'de>,
4795    {
4796        deserializer.deserialize_any(wkt::internal::EnumVisitor::<CalendarPeriod>::new(
4797            ".google.type.CalendarPeriod",
4798        ))
4799    }
4800}
4801
4802/// Represents a day of the week.
4803///
4804/// # Working with unknown values
4805///
4806/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4807/// additional enum variants at any time. Adding new variants is not considered
4808/// a breaking change. Applications should write their code in anticipation of:
4809///
4810/// - New values appearing in future releases of the client library, **and**
4811/// - New values received dynamically, without application changes.
4812///
4813/// Please consult the [Working with enums] section in the user guide for some
4814/// guidelines.
4815///
4816/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4817#[derive(Clone, Debug, PartialEq)]
4818#[non_exhaustive]
4819pub enum DayOfWeek {
4820    /// The day of the week is unspecified.
4821    Unspecified,
4822    /// Monday
4823    Monday,
4824    /// Tuesday
4825    Tuesday,
4826    /// Wednesday
4827    Wednesday,
4828    /// Thursday
4829    Thursday,
4830    /// Friday
4831    Friday,
4832    /// Saturday
4833    Saturday,
4834    /// Sunday
4835    Sunday,
4836    /// If set, the enum was initialized with an unknown value.
4837    ///
4838    /// Applications can examine the value using [DayOfWeek::value] or
4839    /// [DayOfWeek::name].
4840    UnknownValue(day_of_week::UnknownValue),
4841}
4842
4843#[doc(hidden)]
4844pub mod day_of_week {
4845    #[allow(unused_imports)]
4846    use super::*;
4847    #[derive(Clone, Debug, PartialEq)]
4848    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4849}
4850
4851impl DayOfWeek {
4852    /// Gets the enum value.
4853    ///
4854    /// Returns `None` if the enum contains an unknown value deserialized from
4855    /// the string representation of enums.
4856    pub fn value(&self) -> std::option::Option<i32> {
4857        match self {
4858            Self::Unspecified => std::option::Option::Some(0),
4859            Self::Monday => std::option::Option::Some(1),
4860            Self::Tuesday => std::option::Option::Some(2),
4861            Self::Wednesday => std::option::Option::Some(3),
4862            Self::Thursday => std::option::Option::Some(4),
4863            Self::Friday => std::option::Option::Some(5),
4864            Self::Saturday => std::option::Option::Some(6),
4865            Self::Sunday => std::option::Option::Some(7),
4866            Self::UnknownValue(u) => u.0.value(),
4867        }
4868    }
4869
4870    /// Gets the enum value as a string.
4871    ///
4872    /// Returns `None` if the enum contains an unknown value deserialized from
4873    /// the integer representation of enums.
4874    pub fn name(&self) -> std::option::Option<&str> {
4875        match self {
4876            Self::Unspecified => std::option::Option::Some("DAY_OF_WEEK_UNSPECIFIED"),
4877            Self::Monday => std::option::Option::Some("MONDAY"),
4878            Self::Tuesday => std::option::Option::Some("TUESDAY"),
4879            Self::Wednesday => std::option::Option::Some("WEDNESDAY"),
4880            Self::Thursday => std::option::Option::Some("THURSDAY"),
4881            Self::Friday => std::option::Option::Some("FRIDAY"),
4882            Self::Saturday => std::option::Option::Some("SATURDAY"),
4883            Self::Sunday => std::option::Option::Some("SUNDAY"),
4884            Self::UnknownValue(u) => u.0.name(),
4885        }
4886    }
4887}
4888
4889impl std::default::Default for DayOfWeek {
4890    fn default() -> Self {
4891        use std::convert::From;
4892        Self::from(0)
4893    }
4894}
4895
4896impl std::fmt::Display for DayOfWeek {
4897    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4898        wkt::internal::display_enum(f, self.name(), self.value())
4899    }
4900}
4901
4902impl std::convert::From<i32> for DayOfWeek {
4903    fn from(value: i32) -> Self {
4904        match value {
4905            0 => Self::Unspecified,
4906            1 => Self::Monday,
4907            2 => Self::Tuesday,
4908            3 => Self::Wednesday,
4909            4 => Self::Thursday,
4910            5 => Self::Friday,
4911            6 => Self::Saturday,
4912            7 => Self::Sunday,
4913            _ => Self::UnknownValue(day_of_week::UnknownValue(
4914                wkt::internal::UnknownEnumValue::Integer(value),
4915            )),
4916        }
4917    }
4918}
4919
4920impl std::convert::From<&str> for DayOfWeek {
4921    fn from(value: &str) -> Self {
4922        use std::string::ToString;
4923        match value {
4924            "DAY_OF_WEEK_UNSPECIFIED" => Self::Unspecified,
4925            "MONDAY" => Self::Monday,
4926            "TUESDAY" => Self::Tuesday,
4927            "WEDNESDAY" => Self::Wednesday,
4928            "THURSDAY" => Self::Thursday,
4929            "FRIDAY" => Self::Friday,
4930            "SATURDAY" => Self::Saturday,
4931            "SUNDAY" => Self::Sunday,
4932            _ => Self::UnknownValue(day_of_week::UnknownValue(
4933                wkt::internal::UnknownEnumValue::String(value.to_string()),
4934            )),
4935        }
4936    }
4937}
4938
4939impl serde::ser::Serialize for DayOfWeek {
4940    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4941    where
4942        S: serde::Serializer,
4943    {
4944        match self {
4945            Self::Unspecified => serializer.serialize_i32(0),
4946            Self::Monday => serializer.serialize_i32(1),
4947            Self::Tuesday => serializer.serialize_i32(2),
4948            Self::Wednesday => serializer.serialize_i32(3),
4949            Self::Thursday => serializer.serialize_i32(4),
4950            Self::Friday => serializer.serialize_i32(5),
4951            Self::Saturday => serializer.serialize_i32(6),
4952            Self::Sunday => serializer.serialize_i32(7),
4953            Self::UnknownValue(u) => u.0.serialize(serializer),
4954        }
4955    }
4956}
4957
4958impl<'de> serde::de::Deserialize<'de> for DayOfWeek {
4959    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4960    where
4961        D: serde::Deserializer<'de>,
4962    {
4963        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DayOfWeek>::new(
4964            ".google.type.DayOfWeek",
4965        ))
4966    }
4967}
4968
4969/// Represents a month in the Gregorian calendar.
4970///
4971/// # Working with unknown values
4972///
4973/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4974/// additional enum variants at any time. Adding new variants is not considered
4975/// a breaking change. Applications should write their code in anticipation of:
4976///
4977/// - New values appearing in future releases of the client library, **and**
4978/// - New values received dynamically, without application changes.
4979///
4980/// Please consult the [Working with enums] section in the user guide for some
4981/// guidelines.
4982///
4983/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4984#[derive(Clone, Debug, PartialEq)]
4985#[non_exhaustive]
4986pub enum Month {
4987    /// The unspecified month.
4988    Unspecified,
4989    /// The month of January.
4990    January,
4991    /// The month of February.
4992    February,
4993    /// The month of March.
4994    March,
4995    /// The month of April.
4996    April,
4997    /// The month of May.
4998    May,
4999    /// The month of June.
5000    June,
5001    /// The month of July.
5002    July,
5003    /// The month of August.
5004    August,
5005    /// The month of September.
5006    September,
5007    /// The month of October.
5008    October,
5009    /// The month of November.
5010    November,
5011    /// The month of December.
5012    December,
5013    /// If set, the enum was initialized with an unknown value.
5014    ///
5015    /// Applications can examine the value using [Month::value] or
5016    /// [Month::name].
5017    UnknownValue(month::UnknownValue),
5018}
5019
5020#[doc(hidden)]
5021pub mod month {
5022    #[allow(unused_imports)]
5023    use super::*;
5024    #[derive(Clone, Debug, PartialEq)]
5025    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5026}
5027
5028impl Month {
5029    /// Gets the enum value.
5030    ///
5031    /// Returns `None` if the enum contains an unknown value deserialized from
5032    /// the string representation of enums.
5033    pub fn value(&self) -> std::option::Option<i32> {
5034        match self {
5035            Self::Unspecified => std::option::Option::Some(0),
5036            Self::January => std::option::Option::Some(1),
5037            Self::February => std::option::Option::Some(2),
5038            Self::March => std::option::Option::Some(3),
5039            Self::April => std::option::Option::Some(4),
5040            Self::May => std::option::Option::Some(5),
5041            Self::June => std::option::Option::Some(6),
5042            Self::July => std::option::Option::Some(7),
5043            Self::August => std::option::Option::Some(8),
5044            Self::September => std::option::Option::Some(9),
5045            Self::October => std::option::Option::Some(10),
5046            Self::November => std::option::Option::Some(11),
5047            Self::December => std::option::Option::Some(12),
5048            Self::UnknownValue(u) => u.0.value(),
5049        }
5050    }
5051
5052    /// Gets the enum value as a string.
5053    ///
5054    /// Returns `None` if the enum contains an unknown value deserialized from
5055    /// the integer representation of enums.
5056    pub fn name(&self) -> std::option::Option<&str> {
5057        match self {
5058            Self::Unspecified => std::option::Option::Some("MONTH_UNSPECIFIED"),
5059            Self::January => std::option::Option::Some("JANUARY"),
5060            Self::February => std::option::Option::Some("FEBRUARY"),
5061            Self::March => std::option::Option::Some("MARCH"),
5062            Self::April => std::option::Option::Some("APRIL"),
5063            Self::May => std::option::Option::Some("MAY"),
5064            Self::June => std::option::Option::Some("JUNE"),
5065            Self::July => std::option::Option::Some("JULY"),
5066            Self::August => std::option::Option::Some("AUGUST"),
5067            Self::September => std::option::Option::Some("SEPTEMBER"),
5068            Self::October => std::option::Option::Some("OCTOBER"),
5069            Self::November => std::option::Option::Some("NOVEMBER"),
5070            Self::December => std::option::Option::Some("DECEMBER"),
5071            Self::UnknownValue(u) => u.0.name(),
5072        }
5073    }
5074}
5075
5076impl std::default::Default for Month {
5077    fn default() -> Self {
5078        use std::convert::From;
5079        Self::from(0)
5080    }
5081}
5082
5083impl std::fmt::Display for Month {
5084    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5085        wkt::internal::display_enum(f, self.name(), self.value())
5086    }
5087}
5088
5089impl std::convert::From<i32> for Month {
5090    fn from(value: i32) -> Self {
5091        match value {
5092            0 => Self::Unspecified,
5093            1 => Self::January,
5094            2 => Self::February,
5095            3 => Self::March,
5096            4 => Self::April,
5097            5 => Self::May,
5098            6 => Self::June,
5099            7 => Self::July,
5100            8 => Self::August,
5101            9 => Self::September,
5102            10 => Self::October,
5103            11 => Self::November,
5104            12 => Self::December,
5105            _ => Self::UnknownValue(month::UnknownValue(
5106                wkt::internal::UnknownEnumValue::Integer(value),
5107            )),
5108        }
5109    }
5110}
5111
5112impl std::convert::From<&str> for Month {
5113    fn from(value: &str) -> Self {
5114        use std::string::ToString;
5115        match value {
5116            "MONTH_UNSPECIFIED" => Self::Unspecified,
5117            "JANUARY" => Self::January,
5118            "FEBRUARY" => Self::February,
5119            "MARCH" => Self::March,
5120            "APRIL" => Self::April,
5121            "MAY" => Self::May,
5122            "JUNE" => Self::June,
5123            "JULY" => Self::July,
5124            "AUGUST" => Self::August,
5125            "SEPTEMBER" => Self::September,
5126            "OCTOBER" => Self::October,
5127            "NOVEMBER" => Self::November,
5128            "DECEMBER" => Self::December,
5129            _ => Self::UnknownValue(month::UnknownValue(
5130                wkt::internal::UnknownEnumValue::String(value.to_string()),
5131            )),
5132        }
5133    }
5134}
5135
5136impl serde::ser::Serialize for Month {
5137    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5138    where
5139        S: serde::Serializer,
5140    {
5141        match self {
5142            Self::Unspecified => serializer.serialize_i32(0),
5143            Self::January => serializer.serialize_i32(1),
5144            Self::February => serializer.serialize_i32(2),
5145            Self::March => serializer.serialize_i32(3),
5146            Self::April => serializer.serialize_i32(4),
5147            Self::May => serializer.serialize_i32(5),
5148            Self::June => serializer.serialize_i32(6),
5149            Self::July => serializer.serialize_i32(7),
5150            Self::August => serializer.serialize_i32(8),
5151            Self::September => serializer.serialize_i32(9),
5152            Self::October => serializer.serialize_i32(10),
5153            Self::November => serializer.serialize_i32(11),
5154            Self::December => serializer.serialize_i32(12),
5155            Self::UnknownValue(u) => u.0.serialize(serializer),
5156        }
5157    }
5158}
5159
5160impl<'de> serde::de::Deserialize<'de> for Month {
5161    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5162    where
5163        D: serde::Deserializer<'de>,
5164    {
5165        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Month>::new(
5166            ".google.type.Month",
5167        ))
5168    }
5169}