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
27mod debug;
28mod deserialize;
29mod serialize;
30
31/// Represents a color in the RGBA color space. This representation is designed
32/// for simplicity of conversion to/from color representations in various
33/// languages over compactness. For example, the fields of this representation
34/// can be trivially provided to the constructor of `java.awt.Color` in Java; it
35/// can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
36/// method in iOS; and, with just a little work, it can be easily formatted into
37/// a CSS `rgba()` string in JavaScript.
38///
39/// This reference page doesn't carry information about the absolute color
40/// space
41/// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
42/// DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
43/// space.
44///
45/// When color equality needs to be decided, implementations, unless
46/// documented otherwise, treat two colors as equal if all their red,
47/// green, blue, and alpha values each differ by at most 1e-5.
48///
49/// Example (Java):
50///
51/// ```norust
52///  import com.google.type.Color;
53///
54///  // ...
55///  public static java.awt.Color fromProto(Color protocolor) {
56///    float alpha = protocolor.hasAlpha()
57///        ? protocolor.getAlpha().getValue()
58///        : 1.0;
59///
60///    return new java.awt.Color(
61///        protocolor.getRed(),
62///        protocolor.getGreen(),
63///        protocolor.getBlue(),
64///        alpha);
65///  }
66///
67///  public static Color toProto(java.awt.Color color) {
68///    float red = (float) color.getRed();
69///    float green = (float) color.getGreen();
70///    float blue = (float) color.getBlue();
71///    float denominator = 255.0;
72///    Color.Builder resultBuilder =
73///        Color
74///            .newBuilder()
75///            .setRed(red / denominator)
76///            .setGreen(green / denominator)
77///            .setBlue(blue / denominator);
78///    int alpha = color.getAlpha();
79///    if (alpha != 255) {
80///      result.setAlpha(
81///          FloatValue
82///              .newBuilder()
83///              .setValue(((float) alpha) / denominator)
84///              .build());
85///    }
86///    return resultBuilder.build();
87///  }
88///  // ...
89/// ```
90///
91/// Example (iOS / Obj-C):
92///
93/// ```norust
94///  // ...
95///  static UIColor* fromProto(Color* protocolor) {
96///     float red = [protocolor red];
97///     float green = [protocolor green];
98///     float blue = [protocolor blue];
99///     FloatValue* alpha_wrapper = [protocolor alpha];
100///     float alpha = 1.0;
101///     if (alpha_wrapper != nil) {
102///       alpha = [alpha_wrapper value];
103///     }
104///     return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
105///  }
106///
107///  static Color* toProto(UIColor* color) {
108///      CGFloat red, green, blue, alpha;
109///      if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
110///        return nil;
111///      }
112///      Color* result = [[Color alloc] init];
113///      [result setRed:red];
114///      [result setGreen:green];
115///      [result setBlue:blue];
116///      if (alpha <= 0.9999) {
117///        [result setAlpha:floatWrapperWithValue(alpha)];
118///      }
119///      [result autorelease];
120///      return result;
121/// }
122/// // ...
123/// ```
124///
125/// Example (JavaScript):
126///
127/// ```norust
128/// // ...
129///
130/// var protoToCssColor = function(rgb_color) {
131///    var redFrac = rgb_color.red || 0.0;
132///    var greenFrac = rgb_color.green || 0.0;
133///    var blueFrac = rgb_color.blue || 0.0;
134///    var red = Math.floor(redFrac * 255);
135///    var green = Math.floor(greenFrac * 255);
136///    var blue = Math.floor(blueFrac * 255);
137///
138///    if (!('alpha' in rgb_color)) {
139///       return rgbToCssColor(red, green, blue);
140///    }
141///
142///    var alphaFrac = rgb_color.alpha.value || 0.0;
143///    var rgbParams = [red, green, blue].join(',');
144///    return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
145/// };
146///
147/// var rgbToCssColor = function(red, green, blue) {
148///   var rgbNumber = new Number((red << 16) | (green << 8) | blue);
149///   var hexString = rgbNumber.toString(16);
150///   var missingZeros = 6 - hexString.length;
151///   var resultBuilder = ['#'];
152///   for (var i = 0; i < missingZeros; i++) {
153///      resultBuilder.push('0');
154///   }
155///   resultBuilder.push(hexString);
156///   return resultBuilder.join('');
157/// };
158///
159/// // ...
160/// ```
161#[derive(Clone, Default, PartialEq)]
162#[non_exhaustive]
163pub struct Color {
164    /// The amount of red in the color as a value in the interval [0, 1].
165    pub red: f32,
166
167    /// The amount of green in the color as a value in the interval [0, 1].
168    pub green: f32,
169
170    /// The amount of blue in the color as a value in the interval [0, 1].
171    pub blue: f32,
172
173    /// The fraction of this color that should be applied to the pixel. That is,
174    /// the final pixel color is defined by the equation:
175    ///
176    /// `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
177    ///
178    /// This means that a value of 1.0 corresponds to a solid color, whereas
179    /// a value of 0.0 corresponds to a completely transparent color. This
180    /// uses a wrapper message rather than a simple float scalar so that it is
181    /// possible to distinguish between a default value and the value being unset.
182    /// If omitted, this color object is rendered as a solid color
183    /// (as if the alpha value had been explicitly given a value of 1.0).
184    pub alpha: std::option::Option<wkt::FloatValue>,
185
186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
187}
188
189impl Color {
190    pub fn new() -> Self {
191        std::default::Default::default()
192    }
193
194    /// Sets the value of [red][crate::model::Color::red].
195    ///
196    /// # Example
197    /// ```ignore,no_run
198    /// # use google_cloud_type::model::Color;
199    /// let x = Color::new().set_red(42.0);
200    /// ```
201    pub fn set_red<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
202        self.red = v.into();
203        self
204    }
205
206    /// Sets the value of [green][crate::model::Color::green].
207    ///
208    /// # Example
209    /// ```ignore,no_run
210    /// # use google_cloud_type::model::Color;
211    /// let x = Color::new().set_green(42.0);
212    /// ```
213    pub fn set_green<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
214        self.green = v.into();
215        self
216    }
217
218    /// Sets the value of [blue][crate::model::Color::blue].
219    ///
220    /// # Example
221    /// ```ignore,no_run
222    /// # use google_cloud_type::model::Color;
223    /// let x = Color::new().set_blue(42.0);
224    /// ```
225    pub fn set_blue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
226        self.blue = v.into();
227        self
228    }
229
230    /// Sets the value of [alpha][crate::model::Color::alpha].
231    ///
232    /// # Example
233    /// ```ignore,no_run
234    /// # use google_cloud_type::model::Color;
235    /// use wkt::FloatValue;
236    /// let x = Color::new().set_alpha(FloatValue::default()/* use setters */);
237    /// ```
238    pub fn set_alpha<T>(mut self, v: T) -> Self
239    where
240        T: std::convert::Into<wkt::FloatValue>,
241    {
242        self.alpha = std::option::Option::Some(v.into());
243        self
244    }
245
246    /// Sets or clears the value of [alpha][crate::model::Color::alpha].
247    ///
248    /// # Example
249    /// ```ignore,no_run
250    /// # use google_cloud_type::model::Color;
251    /// use wkt::FloatValue;
252    /// let x = Color::new().set_or_clear_alpha(Some(FloatValue::default()/* use setters */));
253    /// let x = Color::new().set_or_clear_alpha(None::<FloatValue>);
254    /// ```
255    pub fn set_or_clear_alpha<T>(mut self, v: std::option::Option<T>) -> Self
256    where
257        T: std::convert::Into<wkt::FloatValue>,
258    {
259        self.alpha = v.map(|x| x.into());
260        self
261    }
262}
263
264impl wkt::message::Message for Color {
265    fn typename() -> &'static str {
266        "type.googleapis.com/google.type.Color"
267    }
268}
269
270/// Represents a whole or partial calendar date, such as a birthday. The time of
271/// day and time zone are either specified elsewhere or are insignificant. The
272/// date is relative to the Gregorian Calendar. This can represent one of the
273/// following:
274///
275/// * A full date, with non-zero year, month, and day values
276/// * A month and day value, with a zero year, such as an anniversary
277/// * A year on its own, with zero month and day values
278/// * A year and month value, with a zero day, such as a credit card expiration
279///   date
280///
281/// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
282/// `google.protobuf.Timestamp`.
283///
284/// [google.type.TimeOfDay]: crate::model::TimeOfDay
285#[derive(Clone, Default, PartialEq)]
286#[non_exhaustive]
287pub struct Date {
288    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without
289    /// a year.
290    pub year: i32,
291
292    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a
293    /// month and day.
294    pub month: i32,
295
296    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
297    /// to specify a year by itself or a year and month where the day isn't
298    /// significant.
299    pub day: i32,
300
301    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
302}
303
304impl Date {
305    pub fn new() -> Self {
306        std::default::Default::default()
307    }
308
309    /// Sets the value of [year][crate::model::Date::year].
310    ///
311    /// # Example
312    /// ```ignore,no_run
313    /// # use google_cloud_type::model::Date;
314    /// let x = Date::new().set_year(42);
315    /// ```
316    pub fn set_year<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
317        self.year = v.into();
318        self
319    }
320
321    /// Sets the value of [month][crate::model::Date::month].
322    ///
323    /// # Example
324    /// ```ignore,no_run
325    /// # use google_cloud_type::model::Date;
326    /// let x = Date::new().set_month(42);
327    /// ```
328    pub fn set_month<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
329        self.month = v.into();
330        self
331    }
332
333    /// Sets the value of [day][crate::model::Date::day].
334    ///
335    /// # Example
336    /// ```ignore,no_run
337    /// # use google_cloud_type::model::Date;
338    /// let x = Date::new().set_day(42);
339    /// ```
340    pub fn set_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
341        self.day = v.into();
342        self
343    }
344}
345
346impl wkt::message::Message for Date {
347    fn typename() -> &'static str {
348        "type.googleapis.com/google.type.Date"
349    }
350}
351
352/// Represents civil time (or occasionally physical time).
353///
354/// This type can represent a civil time in one of a few possible ways:
355///
356/// * When utc_offset is set and time_zone is unset: a civil time on a calendar
357///   day with a particular offset from UTC.
358/// * When time_zone is set and utc_offset is unset: a civil time on a calendar
359///   day in a particular time zone.
360/// * When neither time_zone nor utc_offset is set: a civil time on a calendar
361///   day in local time.
362///
363/// The date is relative to the Proleptic Gregorian Calendar.
364///
365/// If year is 0, the DateTime is considered not to have a specific year. month
366/// and day must have valid, non-zero values.
367///
368/// This type may also be used to represent a physical time if all the date and
369/// time fields are set and either case of the `time_offset` oneof is set.
370/// Consider using `Timestamp` message for physical time instead. If your use
371/// case also would like to store the user's timezone, that can be done in
372/// another field.
373///
374/// This type is more flexible than some applications may want. Make sure to
375/// document and validate your application's limitations.
376#[derive(Clone, Default, PartialEq)]
377#[non_exhaustive]
378pub struct DateTime {
379    /// Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a
380    /// datetime without a year.
381    pub year: i32,
382
383    /// Required. Month of year. Must be from 1 to 12.
384    pub month: i32,
385
386    /// Required. Day of month. Must be from 1 to 31 and valid for the year and
387    /// month.
388    pub day: i32,
389
390    /// Required. Hours of day in 24 hour format. Should be from 0 to 23. An API
391    /// may choose to allow the value "24:00:00" for scenarios like business
392    /// closing time.
393    pub hours: i32,
394
395    /// Required. Minutes of hour of day. Must be from 0 to 59.
396    pub minutes: i32,
397
398    /// Required. Seconds of minutes of the time. Must normally be from 0 to 59. An
399    /// API may allow the value 60 if it allows leap-seconds.
400    pub seconds: i32,
401
402    /// Required. Fractions of seconds in nanoseconds. Must be from 0 to
403    /// 999,999,999.
404    pub nanos: i32,
405
406    /// Optional. Specifies either the UTC offset or the time zone of the DateTime.
407    /// Choose carefully between them, considering that time zone data may change
408    /// in the future (for example, a country modifies their DST start/end dates,
409    /// and future DateTimes in the affected range had already been stored).
410    /// If omitted, the DateTime is considered to be in local time.
411    pub time_offset: std::option::Option<crate::model::date_time::TimeOffset>,
412
413    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
414}
415
416impl DateTime {
417    pub fn new() -> Self {
418        std::default::Default::default()
419    }
420
421    /// Sets the value of [year][crate::model::DateTime::year].
422    ///
423    /// # Example
424    /// ```ignore,no_run
425    /// # use google_cloud_type::model::DateTime;
426    /// let x = DateTime::new().set_year(42);
427    /// ```
428    pub fn set_year<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
429        self.year = v.into();
430        self
431    }
432
433    /// Sets the value of [month][crate::model::DateTime::month].
434    ///
435    /// # Example
436    /// ```ignore,no_run
437    /// # use google_cloud_type::model::DateTime;
438    /// let x = DateTime::new().set_month(42);
439    /// ```
440    pub fn set_month<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
441        self.month = v.into();
442        self
443    }
444
445    /// Sets the value of [day][crate::model::DateTime::day].
446    ///
447    /// # Example
448    /// ```ignore,no_run
449    /// # use google_cloud_type::model::DateTime;
450    /// let x = DateTime::new().set_day(42);
451    /// ```
452    pub fn set_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
453        self.day = v.into();
454        self
455    }
456
457    /// Sets the value of [hours][crate::model::DateTime::hours].
458    ///
459    /// # Example
460    /// ```ignore,no_run
461    /// # use google_cloud_type::model::DateTime;
462    /// let x = DateTime::new().set_hours(42);
463    /// ```
464    pub fn set_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
465        self.hours = v.into();
466        self
467    }
468
469    /// Sets the value of [minutes][crate::model::DateTime::minutes].
470    ///
471    /// # Example
472    /// ```ignore,no_run
473    /// # use google_cloud_type::model::DateTime;
474    /// let x = DateTime::new().set_minutes(42);
475    /// ```
476    pub fn set_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
477        self.minutes = v.into();
478        self
479    }
480
481    /// Sets the value of [seconds][crate::model::DateTime::seconds].
482    ///
483    /// # Example
484    /// ```ignore,no_run
485    /// # use google_cloud_type::model::DateTime;
486    /// let x = DateTime::new().set_seconds(42);
487    /// ```
488    pub fn set_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
489        self.seconds = v.into();
490        self
491    }
492
493    /// Sets the value of [nanos][crate::model::DateTime::nanos].
494    ///
495    /// # Example
496    /// ```ignore,no_run
497    /// # use google_cloud_type::model::DateTime;
498    /// let x = DateTime::new().set_nanos(42);
499    /// ```
500    pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
501        self.nanos = v.into();
502        self
503    }
504
505    /// Sets the value of [time_offset][crate::model::DateTime::time_offset].
506    ///
507    /// Note that all the setters affecting `time_offset` are mutually
508    /// exclusive.
509    ///
510    /// # Example
511    /// ```ignore,no_run
512    /// # use google_cloud_type::model::DateTime;
513    /// use wkt::Duration;
514    /// let x = DateTime::new().set_time_offset(Some(
515    ///     google_cloud_type::model::date_time::TimeOffset::UtcOffset(Duration::default().into())));
516    /// ```
517    pub fn set_time_offset<
518        T: std::convert::Into<std::option::Option<crate::model::date_time::TimeOffset>>,
519    >(
520        mut self,
521        v: T,
522    ) -> Self {
523        self.time_offset = v.into();
524        self
525    }
526
527    /// The value of [time_offset][crate::model::DateTime::time_offset]
528    /// if it holds a `UtcOffset`, `None` if the field is not set or
529    /// holds a different branch.
530    pub fn utc_offset(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
531        #[allow(unreachable_patterns)]
532        self.time_offset.as_ref().and_then(|v| match v {
533            crate::model::date_time::TimeOffset::UtcOffset(v) => std::option::Option::Some(v),
534            _ => std::option::Option::None,
535        })
536    }
537
538    /// Sets the value of [time_offset][crate::model::DateTime::time_offset]
539    /// to hold a `UtcOffset`.
540    ///
541    /// Note that all the setters affecting `time_offset` are
542    /// mutually exclusive.
543    ///
544    /// # Example
545    /// ```ignore,no_run
546    /// # use google_cloud_type::model::DateTime;
547    /// use wkt::Duration;
548    /// let x = DateTime::new().set_utc_offset(Duration::default()/* use setters */);
549    /// assert!(x.utc_offset().is_some());
550    /// assert!(x.time_zone().is_none());
551    /// ```
552    pub fn set_utc_offset<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
553        mut self,
554        v: T,
555    ) -> Self {
556        self.time_offset =
557            std::option::Option::Some(crate::model::date_time::TimeOffset::UtcOffset(v.into()));
558        self
559    }
560
561    /// The value of [time_offset][crate::model::DateTime::time_offset]
562    /// if it holds a `TimeZone`, `None` if the field is not set or
563    /// holds a different branch.
564    pub fn time_zone(&self) -> std::option::Option<&std::boxed::Box<crate::model::TimeZone>> {
565        #[allow(unreachable_patterns)]
566        self.time_offset.as_ref().and_then(|v| match v {
567            crate::model::date_time::TimeOffset::TimeZone(v) => std::option::Option::Some(v),
568            _ => std::option::Option::None,
569        })
570    }
571
572    /// Sets the value of [time_offset][crate::model::DateTime::time_offset]
573    /// to hold a `TimeZone`.
574    ///
575    /// Note that all the setters affecting `time_offset` are
576    /// mutually exclusive.
577    ///
578    /// # Example
579    /// ```ignore,no_run
580    /// # use google_cloud_type::model::DateTime;
581    /// use google_cloud_type::model::TimeZone;
582    /// let x = DateTime::new().set_time_zone(TimeZone::default()/* use setters */);
583    /// assert!(x.time_zone().is_some());
584    /// assert!(x.utc_offset().is_none());
585    /// ```
586    pub fn set_time_zone<T: std::convert::Into<std::boxed::Box<crate::model::TimeZone>>>(
587        mut self,
588        v: T,
589    ) -> Self {
590        self.time_offset =
591            std::option::Option::Some(crate::model::date_time::TimeOffset::TimeZone(v.into()));
592        self
593    }
594}
595
596impl wkt::message::Message for DateTime {
597    fn typename() -> &'static str {
598        "type.googleapis.com/google.type.DateTime"
599    }
600}
601
602/// Defines additional types related to [DateTime].
603pub mod date_time {
604    #[allow(unused_imports)]
605    use super::*;
606
607    /// Optional. Specifies either the UTC offset or the time zone of the DateTime.
608    /// Choose carefully between them, considering that time zone data may change
609    /// in the future (for example, a country modifies their DST start/end dates,
610    /// and future DateTimes in the affected range had already been stored).
611    /// If omitted, the DateTime is considered to be in local time.
612    #[derive(Clone, Debug, PartialEq)]
613    #[non_exhaustive]
614    pub enum TimeOffset {
615        /// UTC offset. Must be whole seconds, between -18 hours and +18 hours.
616        /// For example, a UTC offset of -4:00 would be represented as
617        /// { seconds: -14400 }.
618        UtcOffset(std::boxed::Box<wkt::Duration>),
619        /// Time zone.
620        TimeZone(std::boxed::Box<crate::model::TimeZone>),
621    }
622}
623
624/// Represents a time zone from the
625/// [IANA Time Zone Database](https://www.iana.org/time-zones).
626#[derive(Clone, Default, PartialEq)]
627#[non_exhaustive]
628pub struct TimeZone {
629    /// IANA Time Zone Database time zone, e.g. "America/New_York".
630    pub id: std::string::String,
631
632    /// Optional. IANA Time Zone Database version number, e.g. "2019a".
633    pub version: std::string::String,
634
635    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
636}
637
638impl TimeZone {
639    pub fn new() -> Self {
640        std::default::Default::default()
641    }
642
643    /// Sets the value of [id][crate::model::TimeZone::id].
644    ///
645    /// # Example
646    /// ```ignore,no_run
647    /// # use google_cloud_type::model::TimeZone;
648    /// let x = TimeZone::new().set_id("example");
649    /// ```
650    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
651        self.id = v.into();
652        self
653    }
654
655    /// Sets the value of [version][crate::model::TimeZone::version].
656    ///
657    /// # Example
658    /// ```ignore,no_run
659    /// # use google_cloud_type::model::TimeZone;
660    /// let x = TimeZone::new().set_version("example");
661    /// ```
662    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
663        self.version = v.into();
664        self
665    }
666}
667
668impl wkt::message::Message for TimeZone {
669    fn typename() -> &'static str {
670        "type.googleapis.com/google.type.TimeZone"
671    }
672}
673
674/// A representation of a decimal value, such as 2.5. Clients may convert values
675/// into language-native decimal formats, such as Java's [BigDecimal][] or
676/// Python's [decimal.Decimal][].
677///
678/// [BigDecimal]:
679///  https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
680/// [decimal.Decimal]:
681///  https://docs.python.org/3/library/decimal.html
682#[derive(Clone, Default, PartialEq)]
683#[non_exhaustive]
684pub struct Decimal {
685    /// The decimal value, as a string.
686    ///
687    /// The string representation consists of an optional sign, `+` (`U+002B`)
688    /// or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
689    /// ("the integer"), optionally followed by a fraction, optionally followed
690    /// by an exponent.
691    ///
692    /// The fraction consists of a decimal point followed by zero or more decimal
693    /// digits. The string must contain at least one digit in either the integer
694    /// or the fraction. The number formed by the sign, the integer and the
695    /// fraction is referred to as the significand.
696    ///
697    /// The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
698    /// followed by one or more decimal digits.
699    ///
700    /// Services **should** normalize decimal values before storing them by:
701    ///
702    /// - Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`).
703    /// - Replacing a zero-length integer value with `0` (`.5` -> `0.5`).
704    /// - Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`).
705    /// - Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`).
706    ///
707    /// Services **may** perform additional normalization based on its own needs
708    /// and the internal decimal implementation selected, such as shifting the
709    /// decimal point and exponent value together (example: `2.5e-1` <-> `0.25`).
710    /// Additionally, services **may** preserve trailing zeroes in the fraction
711    /// to indicate increased precision, but are not required to do so.
712    ///
713    /// Note that only the `.` character is supported to divide the integer
714    /// and the fraction; `,` **should not** be supported regardless of locale.
715    /// Additionally, thousand separators **should not** be supported. If a
716    /// service does support them, values **must** be normalized.
717    ///
718    /// The ENBF grammar is:
719    ///
720    /// ```norust
721    /// DecimalString =
722    ///   [Sign] Significand [Exponent];
723    ///
724    /// Sign = '+' | '-';
725    ///
726    /// Significand =
727    ///   Digits ['.'] [Digits] | [Digits] '.' Digits;
728    ///
729    /// Exponent = ('e' | 'E') [Sign] Digits;
730    ///
731    /// Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };
732    /// ```
733    ///
734    /// Services **should** clearly document the range of supported values, the
735    /// maximum supported precision (total number of digits), and, if applicable,
736    /// the scale (number of digits after the decimal point), as well as how it
737    /// behaves when receiving out-of-bounds values.
738    ///
739    /// Services **may** choose to accept values passed as input even when the
740    /// value has a higher precision or scale than the service supports, and
741    /// **should** round the value to fit the supported scale. Alternatively, the
742    /// service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
743    /// if precision would be lost.
744    ///
745    /// Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
746    /// gRPC) if the service receives a value outside of the supported range.
747    pub value: std::string::String,
748
749    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
750}
751
752impl Decimal {
753    pub fn new() -> Self {
754        std::default::Default::default()
755    }
756
757    /// Sets the value of [value][crate::model::Decimal::value].
758    ///
759    /// # Example
760    /// ```ignore,no_run
761    /// # use google_cloud_type::model::Decimal;
762    /// let x = Decimal::new().set_value("example");
763    /// ```
764    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
765        self.value = v.into();
766        self
767    }
768}
769
770impl wkt::message::Message for Decimal {
771    fn typename() -> &'static str {
772        "type.googleapis.com/google.type.Decimal"
773    }
774}
775
776/// Represents a textual expression in the Common Expression Language (CEL)
777/// syntax. CEL is a C-like expression language. The syntax and semantics of CEL
778/// are documented at <https://github.com/google/cel-spec>.
779///
780/// Example (Comparison):
781///
782/// ```norust
783/// title: "Summary size limit"
784/// description: "Determines if a summary is less than 100 chars"
785/// expression: "document.summary.size() < 100"
786/// ```
787///
788/// Example (Equality):
789///
790/// ```norust
791/// title: "Requestor is owner"
792/// description: "Determines if requestor is the document owner"
793/// expression: "document.owner == request.auth.claims.email"
794/// ```
795///
796/// Example (Logic):
797///
798/// ```norust
799/// title: "Public documents"
800/// description: "Determine whether the document should be publicly visible"
801/// expression: "document.type != 'private' && document.type != 'internal'"
802/// ```
803///
804/// Example (Data Manipulation):
805///
806/// ```norust
807/// title: "Notification string"
808/// description: "Create a notification string with a timestamp."
809/// expression: "'New message received at ' + string(document.create_time)"
810/// ```
811///
812/// The exact variables and functions that may be referenced within an expression
813/// are determined by the service that evaluates it. See the service
814/// documentation for additional information.
815#[derive(Clone, Default, PartialEq)]
816#[non_exhaustive]
817pub struct Expr {
818    /// Textual representation of an expression in Common Expression Language
819    /// syntax.
820    pub expression: std::string::String,
821
822    /// Optional. Title for the expression, i.e. a short string describing
823    /// its purpose. This can be used e.g. in UIs which allow to enter the
824    /// expression.
825    pub title: std::string::String,
826
827    /// Optional. Description of the expression. This is a longer text which
828    /// describes the expression, e.g. when hovered over it in a UI.
829    pub description: std::string::String,
830
831    /// Optional. String indicating the location of the expression for error
832    /// reporting, e.g. a file name and a position in the file.
833    pub location: std::string::String,
834
835    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
836}
837
838impl Expr {
839    pub fn new() -> Self {
840        std::default::Default::default()
841    }
842
843    /// Sets the value of [expression][crate::model::Expr::expression].
844    ///
845    /// # Example
846    /// ```ignore,no_run
847    /// # use google_cloud_type::model::Expr;
848    /// let x = Expr::new().set_expression("example");
849    /// ```
850    pub fn set_expression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
851        self.expression = v.into();
852        self
853    }
854
855    /// Sets the value of [title][crate::model::Expr::title].
856    ///
857    /// # Example
858    /// ```ignore,no_run
859    /// # use google_cloud_type::model::Expr;
860    /// let x = Expr::new().set_title("example");
861    /// ```
862    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
863        self.title = v.into();
864        self
865    }
866
867    /// Sets the value of [description][crate::model::Expr::description].
868    ///
869    /// # Example
870    /// ```ignore,no_run
871    /// # use google_cloud_type::model::Expr;
872    /// let x = Expr::new().set_description("example");
873    /// ```
874    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
875        self.description = v.into();
876        self
877    }
878
879    /// Sets the value of [location][crate::model::Expr::location].
880    ///
881    /// # Example
882    /// ```ignore,no_run
883    /// # use google_cloud_type::model::Expr;
884    /// let x = Expr::new().set_location("example");
885    /// ```
886    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
887        self.location = v.into();
888        self
889    }
890}
891
892impl wkt::message::Message for Expr {
893    fn typename() -> &'static str {
894        "type.googleapis.com/google.type.Expr"
895    }
896}
897
898/// Represents a fraction in terms of a numerator divided by a denominator.
899#[derive(Clone, Default, PartialEq)]
900#[non_exhaustive]
901pub struct Fraction {
902    /// The numerator in the fraction, e.g. 2 in 2/3.
903    pub numerator: i64,
904
905    /// The value by which the numerator is divided, e.g. 3 in 2/3. Must be
906    /// positive.
907    pub denominator: i64,
908
909    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
910}
911
912impl Fraction {
913    pub fn new() -> Self {
914        std::default::Default::default()
915    }
916
917    /// Sets the value of [numerator][crate::model::Fraction::numerator].
918    ///
919    /// # Example
920    /// ```ignore,no_run
921    /// # use google_cloud_type::model::Fraction;
922    /// let x = Fraction::new().set_numerator(42);
923    /// ```
924    pub fn set_numerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
925        self.numerator = v.into();
926        self
927    }
928
929    /// Sets the value of [denominator][crate::model::Fraction::denominator].
930    ///
931    /// # Example
932    /// ```ignore,no_run
933    /// # use google_cloud_type::model::Fraction;
934    /// let x = Fraction::new().set_denominator(42);
935    /// ```
936    pub fn set_denominator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
937        self.denominator = v.into();
938        self
939    }
940}
941
942impl wkt::message::Message for Fraction {
943    fn typename() -> &'static str {
944        "type.googleapis.com/google.type.Fraction"
945    }
946}
947
948/// Represents a time interval, encoded as a Timestamp start (inclusive) and a
949/// Timestamp end (exclusive).
950///
951/// The start must be less than or equal to the end.
952/// When the start equals the end, the interval is empty (matches no time).
953/// When both start and end are unspecified, the interval matches any time.
954#[derive(Clone, Default, PartialEq)]
955#[non_exhaustive]
956pub struct Interval {
957    /// Optional. Inclusive start of the interval.
958    ///
959    /// If specified, a Timestamp matching this interval will have to be the same
960    /// or after the start.
961    pub start_time: std::option::Option<wkt::Timestamp>,
962
963    /// Optional. Exclusive end of the interval.
964    ///
965    /// If specified, a Timestamp matching this interval will have to be before the
966    /// end.
967    pub end_time: std::option::Option<wkt::Timestamp>,
968
969    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
970}
971
972impl Interval {
973    pub fn new() -> Self {
974        std::default::Default::default()
975    }
976
977    /// Sets the value of [start_time][crate::model::Interval::start_time].
978    ///
979    /// # Example
980    /// ```ignore,no_run
981    /// # use google_cloud_type::model::Interval;
982    /// use wkt::Timestamp;
983    /// let x = Interval::new().set_start_time(Timestamp::default()/* use setters */);
984    /// ```
985    pub fn set_start_time<T>(mut self, v: T) -> Self
986    where
987        T: std::convert::Into<wkt::Timestamp>,
988    {
989        self.start_time = std::option::Option::Some(v.into());
990        self
991    }
992
993    /// Sets or clears the value of [start_time][crate::model::Interval::start_time].
994    ///
995    /// # Example
996    /// ```ignore,no_run
997    /// # use google_cloud_type::model::Interval;
998    /// use wkt::Timestamp;
999    /// let x = Interval::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1000    /// let x = Interval::new().set_or_clear_start_time(None::<Timestamp>);
1001    /// ```
1002    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1003    where
1004        T: std::convert::Into<wkt::Timestamp>,
1005    {
1006        self.start_time = v.map(|x| x.into());
1007        self
1008    }
1009
1010    /// Sets the value of [end_time][crate::model::Interval::end_time].
1011    ///
1012    /// # Example
1013    /// ```ignore,no_run
1014    /// # use google_cloud_type::model::Interval;
1015    /// use wkt::Timestamp;
1016    /// let x = Interval::new().set_end_time(Timestamp::default()/* use setters */);
1017    /// ```
1018    pub fn set_end_time<T>(mut self, v: T) -> Self
1019    where
1020        T: std::convert::Into<wkt::Timestamp>,
1021    {
1022        self.end_time = std::option::Option::Some(v.into());
1023        self
1024    }
1025
1026    /// Sets or clears the value of [end_time][crate::model::Interval::end_time].
1027    ///
1028    /// # Example
1029    /// ```ignore,no_run
1030    /// # use google_cloud_type::model::Interval;
1031    /// use wkt::Timestamp;
1032    /// let x = Interval::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1033    /// let x = Interval::new().set_or_clear_end_time(None::<Timestamp>);
1034    /// ```
1035    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1036    where
1037        T: std::convert::Into<wkt::Timestamp>,
1038    {
1039        self.end_time = v.map(|x| x.into());
1040        self
1041    }
1042}
1043
1044impl wkt::message::Message for Interval {
1045    fn typename() -> &'static str {
1046        "type.googleapis.com/google.type.Interval"
1047    }
1048}
1049
1050/// An object that represents a latitude/longitude pair. This is expressed as a
1051/// pair of doubles to represent degrees latitude and degrees longitude. Unless
1052/// specified otherwise, this must conform to the
1053/// <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
1054/// standard</a>. Values must be within normalized ranges.
1055#[derive(Clone, Default, PartialEq)]
1056#[non_exhaustive]
1057pub struct LatLng {
1058    /// The latitude in degrees. It must be in the range [-90.0, +90.0].
1059    pub latitude: f64,
1060
1061    /// The longitude in degrees. It must be in the range [-180.0, +180.0].
1062    pub longitude: f64,
1063
1064    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1065}
1066
1067impl LatLng {
1068    pub fn new() -> Self {
1069        std::default::Default::default()
1070    }
1071
1072    /// Sets the value of [latitude][crate::model::LatLng::latitude].
1073    ///
1074    /// # Example
1075    /// ```ignore,no_run
1076    /// # use google_cloud_type::model::LatLng;
1077    /// let x = LatLng::new().set_latitude(42.0);
1078    /// ```
1079    pub fn set_latitude<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1080        self.latitude = v.into();
1081        self
1082    }
1083
1084    /// Sets the value of [longitude][crate::model::LatLng::longitude].
1085    ///
1086    /// # Example
1087    /// ```ignore,no_run
1088    /// # use google_cloud_type::model::LatLng;
1089    /// let x = LatLng::new().set_longitude(42.0);
1090    /// ```
1091    pub fn set_longitude<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1092        self.longitude = v.into();
1093        self
1094    }
1095}
1096
1097impl wkt::message::Message for LatLng {
1098    fn typename() -> &'static str {
1099        "type.googleapis.com/google.type.LatLng"
1100    }
1101}
1102
1103/// Localized variant of a text in a particular language.
1104#[derive(Clone, Default, PartialEq)]
1105#[non_exhaustive]
1106pub struct LocalizedText {
1107    /// Localized string in the language corresponding to `language_code' below.
1108    pub text: std::string::String,
1109
1110    /// The text's BCP-47 language code, such as "en-US" or "sr-Latn".
1111    ///
1112    /// For more information, see
1113    /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier>.
1114    pub language_code: std::string::String,
1115
1116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1117}
1118
1119impl LocalizedText {
1120    pub fn new() -> Self {
1121        std::default::Default::default()
1122    }
1123
1124    /// Sets the value of [text][crate::model::LocalizedText::text].
1125    ///
1126    /// # Example
1127    /// ```ignore,no_run
1128    /// # use google_cloud_type::model::LocalizedText;
1129    /// let x = LocalizedText::new().set_text("example");
1130    /// ```
1131    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1132        self.text = v.into();
1133        self
1134    }
1135
1136    /// Sets the value of [language_code][crate::model::LocalizedText::language_code].
1137    ///
1138    /// # Example
1139    /// ```ignore,no_run
1140    /// # use google_cloud_type::model::LocalizedText;
1141    /// let x = LocalizedText::new().set_language_code("example");
1142    /// ```
1143    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1144        self.language_code = v.into();
1145        self
1146    }
1147}
1148
1149impl wkt::message::Message for LocalizedText {
1150    fn typename() -> &'static str {
1151        "type.googleapis.com/google.type.LocalizedText"
1152    }
1153}
1154
1155/// Represents an amount of money with its currency type.
1156#[derive(Clone, Default, PartialEq)]
1157#[non_exhaustive]
1158pub struct Money {
1159    /// The three-letter currency code defined in ISO 4217.
1160    pub currency_code: std::string::String,
1161
1162    /// The whole units of the amount.
1163    /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
1164    pub units: i64,
1165
1166    /// Number of nano (10^-9) units of the amount.
1167    /// The value must be between -999,999,999 and +999,999,999 inclusive.
1168    /// If `units` is positive, `nanos` must be positive or zero.
1169    /// If `units` is zero, `nanos` can be positive, zero, or negative.
1170    /// If `units` is negative, `nanos` must be negative or zero.
1171    /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
1172    pub nanos: i32,
1173
1174    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1175}
1176
1177impl Money {
1178    pub fn new() -> Self {
1179        std::default::Default::default()
1180    }
1181
1182    /// Sets the value of [currency_code][crate::model::Money::currency_code].
1183    ///
1184    /// # Example
1185    /// ```ignore,no_run
1186    /// # use google_cloud_type::model::Money;
1187    /// let x = Money::new().set_currency_code("example");
1188    /// ```
1189    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1190        self.currency_code = v.into();
1191        self
1192    }
1193
1194    /// Sets the value of [units][crate::model::Money::units].
1195    ///
1196    /// # Example
1197    /// ```ignore,no_run
1198    /// # use google_cloud_type::model::Money;
1199    /// let x = Money::new().set_units(42);
1200    /// ```
1201    pub fn set_units<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1202        self.units = v.into();
1203        self
1204    }
1205
1206    /// Sets the value of [nanos][crate::model::Money::nanos].
1207    ///
1208    /// # Example
1209    /// ```ignore,no_run
1210    /// # use google_cloud_type::model::Money;
1211    /// let x = Money::new().set_nanos(42);
1212    /// ```
1213    pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1214        self.nanos = v.into();
1215        self
1216    }
1217}
1218
1219impl wkt::message::Message for Money {
1220    fn typename() -> &'static str {
1221        "type.googleapis.com/google.type.Money"
1222    }
1223}
1224
1225/// An object representing a phone number, suitable as an API wire format.
1226///
1227/// This representation:
1228///
1229/// - should not be used for locale-specific formatting of a phone number, such
1230///   as "+1 (650) 253-0000 ext. 123"
1231///
1232/// - is not designed for efficient storage
1233///
1234/// - may not be suitable for dialing - specialized libraries (see references)
1235///   should be used to parse the number for that purpose
1236///
1237///
1238/// To do something meaningful with this number, such as format it for various
1239/// use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.
1240///
1241/// For instance, in Java this would be:
1242///
1243/// com.google.type.PhoneNumber wireProto =
1244/// com.google.type.PhoneNumber.newBuilder().build();
1245/// com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =
1246/// PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ");
1247/// if (!wireProto.getExtension().isEmpty()) {
1248/// phoneNumber.setExtension(wireProto.getExtension());
1249/// }
1250///
1251/// Reference(s):
1252///
1253/// - <https://github.com/google/libphonenumber>
1254#[derive(Clone, Default, PartialEq)]
1255#[non_exhaustive]
1256pub struct PhoneNumber {
1257    /// The phone number's extension. The extension is not standardized in ITU
1258    /// recommendations, except for being defined as a series of numbers with a
1259    /// maximum length of 40 digits. Other than digits, some other dialing
1260    /// characters such as ',' (indicating a wait) or '#' may be stored here.
1261    ///
1262    /// Note that no regions currently use extensions with short codes, so this
1263    /// field is normally only set in conjunction with an E.164 number. It is held
1264    /// separately from the E.164 number to allow for short code extensions in the
1265    /// future.
1266    pub extension: std::string::String,
1267
1268    /// Required.  Either a regular number, or a short code.  New fields may be
1269    /// added to the oneof below in the future, so clients should ignore phone
1270    /// numbers for which none of the fields they coded against are set.
1271    pub kind: std::option::Option<crate::model::phone_number::Kind>,
1272
1273    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1274}
1275
1276impl PhoneNumber {
1277    pub fn new() -> Self {
1278        std::default::Default::default()
1279    }
1280
1281    /// Sets the value of [extension][crate::model::PhoneNumber::extension].
1282    ///
1283    /// # Example
1284    /// ```ignore,no_run
1285    /// # use google_cloud_type::model::PhoneNumber;
1286    /// let x = PhoneNumber::new().set_extension("example");
1287    /// ```
1288    pub fn set_extension<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1289        self.extension = v.into();
1290        self
1291    }
1292
1293    /// Sets the value of [kind][crate::model::PhoneNumber::kind].
1294    ///
1295    /// Note that all the setters affecting `kind` are mutually
1296    /// exclusive.
1297    ///
1298    /// # Example
1299    /// ```ignore,no_run
1300    /// # use google_cloud_type::model::PhoneNumber;
1301    /// use google_cloud_type::model::phone_number::Kind;
1302    /// let x = PhoneNumber::new().set_kind(Some(Kind::E164Number("example".to_string())));
1303    /// ```
1304    pub fn set_kind<
1305        T: std::convert::Into<std::option::Option<crate::model::phone_number::Kind>>,
1306    >(
1307        mut self,
1308        v: T,
1309    ) -> Self {
1310        self.kind = v.into();
1311        self
1312    }
1313
1314    /// The value of [kind][crate::model::PhoneNumber::kind]
1315    /// if it holds a `E164Number`, `None` if the field is not set or
1316    /// holds a different branch.
1317    pub fn e164_number(&self) -> std::option::Option<&std::string::String> {
1318        #[allow(unreachable_patterns)]
1319        self.kind.as_ref().and_then(|v| match v {
1320            crate::model::phone_number::Kind::E164Number(v) => std::option::Option::Some(v),
1321            _ => std::option::Option::None,
1322        })
1323    }
1324
1325    /// Sets the value of [kind][crate::model::PhoneNumber::kind]
1326    /// to hold a `E164Number`.
1327    ///
1328    /// Note that all the setters affecting `kind` are
1329    /// mutually exclusive.
1330    ///
1331    /// # Example
1332    /// ```ignore,no_run
1333    /// # use google_cloud_type::model::PhoneNumber;
1334    /// let x = PhoneNumber::new().set_e164_number("example");
1335    /// assert!(x.e164_number().is_some());
1336    /// assert!(x.short_code().is_none());
1337    /// ```
1338    pub fn set_e164_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1339        self.kind =
1340            std::option::Option::Some(crate::model::phone_number::Kind::E164Number(v.into()));
1341        self
1342    }
1343
1344    /// The value of [kind][crate::model::PhoneNumber::kind]
1345    /// if it holds a `ShortCode`, `None` if the field is not set or
1346    /// holds a different branch.
1347    pub fn short_code(
1348        &self,
1349    ) -> std::option::Option<&std::boxed::Box<crate::model::phone_number::ShortCode>> {
1350        #[allow(unreachable_patterns)]
1351        self.kind.as_ref().and_then(|v| match v {
1352            crate::model::phone_number::Kind::ShortCode(v) => std::option::Option::Some(v),
1353            _ => std::option::Option::None,
1354        })
1355    }
1356
1357    /// Sets the value of [kind][crate::model::PhoneNumber::kind]
1358    /// to hold a `ShortCode`.
1359    ///
1360    /// Note that all the setters affecting `kind` are
1361    /// mutually exclusive.
1362    ///
1363    /// # Example
1364    /// ```ignore,no_run
1365    /// # use google_cloud_type::model::PhoneNumber;
1366    /// use google_cloud_type::model::phone_number::ShortCode;
1367    /// let x = PhoneNumber::new().set_short_code(ShortCode::default()/* use setters */);
1368    /// assert!(x.short_code().is_some());
1369    /// assert!(x.e164_number().is_none());
1370    /// ```
1371    pub fn set_short_code<
1372        T: std::convert::Into<std::boxed::Box<crate::model::phone_number::ShortCode>>,
1373    >(
1374        mut self,
1375        v: T,
1376    ) -> Self {
1377        self.kind =
1378            std::option::Option::Some(crate::model::phone_number::Kind::ShortCode(v.into()));
1379        self
1380    }
1381}
1382
1383impl wkt::message::Message for PhoneNumber {
1384    fn typename() -> &'static str {
1385        "type.googleapis.com/google.type.PhoneNumber"
1386    }
1387}
1388
1389/// Defines additional types related to [PhoneNumber].
1390pub mod phone_number {
1391    #[allow(unused_imports)]
1392    use super::*;
1393
1394    /// An object representing a short code, which is a phone number that is
1395    /// typically much shorter than regular phone numbers and can be used to
1396    /// address messages in MMS and SMS systems, as well as for abbreviated dialing
1397    /// (e.g. "Text 611 to see how many minutes you have remaining on your plan.").
1398    ///
1399    /// Short codes are restricted to a region and are not internationally
1400    /// dialable, which means the same short code can exist in different regions,
1401    /// with different usage and pricing, even if those regions share the same
1402    /// country calling code (e.g. US and CA).
1403    #[derive(Clone, Default, PartialEq)]
1404    #[non_exhaustive]
1405    pub struct ShortCode {
1406        /// Required. The BCP-47 region code of the location where calls to this
1407        /// short code can be made, such as "US" and "BB".
1408        ///
1409        /// Reference(s):
1410        ///
1411        /// - <http://www.unicode.org/reports/tr35/#unicode_region_subtag>
1412        pub region_code: std::string::String,
1413
1414        /// Required. The short code digits, without a leading plus ('+') or country
1415        /// calling code, e.g. "611".
1416        pub number: std::string::String,
1417
1418        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1419    }
1420
1421    impl ShortCode {
1422        pub fn new() -> Self {
1423            std::default::Default::default()
1424        }
1425
1426        /// Sets the value of [region_code][crate::model::phone_number::ShortCode::region_code].
1427        ///
1428        /// # Example
1429        /// ```ignore,no_run
1430        /// # use google_cloud_type::model::phone_number::ShortCode;
1431        /// let x = ShortCode::new().set_region_code("example");
1432        /// ```
1433        pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1434            self.region_code = v.into();
1435            self
1436        }
1437
1438        /// Sets the value of [number][crate::model::phone_number::ShortCode::number].
1439        ///
1440        /// # Example
1441        /// ```ignore,no_run
1442        /// # use google_cloud_type::model::phone_number::ShortCode;
1443        /// let x = ShortCode::new().set_number("example");
1444        /// ```
1445        pub fn set_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1446            self.number = v.into();
1447            self
1448        }
1449    }
1450
1451    impl wkt::message::Message for ShortCode {
1452        fn typename() -> &'static str {
1453            "type.googleapis.com/google.type.PhoneNumber.ShortCode"
1454        }
1455    }
1456
1457    /// Required.  Either a regular number, or a short code.  New fields may be
1458    /// added to the oneof below in the future, so clients should ignore phone
1459    /// numbers for which none of the fields they coded against are set.
1460    #[derive(Clone, Debug, PartialEq)]
1461    #[non_exhaustive]
1462    pub enum Kind {
1463        /// The phone number, represented as a leading plus sign ('+'), followed by a
1464        /// phone number that uses a relaxed ITU E.164 format consisting of the
1465        /// country calling code (1 to 3 digits) and the subscriber number, with no
1466        /// additional spaces or formatting, e.g.:
1467        ///
1468        /// - correct: "+15552220123"
1469        /// - incorrect: "+1 (555) 222-01234 x123".
1470        ///
1471        /// The ITU E.164 format limits the latter to 12 digits, but in practice not
1472        /// all countries respect that, so we relax that restriction here.
1473        /// National-only numbers are not allowed.
1474        ///
1475        /// References:
1476        ///
1477        /// - <https://www.itu.int/rec/T-REC-E.164-201011-I>
1478        /// - <https://en.wikipedia.org/wiki/E.164>.
1479        /// - <https://en.wikipedia.org/wiki/List_of_country_calling_codes>
1480        E164Number(std::string::String),
1481        /// A short code.
1482        ///
1483        /// Reference(s):
1484        ///
1485        /// - <https://en.wikipedia.org/wiki/Short_code>
1486        ShortCode(std::boxed::Box<crate::model::phone_number::ShortCode>),
1487    }
1488}
1489
1490/// Represents a postal address, e.g. for postal delivery or payments addresses.
1491/// Given a postal address, a postal service can deliver items to a premise, P.O.
1492/// Box or similar.
1493/// It is not intended to model geographical locations (roads, towns,
1494/// mountains).
1495///
1496/// In typical usage an address would be created via user input or from importing
1497/// existing data, depending on the type of process.
1498///
1499/// Advice on address input / editing:
1500///
1501/// - Use an i18n-ready address widget such as
1502///   <https://github.com/google/libaddressinput>)
1503/// - Users should not be presented with UI elements for input or editing of
1504///   fields outside countries where that field is used.
1505///
1506/// For more guidance on how to use this schema, please see:
1507/// <https://support.google.com/business/answer/6397478>
1508#[derive(Clone, Default, PartialEq)]
1509#[non_exhaustive]
1510pub struct PostalAddress {
1511    /// The schema revision of the `PostalAddress`. This must be set to 0, which is
1512    /// the latest revision.
1513    ///
1514    /// All new revisions **must** be backward compatible with old revisions.
1515    pub revision: i32,
1516
1517    /// Required. CLDR region code of the country/region of the address. This
1518    /// is never inferred and it is up to the user to ensure the value is
1519    /// correct. See <http://cldr.unicode.org/> and
1520    /// <http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html>
1521    /// for details. Example: "CH" for Switzerland.
1522    pub region_code: std::string::String,
1523
1524    /// Optional. BCP-47 language code of the contents of this address (if
1525    /// known). This is often the UI language of the input form or is expected
1526    /// to match one of the languages used in the address' country/region, or their
1527    /// transliterated equivalents.
1528    /// This can affect formatting in certain countries, but is not critical
1529    /// to the correctness of the data and will never affect any validation or
1530    /// other non-formatting related operations.
1531    ///
1532    /// If this value is not known, it should be omitted (rather than specifying a
1533    /// possibly incorrect default).
1534    ///
1535    /// Examples: "zh-Hant", "ja", "ja-Latn", "en".
1536    pub language_code: std::string::String,
1537
1538    /// Optional. Postal code of the address. Not all countries use or require
1539    /// postal codes to be present, but where they are used, they may trigger
1540    /// additional validation with other parts of the address (e.g. state/zip
1541    /// validation in the U.S.A.).
1542    pub postal_code: std::string::String,
1543
1544    /// Optional. Additional, country-specific, sorting code. This is not used
1545    /// in most regions. Where it is used, the value is either a string like
1546    /// "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number
1547    /// alone, representing the "sector code" (Jamaica), "delivery area indicator"
1548    /// (Malawi) or "post office indicator" (e.g. Côte d'Ivoire).
1549    pub sorting_code: std::string::String,
1550
1551    /// Optional. Highest administrative subdivision which is used for postal
1552    /// addresses of a country or region.
1553    /// For example, this can be a state, a province, an oblast, or a prefecture.
1554    /// Specifically, for Spain this is the province and not the autonomous
1555    /// community (e.g. "Barcelona" and not "Catalonia").
1556    /// Many countries don't use an administrative area in postal addresses. E.g.
1557    /// in Switzerland this should be left unpopulated.
1558    pub administrative_area: std::string::String,
1559
1560    /// Optional. Generally refers to the city/town portion of the address.
1561    /// Examples: US city, IT comune, UK post town.
1562    /// In regions of the world where localities are not well defined or do not fit
1563    /// into this structure well, leave locality empty and use address_lines.
1564    pub locality: std::string::String,
1565
1566    /// Optional. Sublocality of the address.
1567    /// For example, this can be neighborhoods, boroughs, districts.
1568    pub sublocality: std::string::String,
1569
1570    /// Unstructured address lines describing the lower levels of an address.
1571    ///
1572    /// Because values in address_lines do not have type information and may
1573    /// sometimes contain multiple values in a single field (e.g.
1574    /// "Austin, TX"), it is important that the line order is clear. The order of
1575    /// address lines should be "envelope order" for the country/region of the
1576    /// address. In places where this can vary (e.g. Japan), address_language is
1577    /// used to make it explicit (e.g. "ja" for large-to-small ordering and
1578    /// "ja-Latn" or "en" for small-to-large). This way, the most specific line of
1579    /// an address can be selected based on the language.
1580    ///
1581    /// The minimum permitted structural representation of an address consists
1582    /// of a region_code with all remaining information placed in the
1583    /// address_lines. It would be possible to format such an address very
1584    /// approximately without geocoding, but no semantic reasoning could be
1585    /// made about any of the address components until it was at least
1586    /// partially resolved.
1587    ///
1588    /// Creating an address only containing a region_code and address_lines, and
1589    /// then geocoding is the recommended way to handle completely unstructured
1590    /// addresses (as opposed to guessing which parts of the address should be
1591    /// localities or administrative areas).
1592    pub address_lines: std::vec::Vec<std::string::String>,
1593
1594    /// Optional. The recipient at the address.
1595    /// This field may, under certain circumstances, contain multiline information.
1596    /// For example, it might contain "care of" information.
1597    pub recipients: std::vec::Vec<std::string::String>,
1598
1599    /// Optional. The name of the organization at the address.
1600    pub organization: std::string::String,
1601
1602    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl PostalAddress {
1606    pub fn new() -> Self {
1607        std::default::Default::default()
1608    }
1609
1610    /// Sets the value of [revision][crate::model::PostalAddress::revision].
1611    ///
1612    /// # Example
1613    /// ```ignore,no_run
1614    /// # use google_cloud_type::model::PostalAddress;
1615    /// let x = PostalAddress::new().set_revision(42);
1616    /// ```
1617    pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1618        self.revision = v.into();
1619        self
1620    }
1621
1622    /// Sets the value of [region_code][crate::model::PostalAddress::region_code].
1623    ///
1624    /// # Example
1625    /// ```ignore,no_run
1626    /// # use google_cloud_type::model::PostalAddress;
1627    /// let x = PostalAddress::new().set_region_code("example");
1628    /// ```
1629    pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1630        self.region_code = v.into();
1631        self
1632    }
1633
1634    /// Sets the value of [language_code][crate::model::PostalAddress::language_code].
1635    ///
1636    /// # Example
1637    /// ```ignore,no_run
1638    /// # use google_cloud_type::model::PostalAddress;
1639    /// let x = PostalAddress::new().set_language_code("example");
1640    /// ```
1641    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1642        self.language_code = v.into();
1643        self
1644    }
1645
1646    /// Sets the value of [postal_code][crate::model::PostalAddress::postal_code].
1647    ///
1648    /// # Example
1649    /// ```ignore,no_run
1650    /// # use google_cloud_type::model::PostalAddress;
1651    /// let x = PostalAddress::new().set_postal_code("example");
1652    /// ```
1653    pub fn set_postal_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654        self.postal_code = v.into();
1655        self
1656    }
1657
1658    /// Sets the value of [sorting_code][crate::model::PostalAddress::sorting_code].
1659    ///
1660    /// # Example
1661    /// ```ignore,no_run
1662    /// # use google_cloud_type::model::PostalAddress;
1663    /// let x = PostalAddress::new().set_sorting_code("example");
1664    /// ```
1665    pub fn set_sorting_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1666        self.sorting_code = v.into();
1667        self
1668    }
1669
1670    /// Sets the value of [administrative_area][crate::model::PostalAddress::administrative_area].
1671    ///
1672    /// # Example
1673    /// ```ignore,no_run
1674    /// # use google_cloud_type::model::PostalAddress;
1675    /// let x = PostalAddress::new().set_administrative_area("example");
1676    /// ```
1677    pub fn set_administrative_area<T: std::convert::Into<std::string::String>>(
1678        mut self,
1679        v: T,
1680    ) -> Self {
1681        self.administrative_area = v.into();
1682        self
1683    }
1684
1685    /// Sets the value of [locality][crate::model::PostalAddress::locality].
1686    ///
1687    /// # Example
1688    /// ```ignore,no_run
1689    /// # use google_cloud_type::model::PostalAddress;
1690    /// let x = PostalAddress::new().set_locality("example");
1691    /// ```
1692    pub fn set_locality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1693        self.locality = v.into();
1694        self
1695    }
1696
1697    /// Sets the value of [sublocality][crate::model::PostalAddress::sublocality].
1698    ///
1699    /// # Example
1700    /// ```ignore,no_run
1701    /// # use google_cloud_type::model::PostalAddress;
1702    /// let x = PostalAddress::new().set_sublocality("example");
1703    /// ```
1704    pub fn set_sublocality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1705        self.sublocality = v.into();
1706        self
1707    }
1708
1709    /// Sets the value of [address_lines][crate::model::PostalAddress::address_lines].
1710    ///
1711    /// # Example
1712    /// ```ignore,no_run
1713    /// # use google_cloud_type::model::PostalAddress;
1714    /// let x = PostalAddress::new().set_address_lines(["a", "b", "c"]);
1715    /// ```
1716    pub fn set_address_lines<T, V>(mut self, v: T) -> Self
1717    where
1718        T: std::iter::IntoIterator<Item = V>,
1719        V: std::convert::Into<std::string::String>,
1720    {
1721        use std::iter::Iterator;
1722        self.address_lines = v.into_iter().map(|i| i.into()).collect();
1723        self
1724    }
1725
1726    /// Sets the value of [recipients][crate::model::PostalAddress::recipients].
1727    ///
1728    /// # Example
1729    /// ```ignore,no_run
1730    /// # use google_cloud_type::model::PostalAddress;
1731    /// let x = PostalAddress::new().set_recipients(["a", "b", "c"]);
1732    /// ```
1733    pub fn set_recipients<T, V>(mut self, v: T) -> Self
1734    where
1735        T: std::iter::IntoIterator<Item = V>,
1736        V: std::convert::Into<std::string::String>,
1737    {
1738        use std::iter::Iterator;
1739        self.recipients = v.into_iter().map(|i| i.into()).collect();
1740        self
1741    }
1742
1743    /// Sets the value of [organization][crate::model::PostalAddress::organization].
1744    ///
1745    /// # Example
1746    /// ```ignore,no_run
1747    /// # use google_cloud_type::model::PostalAddress;
1748    /// let x = PostalAddress::new().set_organization("example");
1749    /// ```
1750    pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1751        self.organization = v.into();
1752        self
1753    }
1754}
1755
1756impl wkt::message::Message for PostalAddress {
1757    fn typename() -> &'static str {
1758        "type.googleapis.com/google.type.PostalAddress"
1759    }
1760}
1761
1762/// A quaternion is defined as the quotient of two directed lines in a
1763/// three-dimensional space or equivalently as the quotient of two Euclidean
1764/// vectors (<https://en.wikipedia.org/wiki/Quaternion>).
1765///
1766/// Quaternions are often used in calculations involving three-dimensional
1767/// rotations (<https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>),
1768/// as they provide greater mathematical robustness by avoiding the gimbal lock
1769/// problems that can be encountered when using Euler angles
1770/// (<https://en.wikipedia.org/wiki/Gimbal_lock>).
1771///
1772/// Quaternions are generally represented in this form:
1773///
1774/// ```norust
1775/// w + xi + yj + zk
1776/// ```
1777///
1778/// where x, y, z, and w are real numbers, and i, j, and k are three imaginary
1779/// numbers.
1780///
1781/// Our naming choice `(x, y, z, w)` comes from the desire to avoid confusion for
1782/// those interested in the geometric properties of the quaternion in the 3D
1783/// Cartesian space. Other texts often use alternative names or subscripts, such
1784/// as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps
1785/// better suited for mathematical interpretations.
1786///
1787/// To avoid any confusion, as well as to maintain compatibility with a large
1788/// number of software libraries, the quaternions represented using the protocol
1789/// buffer below *must* follow the Hamilton convention, which defines `ij = k`
1790/// (i.e. a right-handed algebra), and therefore:
1791///
1792/// ```norust
1793/// i^2 = j^2 = k^2 = ijk = −1
1794/// ij = −ji = k
1795/// jk = −kj = i
1796/// ki = −ik = j
1797/// ```
1798///
1799/// Please DO NOT use this to represent quaternions that follow the JPL
1800/// convention, or any of the other quaternion flavors out there.
1801///
1802/// Definitions:
1803///
1804/// - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`.
1805/// - Unit (or normalized) quaternion: a quaternion whose norm is 1.
1806/// - Pure quaternion: a quaternion whose scalar component (`w`) is 0.
1807/// - Rotation quaternion: a unit quaternion used to represent rotation.
1808/// - Orientation quaternion: a unit quaternion used to represent orientation.
1809///
1810/// A quaternion can be normalized by dividing it by its norm. The resulting
1811/// quaternion maintains the same direction, but has a norm of 1, i.e. it moves
1812/// on the unit sphere. This is generally necessary for rotation and orientation
1813/// quaternions, to avoid rounding errors:
1814/// <https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions>
1815///
1816/// Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation,
1817/// but normalization would be even more useful, e.g. for comparison purposes, if
1818/// it would produce a unique representation. It is thus recommended that `w` be
1819/// kept positive, which can be achieved by changing all the signs when `w` is
1820/// negative.
1821#[derive(Clone, Default, PartialEq)]
1822#[non_exhaustive]
1823pub struct Quaternion {
1824    /// The x component.
1825    pub x: f64,
1826
1827    /// The y component.
1828    pub y: f64,
1829
1830    /// The z component.
1831    pub z: f64,
1832
1833    /// The scalar component.
1834    pub w: f64,
1835
1836    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1837}
1838
1839impl Quaternion {
1840    pub fn new() -> Self {
1841        std::default::Default::default()
1842    }
1843
1844    /// Sets the value of [x][crate::model::Quaternion::x].
1845    ///
1846    /// # Example
1847    /// ```ignore,no_run
1848    /// # use google_cloud_type::model::Quaternion;
1849    /// let x = Quaternion::new().set_x(42.0);
1850    /// ```
1851    pub fn set_x<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1852        self.x = v.into();
1853        self
1854    }
1855
1856    /// Sets the value of [y][crate::model::Quaternion::y].
1857    ///
1858    /// # Example
1859    /// ```ignore,no_run
1860    /// # use google_cloud_type::model::Quaternion;
1861    /// let x = Quaternion::new().set_y(42.0);
1862    /// ```
1863    pub fn set_y<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1864        self.y = v.into();
1865        self
1866    }
1867
1868    /// Sets the value of [z][crate::model::Quaternion::z].
1869    ///
1870    /// # Example
1871    /// ```ignore,no_run
1872    /// # use google_cloud_type::model::Quaternion;
1873    /// let x = Quaternion::new().set_z(42.0);
1874    /// ```
1875    pub fn set_z<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1876        self.z = v.into();
1877        self
1878    }
1879
1880    /// Sets the value of [w][crate::model::Quaternion::w].
1881    ///
1882    /// # Example
1883    /// ```ignore,no_run
1884    /// # use google_cloud_type::model::Quaternion;
1885    /// let x = Quaternion::new().set_w(42.0);
1886    /// ```
1887    pub fn set_w<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1888        self.w = v.into();
1889        self
1890    }
1891}
1892
1893impl wkt::message::Message for Quaternion {
1894    fn typename() -> &'static str {
1895        "type.googleapis.com/google.type.Quaternion"
1896    }
1897}
1898
1899/// Represents a time of day. The date and time zone are either not significant
1900/// or are specified elsewhere. An API may choose to allow leap seconds. Related
1901/// types are [google.type.Date][google.type.Date] and
1902/// `google.protobuf.Timestamp`.
1903///
1904/// [google.type.Date]: crate::model::Date
1905#[derive(Clone, Default, PartialEq)]
1906#[non_exhaustive]
1907pub struct TimeOfDay {
1908    /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
1909    /// to allow the value "24:00:00" for scenarios like business closing time.
1910    pub hours: i32,
1911
1912    /// Minutes of hour of day. Must be from 0 to 59.
1913    pub minutes: i32,
1914
1915    /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may
1916    /// allow the value 60 if it allows leap-seconds.
1917    pub seconds: i32,
1918
1919    /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
1920    pub nanos: i32,
1921
1922    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1923}
1924
1925impl TimeOfDay {
1926    pub fn new() -> Self {
1927        std::default::Default::default()
1928    }
1929
1930    /// Sets the value of [hours][crate::model::TimeOfDay::hours].
1931    ///
1932    /// # Example
1933    /// ```ignore,no_run
1934    /// # use google_cloud_type::model::TimeOfDay;
1935    /// let x = TimeOfDay::new().set_hours(42);
1936    /// ```
1937    pub fn set_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1938        self.hours = v.into();
1939        self
1940    }
1941
1942    /// Sets the value of [minutes][crate::model::TimeOfDay::minutes].
1943    ///
1944    /// # Example
1945    /// ```ignore,no_run
1946    /// # use google_cloud_type::model::TimeOfDay;
1947    /// let x = TimeOfDay::new().set_minutes(42);
1948    /// ```
1949    pub fn set_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1950        self.minutes = v.into();
1951        self
1952    }
1953
1954    /// Sets the value of [seconds][crate::model::TimeOfDay::seconds].
1955    ///
1956    /// # Example
1957    /// ```ignore,no_run
1958    /// # use google_cloud_type::model::TimeOfDay;
1959    /// let x = TimeOfDay::new().set_seconds(42);
1960    /// ```
1961    pub fn set_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1962        self.seconds = v.into();
1963        self
1964    }
1965
1966    /// Sets the value of [nanos][crate::model::TimeOfDay::nanos].
1967    ///
1968    /// # Example
1969    /// ```ignore,no_run
1970    /// # use google_cloud_type::model::TimeOfDay;
1971    /// let x = TimeOfDay::new().set_nanos(42);
1972    /// ```
1973    pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1974        self.nanos = v.into();
1975        self
1976    }
1977}
1978
1979impl wkt::message::Message for TimeOfDay {
1980    fn typename() -> &'static str {
1981        "type.googleapis.com/google.type.TimeOfDay"
1982    }
1983}
1984
1985/// A `CalendarPeriod` represents the abstract concept of a time period that has
1986/// a canonical start. Grammatically, "the start of the current
1987/// `CalendarPeriod`." All calendar times begin at midnight UTC.
1988///
1989/// # Working with unknown values
1990///
1991/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1992/// additional enum variants at any time. Adding new variants is not considered
1993/// a breaking change. Applications should write their code in anticipation of:
1994///
1995/// - New values appearing in future releases of the client library, **and**
1996/// - New values received dynamically, without application changes.
1997///
1998/// Please consult the [Working with enums] section in the user guide for some
1999/// guidelines.
2000///
2001/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2002#[derive(Clone, Debug, PartialEq)]
2003#[non_exhaustive]
2004pub enum CalendarPeriod {
2005    /// Undefined period, raises an error.
2006    Unspecified,
2007    /// A day.
2008    Day,
2009    /// A week. Weeks begin on Monday, following
2010    /// [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date).
2011    Week,
2012    /// A fortnight. The first calendar fortnight of the year begins at the start
2013    /// of week 1 according to
2014    /// [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date).
2015    Fortnight,
2016    /// A month.
2017    Month,
2018    /// A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each
2019    /// year.
2020    Quarter,
2021    /// A half-year. Half-years start on dates 1-Jan and 1-Jul.
2022    Half,
2023    /// A year.
2024    Year,
2025    /// If set, the enum was initialized with an unknown value.
2026    ///
2027    /// Applications can examine the value using [CalendarPeriod::value] or
2028    /// [CalendarPeriod::name].
2029    UnknownValue(calendar_period::UnknownValue),
2030}
2031
2032#[doc(hidden)]
2033pub mod calendar_period {
2034    #[allow(unused_imports)]
2035    use super::*;
2036    #[derive(Clone, Debug, PartialEq)]
2037    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2038}
2039
2040impl CalendarPeriod {
2041    /// Gets the enum value.
2042    ///
2043    /// Returns `None` if the enum contains an unknown value deserialized from
2044    /// the string representation of enums.
2045    pub fn value(&self) -> std::option::Option<i32> {
2046        match self {
2047            Self::Unspecified => std::option::Option::Some(0),
2048            Self::Day => std::option::Option::Some(1),
2049            Self::Week => std::option::Option::Some(2),
2050            Self::Fortnight => std::option::Option::Some(3),
2051            Self::Month => std::option::Option::Some(4),
2052            Self::Quarter => std::option::Option::Some(5),
2053            Self::Half => std::option::Option::Some(6),
2054            Self::Year => std::option::Option::Some(7),
2055            Self::UnknownValue(u) => u.0.value(),
2056        }
2057    }
2058
2059    /// Gets the enum value as a string.
2060    ///
2061    /// Returns `None` if the enum contains an unknown value deserialized from
2062    /// the integer representation of enums.
2063    pub fn name(&self) -> std::option::Option<&str> {
2064        match self {
2065            Self::Unspecified => std::option::Option::Some("CALENDAR_PERIOD_UNSPECIFIED"),
2066            Self::Day => std::option::Option::Some("DAY"),
2067            Self::Week => std::option::Option::Some("WEEK"),
2068            Self::Fortnight => std::option::Option::Some("FORTNIGHT"),
2069            Self::Month => std::option::Option::Some("MONTH"),
2070            Self::Quarter => std::option::Option::Some("QUARTER"),
2071            Self::Half => std::option::Option::Some("HALF"),
2072            Self::Year => std::option::Option::Some("YEAR"),
2073            Self::UnknownValue(u) => u.0.name(),
2074        }
2075    }
2076}
2077
2078impl std::default::Default for CalendarPeriod {
2079    fn default() -> Self {
2080        use std::convert::From;
2081        Self::from(0)
2082    }
2083}
2084
2085impl std::fmt::Display for CalendarPeriod {
2086    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2087        wkt::internal::display_enum(f, self.name(), self.value())
2088    }
2089}
2090
2091impl std::convert::From<i32> for CalendarPeriod {
2092    fn from(value: i32) -> Self {
2093        match value {
2094            0 => Self::Unspecified,
2095            1 => Self::Day,
2096            2 => Self::Week,
2097            3 => Self::Fortnight,
2098            4 => Self::Month,
2099            5 => Self::Quarter,
2100            6 => Self::Half,
2101            7 => Self::Year,
2102            _ => Self::UnknownValue(calendar_period::UnknownValue(
2103                wkt::internal::UnknownEnumValue::Integer(value),
2104            )),
2105        }
2106    }
2107}
2108
2109impl std::convert::From<&str> for CalendarPeriod {
2110    fn from(value: &str) -> Self {
2111        use std::string::ToString;
2112        match value {
2113            "CALENDAR_PERIOD_UNSPECIFIED" => Self::Unspecified,
2114            "DAY" => Self::Day,
2115            "WEEK" => Self::Week,
2116            "FORTNIGHT" => Self::Fortnight,
2117            "MONTH" => Self::Month,
2118            "QUARTER" => Self::Quarter,
2119            "HALF" => Self::Half,
2120            "YEAR" => Self::Year,
2121            _ => Self::UnknownValue(calendar_period::UnknownValue(
2122                wkt::internal::UnknownEnumValue::String(value.to_string()),
2123            )),
2124        }
2125    }
2126}
2127
2128impl serde::ser::Serialize for CalendarPeriod {
2129    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2130    where
2131        S: serde::Serializer,
2132    {
2133        match self {
2134            Self::Unspecified => serializer.serialize_i32(0),
2135            Self::Day => serializer.serialize_i32(1),
2136            Self::Week => serializer.serialize_i32(2),
2137            Self::Fortnight => serializer.serialize_i32(3),
2138            Self::Month => serializer.serialize_i32(4),
2139            Self::Quarter => serializer.serialize_i32(5),
2140            Self::Half => serializer.serialize_i32(6),
2141            Self::Year => serializer.serialize_i32(7),
2142            Self::UnknownValue(u) => u.0.serialize(serializer),
2143        }
2144    }
2145}
2146
2147impl<'de> serde::de::Deserialize<'de> for CalendarPeriod {
2148    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2149    where
2150        D: serde::Deserializer<'de>,
2151    {
2152        deserializer.deserialize_any(wkt::internal::EnumVisitor::<CalendarPeriod>::new(
2153            ".google.type.CalendarPeriod",
2154        ))
2155    }
2156}
2157
2158/// Represents a day of the week.
2159///
2160/// # Working with unknown values
2161///
2162/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2163/// additional enum variants at any time. Adding new variants is not considered
2164/// a breaking change. Applications should write their code in anticipation of:
2165///
2166/// - New values appearing in future releases of the client library, **and**
2167/// - New values received dynamically, without application changes.
2168///
2169/// Please consult the [Working with enums] section in the user guide for some
2170/// guidelines.
2171///
2172/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2173#[derive(Clone, Debug, PartialEq)]
2174#[non_exhaustive]
2175pub enum DayOfWeek {
2176    /// The day of the week is unspecified.
2177    Unspecified,
2178    /// Monday
2179    Monday,
2180    /// Tuesday
2181    Tuesday,
2182    /// Wednesday
2183    Wednesday,
2184    /// Thursday
2185    Thursday,
2186    /// Friday
2187    Friday,
2188    /// Saturday
2189    Saturday,
2190    /// Sunday
2191    Sunday,
2192    /// If set, the enum was initialized with an unknown value.
2193    ///
2194    /// Applications can examine the value using [DayOfWeek::value] or
2195    /// [DayOfWeek::name].
2196    UnknownValue(day_of_week::UnknownValue),
2197}
2198
2199#[doc(hidden)]
2200pub mod day_of_week {
2201    #[allow(unused_imports)]
2202    use super::*;
2203    #[derive(Clone, Debug, PartialEq)]
2204    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2205}
2206
2207impl DayOfWeek {
2208    /// Gets the enum value.
2209    ///
2210    /// Returns `None` if the enum contains an unknown value deserialized from
2211    /// the string representation of enums.
2212    pub fn value(&self) -> std::option::Option<i32> {
2213        match self {
2214            Self::Unspecified => std::option::Option::Some(0),
2215            Self::Monday => std::option::Option::Some(1),
2216            Self::Tuesday => std::option::Option::Some(2),
2217            Self::Wednesday => std::option::Option::Some(3),
2218            Self::Thursday => std::option::Option::Some(4),
2219            Self::Friday => std::option::Option::Some(5),
2220            Self::Saturday => std::option::Option::Some(6),
2221            Self::Sunday => std::option::Option::Some(7),
2222            Self::UnknownValue(u) => u.0.value(),
2223        }
2224    }
2225
2226    /// Gets the enum value as a string.
2227    ///
2228    /// Returns `None` if the enum contains an unknown value deserialized from
2229    /// the integer representation of enums.
2230    pub fn name(&self) -> std::option::Option<&str> {
2231        match self {
2232            Self::Unspecified => std::option::Option::Some("DAY_OF_WEEK_UNSPECIFIED"),
2233            Self::Monday => std::option::Option::Some("MONDAY"),
2234            Self::Tuesday => std::option::Option::Some("TUESDAY"),
2235            Self::Wednesday => std::option::Option::Some("WEDNESDAY"),
2236            Self::Thursday => std::option::Option::Some("THURSDAY"),
2237            Self::Friday => std::option::Option::Some("FRIDAY"),
2238            Self::Saturday => std::option::Option::Some("SATURDAY"),
2239            Self::Sunday => std::option::Option::Some("SUNDAY"),
2240            Self::UnknownValue(u) => u.0.name(),
2241        }
2242    }
2243}
2244
2245impl std::default::Default for DayOfWeek {
2246    fn default() -> Self {
2247        use std::convert::From;
2248        Self::from(0)
2249    }
2250}
2251
2252impl std::fmt::Display for DayOfWeek {
2253    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2254        wkt::internal::display_enum(f, self.name(), self.value())
2255    }
2256}
2257
2258impl std::convert::From<i32> for DayOfWeek {
2259    fn from(value: i32) -> Self {
2260        match value {
2261            0 => Self::Unspecified,
2262            1 => Self::Monday,
2263            2 => Self::Tuesday,
2264            3 => Self::Wednesday,
2265            4 => Self::Thursday,
2266            5 => Self::Friday,
2267            6 => Self::Saturday,
2268            7 => Self::Sunday,
2269            _ => Self::UnknownValue(day_of_week::UnknownValue(
2270                wkt::internal::UnknownEnumValue::Integer(value),
2271            )),
2272        }
2273    }
2274}
2275
2276impl std::convert::From<&str> for DayOfWeek {
2277    fn from(value: &str) -> Self {
2278        use std::string::ToString;
2279        match value {
2280            "DAY_OF_WEEK_UNSPECIFIED" => Self::Unspecified,
2281            "MONDAY" => Self::Monday,
2282            "TUESDAY" => Self::Tuesday,
2283            "WEDNESDAY" => Self::Wednesday,
2284            "THURSDAY" => Self::Thursday,
2285            "FRIDAY" => Self::Friday,
2286            "SATURDAY" => Self::Saturday,
2287            "SUNDAY" => Self::Sunday,
2288            _ => Self::UnknownValue(day_of_week::UnknownValue(
2289                wkt::internal::UnknownEnumValue::String(value.to_string()),
2290            )),
2291        }
2292    }
2293}
2294
2295impl serde::ser::Serialize for DayOfWeek {
2296    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2297    where
2298        S: serde::Serializer,
2299    {
2300        match self {
2301            Self::Unspecified => serializer.serialize_i32(0),
2302            Self::Monday => serializer.serialize_i32(1),
2303            Self::Tuesday => serializer.serialize_i32(2),
2304            Self::Wednesday => serializer.serialize_i32(3),
2305            Self::Thursday => serializer.serialize_i32(4),
2306            Self::Friday => serializer.serialize_i32(5),
2307            Self::Saturday => serializer.serialize_i32(6),
2308            Self::Sunday => serializer.serialize_i32(7),
2309            Self::UnknownValue(u) => u.0.serialize(serializer),
2310        }
2311    }
2312}
2313
2314impl<'de> serde::de::Deserialize<'de> for DayOfWeek {
2315    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2316    where
2317        D: serde::Deserializer<'de>,
2318    {
2319        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DayOfWeek>::new(
2320            ".google.type.DayOfWeek",
2321        ))
2322    }
2323}
2324
2325/// Represents a month in the Gregorian calendar.
2326///
2327/// # Working with unknown values
2328///
2329/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2330/// additional enum variants at any time. Adding new variants is not considered
2331/// a breaking change. Applications should write their code in anticipation of:
2332///
2333/// - New values appearing in future releases of the client library, **and**
2334/// - New values received dynamically, without application changes.
2335///
2336/// Please consult the [Working with enums] section in the user guide for some
2337/// guidelines.
2338///
2339/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2340#[derive(Clone, Debug, PartialEq)]
2341#[non_exhaustive]
2342pub enum Month {
2343    /// The unspecified month.
2344    Unspecified,
2345    /// The month of January.
2346    January,
2347    /// The month of February.
2348    February,
2349    /// The month of March.
2350    March,
2351    /// The month of April.
2352    April,
2353    /// The month of May.
2354    May,
2355    /// The month of June.
2356    June,
2357    /// The month of July.
2358    July,
2359    /// The month of August.
2360    August,
2361    /// The month of September.
2362    September,
2363    /// The month of October.
2364    October,
2365    /// The month of November.
2366    November,
2367    /// The month of December.
2368    December,
2369    /// If set, the enum was initialized with an unknown value.
2370    ///
2371    /// Applications can examine the value using [Month::value] or
2372    /// [Month::name].
2373    UnknownValue(month::UnknownValue),
2374}
2375
2376#[doc(hidden)]
2377pub mod month {
2378    #[allow(unused_imports)]
2379    use super::*;
2380    #[derive(Clone, Debug, PartialEq)]
2381    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2382}
2383
2384impl Month {
2385    /// Gets the enum value.
2386    ///
2387    /// Returns `None` if the enum contains an unknown value deserialized from
2388    /// the string representation of enums.
2389    pub fn value(&self) -> std::option::Option<i32> {
2390        match self {
2391            Self::Unspecified => std::option::Option::Some(0),
2392            Self::January => std::option::Option::Some(1),
2393            Self::February => std::option::Option::Some(2),
2394            Self::March => std::option::Option::Some(3),
2395            Self::April => std::option::Option::Some(4),
2396            Self::May => std::option::Option::Some(5),
2397            Self::June => std::option::Option::Some(6),
2398            Self::July => std::option::Option::Some(7),
2399            Self::August => std::option::Option::Some(8),
2400            Self::September => std::option::Option::Some(9),
2401            Self::October => std::option::Option::Some(10),
2402            Self::November => std::option::Option::Some(11),
2403            Self::December => std::option::Option::Some(12),
2404            Self::UnknownValue(u) => u.0.value(),
2405        }
2406    }
2407
2408    /// Gets the enum value as a string.
2409    ///
2410    /// Returns `None` if the enum contains an unknown value deserialized from
2411    /// the integer representation of enums.
2412    pub fn name(&self) -> std::option::Option<&str> {
2413        match self {
2414            Self::Unspecified => std::option::Option::Some("MONTH_UNSPECIFIED"),
2415            Self::January => std::option::Option::Some("JANUARY"),
2416            Self::February => std::option::Option::Some("FEBRUARY"),
2417            Self::March => std::option::Option::Some("MARCH"),
2418            Self::April => std::option::Option::Some("APRIL"),
2419            Self::May => std::option::Option::Some("MAY"),
2420            Self::June => std::option::Option::Some("JUNE"),
2421            Self::July => std::option::Option::Some("JULY"),
2422            Self::August => std::option::Option::Some("AUGUST"),
2423            Self::September => std::option::Option::Some("SEPTEMBER"),
2424            Self::October => std::option::Option::Some("OCTOBER"),
2425            Self::November => std::option::Option::Some("NOVEMBER"),
2426            Self::December => std::option::Option::Some("DECEMBER"),
2427            Self::UnknownValue(u) => u.0.name(),
2428        }
2429    }
2430}
2431
2432impl std::default::Default for Month {
2433    fn default() -> Self {
2434        use std::convert::From;
2435        Self::from(0)
2436    }
2437}
2438
2439impl std::fmt::Display for Month {
2440    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2441        wkt::internal::display_enum(f, self.name(), self.value())
2442    }
2443}
2444
2445impl std::convert::From<i32> for Month {
2446    fn from(value: i32) -> Self {
2447        match value {
2448            0 => Self::Unspecified,
2449            1 => Self::January,
2450            2 => Self::February,
2451            3 => Self::March,
2452            4 => Self::April,
2453            5 => Self::May,
2454            6 => Self::June,
2455            7 => Self::July,
2456            8 => Self::August,
2457            9 => Self::September,
2458            10 => Self::October,
2459            11 => Self::November,
2460            12 => Self::December,
2461            _ => Self::UnknownValue(month::UnknownValue(
2462                wkt::internal::UnknownEnumValue::Integer(value),
2463            )),
2464        }
2465    }
2466}
2467
2468impl std::convert::From<&str> for Month {
2469    fn from(value: &str) -> Self {
2470        use std::string::ToString;
2471        match value {
2472            "MONTH_UNSPECIFIED" => Self::Unspecified,
2473            "JANUARY" => Self::January,
2474            "FEBRUARY" => Self::February,
2475            "MARCH" => Self::March,
2476            "APRIL" => Self::April,
2477            "MAY" => Self::May,
2478            "JUNE" => Self::June,
2479            "JULY" => Self::July,
2480            "AUGUST" => Self::August,
2481            "SEPTEMBER" => Self::September,
2482            "OCTOBER" => Self::October,
2483            "NOVEMBER" => Self::November,
2484            "DECEMBER" => Self::December,
2485            _ => Self::UnknownValue(month::UnknownValue(
2486                wkt::internal::UnknownEnumValue::String(value.to_string()),
2487            )),
2488        }
2489    }
2490}
2491
2492impl serde::ser::Serialize for Month {
2493    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2494    where
2495        S: serde::Serializer,
2496    {
2497        match self {
2498            Self::Unspecified => serializer.serialize_i32(0),
2499            Self::January => serializer.serialize_i32(1),
2500            Self::February => serializer.serialize_i32(2),
2501            Self::March => serializer.serialize_i32(3),
2502            Self::April => serializer.serialize_i32(4),
2503            Self::May => serializer.serialize_i32(5),
2504            Self::June => serializer.serialize_i32(6),
2505            Self::July => serializer.serialize_i32(7),
2506            Self::August => serializer.serialize_i32(8),
2507            Self::September => serializer.serialize_i32(9),
2508            Self::October => serializer.serialize_i32(10),
2509            Self::November => serializer.serialize_i32(11),
2510            Self::December => serializer.serialize_i32(12),
2511            Self::UnknownValue(u) => u.0.serialize(serializer),
2512        }
2513    }
2514}
2515
2516impl<'de> serde::de::Deserialize<'de> for Month {
2517    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2518    where
2519        D: serde::Deserializer<'de>,
2520    {
2521        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Month>::new(
2522            ".google.type.Month",
2523        ))
2524    }
2525}