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