google_cloud_type/
model.rs

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