Skip to main content

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