Skip to main content

polyester/gen/buffa/
triggers.v1.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2
3/// =============================================================================
4/// Trigger Types and Status
5/// =============================================================================
6///
7/// TriggerType defines the category of standalone trigger.
8#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
9#[repr(i32)]
10pub enum TriggerType {
11    /// Trigger type was not provided.
12    TRIGGER_TYPE_UNSPECIFIED = 0i32,
13    /// Stop-loss: fires when the price crosses a threshold.
14    STOP_LOSS = 1i32,
15    /// Take-profit: fires when the price crosses a threshold.
16    TAKE_PROFIT = 2i32,
17    /// Trailing stop: dynamic stop that trails price by a distance.
18    TRAILING_STOP = 3i32,
19    /// TWAP: Time-Weighted Average Price execution over a duration.
20    TWAP = 4i32,
21    /// Ladder/Scaled: Multiple orders placed across a price range.
22    LADDER = 5i32,
23}
24impl TriggerType {
25    ///Idiomatic alias for [`Self::TRIGGER_TYPE_UNSPECIFIED`]; `Debug` prints the variant name.
26    #[allow(non_upper_case_globals)]
27    pub const TriggerTypeUnspecified: Self = Self::TRIGGER_TYPE_UNSPECIFIED;
28    ///Idiomatic alias for [`Self::STOP_LOSS`]; `Debug` prints the variant name.
29    #[allow(non_upper_case_globals)]
30    pub const StopLoss: Self = Self::STOP_LOSS;
31    ///Idiomatic alias for [`Self::TAKE_PROFIT`]; `Debug` prints the variant name.
32    #[allow(non_upper_case_globals)]
33    pub const TakeProfit: Self = Self::TAKE_PROFIT;
34    ///Idiomatic alias for [`Self::TRAILING_STOP`]; `Debug` prints the variant name.
35    #[allow(non_upper_case_globals)]
36    pub const TrailingStop: Self = Self::TRAILING_STOP;
37    ///Idiomatic alias for [`Self::TWAP`]; `Debug` prints the variant name.
38    #[allow(non_upper_case_globals)]
39    pub const Twap: Self = Self::TWAP;
40    ///Idiomatic alias for [`Self::LADDER`]; `Debug` prints the variant name.
41    #[allow(non_upper_case_globals)]
42    pub const Ladder: Self = Self::LADDER;
43}
44impl ::core::default::Default for TriggerType {
45    fn default() -> Self {
46        Self::TRIGGER_TYPE_UNSPECIFIED
47    }
48}
49impl ::serde::Serialize for TriggerType {
50    fn serialize<S: ::serde::Serializer>(
51        &self,
52        s: S,
53    ) -> ::core::result::Result<S::Ok, S::Error> {
54        s.serialize_str(::buffa::Enumeration::proto_name(self))
55    }
56}
57impl<'de> ::serde::Deserialize<'de> for TriggerType {
58    fn deserialize<D: ::serde::Deserializer<'de>>(
59        d: D,
60    ) -> ::core::result::Result<Self, D::Error> {
61        struct _V;
62        impl ::serde::de::Visitor<'_> for _V {
63            type Value = TriggerType;
64            fn expecting(
65                &self,
66                f: &mut ::core::fmt::Formatter<'_>,
67            ) -> ::core::fmt::Result {
68                f.write_str(
69                    concat!("a string, integer, or null for ", stringify!(TriggerType)),
70                )
71            }
72            fn visit_str<E: ::serde::de::Error>(
73                self,
74                v: &str,
75            ) -> ::core::result::Result<TriggerType, E> {
76                <TriggerType as ::buffa::Enumeration>::from_proto_name(v)
77                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
78            }
79            fn visit_i64<E: ::serde::de::Error>(
80                self,
81                v: i64,
82            ) -> ::core::result::Result<TriggerType, E> {
83                let v32 = i32::try_from(v)
84                    .map_err(|_| {
85                        ::serde::de::Error::custom(
86                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
87                        )
88                    })?;
89                <TriggerType as ::buffa::Enumeration>::from_i32(v32)
90                    .ok_or_else(|| {
91                        ::serde::de::Error::custom(
92                            ::buffa::alloc::format!("unknown enum value {v32}"),
93                        )
94                    })
95            }
96            fn visit_u64<E: ::serde::de::Error>(
97                self,
98                v: u64,
99            ) -> ::core::result::Result<TriggerType, E> {
100                let v32 = i32::try_from(v)
101                    .map_err(|_| {
102                        ::serde::de::Error::custom(
103                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
104                        )
105                    })?;
106                <TriggerType as ::buffa::Enumeration>::from_i32(v32)
107                    .ok_or_else(|| {
108                        ::serde::de::Error::custom(
109                            ::buffa::alloc::format!("unknown enum value {v32}"),
110                        )
111                    })
112            }
113            fn visit_unit<E: ::serde::de::Error>(
114                self,
115            ) -> ::core::result::Result<TriggerType, E> {
116                ::core::result::Result::Ok(::core::default::Default::default())
117            }
118        }
119        d.deserialize_any(_V)
120    }
121}
122impl ::buffa::json_helpers::ProtoElemJson for TriggerType {
123    fn serialize_proto_json<S: ::serde::Serializer>(
124        v: &Self,
125        s: S,
126    ) -> ::core::result::Result<S::Ok, S::Error> {
127        ::serde::Serialize::serialize(v, s)
128    }
129    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
130        d: D,
131    ) -> ::core::result::Result<Self, D::Error> {
132        <Self as ::serde::Deserialize>::deserialize(d)
133    }
134}
135impl ::buffa::Enumeration for TriggerType {
136    fn from_i32(value: i32) -> ::core::option::Option<Self> {
137        match value {
138            0i32 => ::core::option::Option::Some(Self::TRIGGER_TYPE_UNSPECIFIED),
139            1i32 => ::core::option::Option::Some(Self::STOP_LOSS),
140            2i32 => ::core::option::Option::Some(Self::TAKE_PROFIT),
141            3i32 => ::core::option::Option::Some(Self::TRAILING_STOP),
142            4i32 => ::core::option::Option::Some(Self::TWAP),
143            5i32 => ::core::option::Option::Some(Self::LADDER),
144            _ => ::core::option::Option::None,
145        }
146    }
147    fn to_i32(&self) -> i32 {
148        *self as i32
149    }
150    fn proto_name(&self) -> &'static str {
151        match self {
152            Self::TRIGGER_TYPE_UNSPECIFIED => "TRIGGER_TYPE_UNSPECIFIED",
153            Self::STOP_LOSS => "STOP_LOSS",
154            Self::TAKE_PROFIT => "TAKE_PROFIT",
155            Self::TRAILING_STOP => "TRAILING_STOP",
156            Self::TWAP => "TWAP",
157            Self::LADDER => "LADDER",
158        }
159    }
160    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
161        match name {
162            "TRIGGER_TYPE_UNSPECIFIED" => {
163                ::core::option::Option::Some(Self::TRIGGER_TYPE_UNSPECIFIED)
164            }
165            "STOP_LOSS" => ::core::option::Option::Some(Self::STOP_LOSS),
166            "TAKE_PROFIT" => ::core::option::Option::Some(Self::TAKE_PROFIT),
167            "TRAILING_STOP" => ::core::option::Option::Some(Self::TRAILING_STOP),
168            "TWAP" => ::core::option::Option::Some(Self::TWAP),
169            "LADDER" => ::core::option::Option::Some(Self::LADDER),
170            _ => ::core::option::Option::None,
171        }
172    }
173    fn values() -> &'static [Self] {
174        &[
175            Self::TRIGGER_TYPE_UNSPECIFIED,
176            Self::STOP_LOSS,
177            Self::TAKE_PROFIT,
178            Self::TRAILING_STOP,
179            Self::TWAP,
180            Self::LADDER,
181        ]
182    }
183}
184/// TriggerStatus represents the lifecycle state of a trigger.
185#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
186#[repr(i32)]
187pub enum TriggerStatus {
188    /// Trigger status was not provided.
189    STATUS_UNSPECIFIED = 0i32,
190    /// Trigger was created and is pending activation.
191    STATUS_CREATED = 1i32,
192    /// Trigger admitted and actively evaluating conditions.
193    STATUS_ARMED = 2i32,
194    /// Trigger is actively executing (for example, TWAP slices in progress).
195    STATUS_RUNNING = 3i32,
196    /// Trigger completed successfully (all child orders placed/filled).
197    STATUS_COMPLETED = 4i32,
198    /// Trigger was canceled by user.
199    STATUS_CANCELED = 5i32,
200    /// Trigger failed (for example, reservation failure, child order rejection).
201    STATUS_FAILED = 6i32,
202    /// Trigger is paused (user-initiated, can be resumed).
203    STATUS_PAUSED = 7i32,
204}
205impl TriggerStatus {
206    ///Idiomatic alias for [`Self::STATUS_UNSPECIFIED`]; `Debug` prints the variant name.
207    #[allow(non_upper_case_globals)]
208    pub const StatusUnspecified: Self = Self::STATUS_UNSPECIFIED;
209    ///Idiomatic alias for [`Self::STATUS_CREATED`]; `Debug` prints the variant name.
210    #[allow(non_upper_case_globals)]
211    pub const StatusCreated: Self = Self::STATUS_CREATED;
212    ///Idiomatic alias for [`Self::STATUS_ARMED`]; `Debug` prints the variant name.
213    #[allow(non_upper_case_globals)]
214    pub const StatusArmed: Self = Self::STATUS_ARMED;
215    ///Idiomatic alias for [`Self::STATUS_RUNNING`]; `Debug` prints the variant name.
216    #[allow(non_upper_case_globals)]
217    pub const StatusRunning: Self = Self::STATUS_RUNNING;
218    ///Idiomatic alias for [`Self::STATUS_COMPLETED`]; `Debug` prints the variant name.
219    #[allow(non_upper_case_globals)]
220    pub const StatusCompleted: Self = Self::STATUS_COMPLETED;
221    ///Idiomatic alias for [`Self::STATUS_CANCELED`]; `Debug` prints the variant name.
222    #[allow(non_upper_case_globals)]
223    pub const StatusCanceled: Self = Self::STATUS_CANCELED;
224    ///Idiomatic alias for [`Self::STATUS_FAILED`]; `Debug` prints the variant name.
225    #[allow(non_upper_case_globals)]
226    pub const StatusFailed: Self = Self::STATUS_FAILED;
227    ///Idiomatic alias for [`Self::STATUS_PAUSED`]; `Debug` prints the variant name.
228    #[allow(non_upper_case_globals)]
229    pub const StatusPaused: Self = Self::STATUS_PAUSED;
230}
231impl ::core::default::Default for TriggerStatus {
232    fn default() -> Self {
233        Self::STATUS_UNSPECIFIED
234    }
235}
236impl ::serde::Serialize for TriggerStatus {
237    fn serialize<S: ::serde::Serializer>(
238        &self,
239        s: S,
240    ) -> ::core::result::Result<S::Ok, S::Error> {
241        s.serialize_str(::buffa::Enumeration::proto_name(self))
242    }
243}
244impl<'de> ::serde::Deserialize<'de> for TriggerStatus {
245    fn deserialize<D: ::serde::Deserializer<'de>>(
246        d: D,
247    ) -> ::core::result::Result<Self, D::Error> {
248        struct _V;
249        impl ::serde::de::Visitor<'_> for _V {
250            type Value = TriggerStatus;
251            fn expecting(
252                &self,
253                f: &mut ::core::fmt::Formatter<'_>,
254            ) -> ::core::fmt::Result {
255                f.write_str(
256                    concat!("a string, integer, or null for ", stringify!(TriggerStatus)),
257                )
258            }
259            fn visit_str<E: ::serde::de::Error>(
260                self,
261                v: &str,
262            ) -> ::core::result::Result<TriggerStatus, E> {
263                <TriggerStatus as ::buffa::Enumeration>::from_proto_name(v)
264                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
265            }
266            fn visit_i64<E: ::serde::de::Error>(
267                self,
268                v: i64,
269            ) -> ::core::result::Result<TriggerStatus, E> {
270                let v32 = i32::try_from(v)
271                    .map_err(|_| {
272                        ::serde::de::Error::custom(
273                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
274                        )
275                    })?;
276                <TriggerStatus as ::buffa::Enumeration>::from_i32(v32)
277                    .ok_or_else(|| {
278                        ::serde::de::Error::custom(
279                            ::buffa::alloc::format!("unknown enum value {v32}"),
280                        )
281                    })
282            }
283            fn visit_u64<E: ::serde::de::Error>(
284                self,
285                v: u64,
286            ) -> ::core::result::Result<TriggerStatus, E> {
287                let v32 = i32::try_from(v)
288                    .map_err(|_| {
289                        ::serde::de::Error::custom(
290                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
291                        )
292                    })?;
293                <TriggerStatus as ::buffa::Enumeration>::from_i32(v32)
294                    .ok_or_else(|| {
295                        ::serde::de::Error::custom(
296                            ::buffa::alloc::format!("unknown enum value {v32}"),
297                        )
298                    })
299            }
300            fn visit_unit<E: ::serde::de::Error>(
301                self,
302            ) -> ::core::result::Result<TriggerStatus, E> {
303                ::core::result::Result::Ok(::core::default::Default::default())
304            }
305        }
306        d.deserialize_any(_V)
307    }
308}
309impl ::buffa::json_helpers::ProtoElemJson for TriggerStatus {
310    fn serialize_proto_json<S: ::serde::Serializer>(
311        v: &Self,
312        s: S,
313    ) -> ::core::result::Result<S::Ok, S::Error> {
314        ::serde::Serialize::serialize(v, s)
315    }
316    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
317        d: D,
318    ) -> ::core::result::Result<Self, D::Error> {
319        <Self as ::serde::Deserialize>::deserialize(d)
320    }
321}
322impl ::buffa::Enumeration for TriggerStatus {
323    fn from_i32(value: i32) -> ::core::option::Option<Self> {
324        match value {
325            0i32 => ::core::option::Option::Some(Self::STATUS_UNSPECIFIED),
326            1i32 => ::core::option::Option::Some(Self::STATUS_CREATED),
327            2i32 => ::core::option::Option::Some(Self::STATUS_ARMED),
328            3i32 => ::core::option::Option::Some(Self::STATUS_RUNNING),
329            4i32 => ::core::option::Option::Some(Self::STATUS_COMPLETED),
330            5i32 => ::core::option::Option::Some(Self::STATUS_CANCELED),
331            6i32 => ::core::option::Option::Some(Self::STATUS_FAILED),
332            7i32 => ::core::option::Option::Some(Self::STATUS_PAUSED),
333            _ => ::core::option::Option::None,
334        }
335    }
336    fn to_i32(&self) -> i32 {
337        *self as i32
338    }
339    fn proto_name(&self) -> &'static str {
340        match self {
341            Self::STATUS_UNSPECIFIED => "STATUS_UNSPECIFIED",
342            Self::STATUS_CREATED => "STATUS_CREATED",
343            Self::STATUS_ARMED => "STATUS_ARMED",
344            Self::STATUS_RUNNING => "STATUS_RUNNING",
345            Self::STATUS_COMPLETED => "STATUS_COMPLETED",
346            Self::STATUS_CANCELED => "STATUS_CANCELED",
347            Self::STATUS_FAILED => "STATUS_FAILED",
348            Self::STATUS_PAUSED => "STATUS_PAUSED",
349        }
350    }
351    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
352        match name {
353            "STATUS_UNSPECIFIED" => {
354                ::core::option::Option::Some(Self::STATUS_UNSPECIFIED)
355            }
356            "STATUS_CREATED" => ::core::option::Option::Some(Self::STATUS_CREATED),
357            "STATUS_ARMED" => ::core::option::Option::Some(Self::STATUS_ARMED),
358            "STATUS_RUNNING" => ::core::option::Option::Some(Self::STATUS_RUNNING),
359            "STATUS_COMPLETED" => ::core::option::Option::Some(Self::STATUS_COMPLETED),
360            "STATUS_CANCELED" => ::core::option::Option::Some(Self::STATUS_CANCELED),
361            "STATUS_FAILED" => ::core::option::Option::Some(Self::STATUS_FAILED),
362            "STATUS_PAUSED" => ::core::option::Option::Some(Self::STATUS_PAUSED),
363            _ => ::core::option::Option::None,
364        }
365    }
366    fn values() -> &'static [Self] {
367        &[
368            Self::STATUS_UNSPECIFIED,
369            Self::STATUS_CREATED,
370            Self::STATUS_ARMED,
371            Self::STATUS_RUNNING,
372            Self::STATUS_COMPLETED,
373            Self::STATUS_CANCELED,
374            Self::STATUS_FAILED,
375            Self::STATUS_PAUSED,
376        ]
377    }
378}
379/// TriggerEventType defines append-only trigger lifecycle events for history.
380#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
381#[repr(i32)]
382pub enum TriggerEventType {
383    /// Trigger event type was not provided.
384    EVENT_UNSPECIFIED = 0i32,
385    /// Trigger fired and may have created a child order.
386    EVENT_FIRED = 1i32,
387    /// Trigger was canceled.
388    EVENT_CANCELED = 2i32,
389    /// Trigger configuration or lifecycle state was updated.
390    EVENT_UPDATED = 3i32,
391}
392impl TriggerEventType {
393    ///Idiomatic alias for [`Self::EVENT_UNSPECIFIED`]; `Debug` prints the variant name.
394    #[allow(non_upper_case_globals)]
395    pub const EventUnspecified: Self = Self::EVENT_UNSPECIFIED;
396    ///Idiomatic alias for [`Self::EVENT_FIRED`]; `Debug` prints the variant name.
397    #[allow(non_upper_case_globals)]
398    pub const EventFired: Self = Self::EVENT_FIRED;
399    ///Idiomatic alias for [`Self::EVENT_CANCELED`]; `Debug` prints the variant name.
400    #[allow(non_upper_case_globals)]
401    pub const EventCanceled: Self = Self::EVENT_CANCELED;
402    ///Idiomatic alias for [`Self::EVENT_UPDATED`]; `Debug` prints the variant name.
403    #[allow(non_upper_case_globals)]
404    pub const EventUpdated: Self = Self::EVENT_UPDATED;
405}
406impl ::core::default::Default for TriggerEventType {
407    fn default() -> Self {
408        Self::EVENT_UNSPECIFIED
409    }
410}
411impl ::serde::Serialize for TriggerEventType {
412    fn serialize<S: ::serde::Serializer>(
413        &self,
414        s: S,
415    ) -> ::core::result::Result<S::Ok, S::Error> {
416        s.serialize_str(::buffa::Enumeration::proto_name(self))
417    }
418}
419impl<'de> ::serde::Deserialize<'de> for TriggerEventType {
420    fn deserialize<D: ::serde::Deserializer<'de>>(
421        d: D,
422    ) -> ::core::result::Result<Self, D::Error> {
423        struct _V;
424        impl ::serde::de::Visitor<'_> for _V {
425            type Value = TriggerEventType;
426            fn expecting(
427                &self,
428                f: &mut ::core::fmt::Formatter<'_>,
429            ) -> ::core::fmt::Result {
430                f.write_str(
431                    concat!(
432                        "a string, integer, or null for ", stringify!(TriggerEventType)
433                    ),
434                )
435            }
436            fn visit_str<E: ::serde::de::Error>(
437                self,
438                v: &str,
439            ) -> ::core::result::Result<TriggerEventType, E> {
440                <TriggerEventType as ::buffa::Enumeration>::from_proto_name(v)
441                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
442            }
443            fn visit_i64<E: ::serde::de::Error>(
444                self,
445                v: i64,
446            ) -> ::core::result::Result<TriggerEventType, E> {
447                let v32 = i32::try_from(v)
448                    .map_err(|_| {
449                        ::serde::de::Error::custom(
450                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
451                        )
452                    })?;
453                <TriggerEventType as ::buffa::Enumeration>::from_i32(v32)
454                    .ok_or_else(|| {
455                        ::serde::de::Error::custom(
456                            ::buffa::alloc::format!("unknown enum value {v32}"),
457                        )
458                    })
459            }
460            fn visit_u64<E: ::serde::de::Error>(
461                self,
462                v: u64,
463            ) -> ::core::result::Result<TriggerEventType, E> {
464                let v32 = i32::try_from(v)
465                    .map_err(|_| {
466                        ::serde::de::Error::custom(
467                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
468                        )
469                    })?;
470                <TriggerEventType as ::buffa::Enumeration>::from_i32(v32)
471                    .ok_or_else(|| {
472                        ::serde::de::Error::custom(
473                            ::buffa::alloc::format!("unknown enum value {v32}"),
474                        )
475                    })
476            }
477            fn visit_unit<E: ::serde::de::Error>(
478                self,
479            ) -> ::core::result::Result<TriggerEventType, E> {
480                ::core::result::Result::Ok(::core::default::Default::default())
481            }
482        }
483        d.deserialize_any(_V)
484    }
485}
486impl ::buffa::json_helpers::ProtoElemJson for TriggerEventType {
487    fn serialize_proto_json<S: ::serde::Serializer>(
488        v: &Self,
489        s: S,
490    ) -> ::core::result::Result<S::Ok, S::Error> {
491        ::serde::Serialize::serialize(v, s)
492    }
493    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
494        d: D,
495    ) -> ::core::result::Result<Self, D::Error> {
496        <Self as ::serde::Deserialize>::deserialize(d)
497    }
498}
499impl ::buffa::Enumeration for TriggerEventType {
500    fn from_i32(value: i32) -> ::core::option::Option<Self> {
501        match value {
502            0i32 => ::core::option::Option::Some(Self::EVENT_UNSPECIFIED),
503            1i32 => ::core::option::Option::Some(Self::EVENT_FIRED),
504            2i32 => ::core::option::Option::Some(Self::EVENT_CANCELED),
505            3i32 => ::core::option::Option::Some(Self::EVENT_UPDATED),
506            _ => ::core::option::Option::None,
507        }
508    }
509    fn to_i32(&self) -> i32 {
510        *self as i32
511    }
512    fn proto_name(&self) -> &'static str {
513        match self {
514            Self::EVENT_UNSPECIFIED => "EVENT_UNSPECIFIED",
515            Self::EVENT_FIRED => "EVENT_FIRED",
516            Self::EVENT_CANCELED => "EVENT_CANCELED",
517            Self::EVENT_UPDATED => "EVENT_UPDATED",
518        }
519    }
520    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
521        match name {
522            "EVENT_UNSPECIFIED" => ::core::option::Option::Some(Self::EVENT_UNSPECIFIED),
523            "EVENT_FIRED" => ::core::option::Option::Some(Self::EVENT_FIRED),
524            "EVENT_CANCELED" => ::core::option::Option::Some(Self::EVENT_CANCELED),
525            "EVENT_UPDATED" => ::core::option::Option::Some(Self::EVENT_UPDATED),
526            _ => ::core::option::Option::None,
527        }
528    }
529    fn values() -> &'static [Self] {
530        &[
531            Self::EVENT_UNSPECIFIED,
532            Self::EVENT_FIRED,
533            Self::EVENT_CANCELED,
534            Self::EVENT_UPDATED,
535        ]
536    }
537}
538/// LadderDistribution defines how quantity is distributed across ladder levels.
539#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
540#[repr(i32)]
541pub enum LadderDistribution {
542    /// Ladder distribution was not provided.
543    LADDER_DISTRIBUTION_UNSPECIFIED = 0i32,
544    /// Equal quantity at each level.
545    LINEAR = 1i32,
546    /// More quantity toward the edges (U-shape).
547    GEOMETRIC = 2i32,
548    /// More quantity at favorable prices.
549    WEIGHTED_FAVORABLE = 3i32,
550}
551impl LadderDistribution {
552    ///Idiomatic alias for [`Self::LADDER_DISTRIBUTION_UNSPECIFIED`]; `Debug` prints the variant name.
553    #[allow(non_upper_case_globals)]
554    pub const LadderDistributionUnspecified: Self = Self::LADDER_DISTRIBUTION_UNSPECIFIED;
555    ///Idiomatic alias for [`Self::LINEAR`]; `Debug` prints the variant name.
556    #[allow(non_upper_case_globals)]
557    pub const Linear: Self = Self::LINEAR;
558    ///Idiomatic alias for [`Self::GEOMETRIC`]; `Debug` prints the variant name.
559    #[allow(non_upper_case_globals)]
560    pub const Geometric: Self = Self::GEOMETRIC;
561    ///Idiomatic alias for [`Self::WEIGHTED_FAVORABLE`]; `Debug` prints the variant name.
562    #[allow(non_upper_case_globals)]
563    pub const WeightedFavorable: Self = Self::WEIGHTED_FAVORABLE;
564}
565impl ::core::default::Default for LadderDistribution {
566    fn default() -> Self {
567        Self::LADDER_DISTRIBUTION_UNSPECIFIED
568    }
569}
570impl ::serde::Serialize for LadderDistribution {
571    fn serialize<S: ::serde::Serializer>(
572        &self,
573        s: S,
574    ) -> ::core::result::Result<S::Ok, S::Error> {
575        s.serialize_str(::buffa::Enumeration::proto_name(self))
576    }
577}
578impl<'de> ::serde::Deserialize<'de> for LadderDistribution {
579    fn deserialize<D: ::serde::Deserializer<'de>>(
580        d: D,
581    ) -> ::core::result::Result<Self, D::Error> {
582        struct _V;
583        impl ::serde::de::Visitor<'_> for _V {
584            type Value = LadderDistribution;
585            fn expecting(
586                &self,
587                f: &mut ::core::fmt::Formatter<'_>,
588            ) -> ::core::fmt::Result {
589                f.write_str(
590                    concat!(
591                        "a string, integer, or null for ", stringify!(LadderDistribution)
592                    ),
593                )
594            }
595            fn visit_str<E: ::serde::de::Error>(
596                self,
597                v: &str,
598            ) -> ::core::result::Result<LadderDistribution, E> {
599                <LadderDistribution as ::buffa::Enumeration>::from_proto_name(v)
600                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
601            }
602            fn visit_i64<E: ::serde::de::Error>(
603                self,
604                v: i64,
605            ) -> ::core::result::Result<LadderDistribution, E> {
606                let v32 = i32::try_from(v)
607                    .map_err(|_| {
608                        ::serde::de::Error::custom(
609                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
610                        )
611                    })?;
612                <LadderDistribution as ::buffa::Enumeration>::from_i32(v32)
613                    .ok_or_else(|| {
614                        ::serde::de::Error::custom(
615                            ::buffa::alloc::format!("unknown enum value {v32}"),
616                        )
617                    })
618            }
619            fn visit_u64<E: ::serde::de::Error>(
620                self,
621                v: u64,
622            ) -> ::core::result::Result<LadderDistribution, E> {
623                let v32 = i32::try_from(v)
624                    .map_err(|_| {
625                        ::serde::de::Error::custom(
626                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
627                        )
628                    })?;
629                <LadderDistribution as ::buffa::Enumeration>::from_i32(v32)
630                    .ok_or_else(|| {
631                        ::serde::de::Error::custom(
632                            ::buffa::alloc::format!("unknown enum value {v32}"),
633                        )
634                    })
635            }
636            fn visit_unit<E: ::serde::de::Error>(
637                self,
638            ) -> ::core::result::Result<LadderDistribution, E> {
639                ::core::result::Result::Ok(::core::default::Default::default())
640            }
641        }
642        d.deserialize_any(_V)
643    }
644}
645impl ::buffa::json_helpers::ProtoElemJson for LadderDistribution {
646    fn serialize_proto_json<S: ::serde::Serializer>(
647        v: &Self,
648        s: S,
649    ) -> ::core::result::Result<S::Ok, S::Error> {
650        ::serde::Serialize::serialize(v, s)
651    }
652    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
653        d: D,
654    ) -> ::core::result::Result<Self, D::Error> {
655        <Self as ::serde::Deserialize>::deserialize(d)
656    }
657}
658impl ::buffa::Enumeration for LadderDistribution {
659    fn from_i32(value: i32) -> ::core::option::Option<Self> {
660        match value {
661            0i32 => ::core::option::Option::Some(Self::LADDER_DISTRIBUTION_UNSPECIFIED),
662            1i32 => ::core::option::Option::Some(Self::LINEAR),
663            2i32 => ::core::option::Option::Some(Self::GEOMETRIC),
664            3i32 => ::core::option::Option::Some(Self::WEIGHTED_FAVORABLE),
665            _ => ::core::option::Option::None,
666        }
667    }
668    fn to_i32(&self) -> i32 {
669        *self as i32
670    }
671    fn proto_name(&self) -> &'static str {
672        match self {
673            Self::LADDER_DISTRIBUTION_UNSPECIFIED => "LADDER_DISTRIBUTION_UNSPECIFIED",
674            Self::LINEAR => "LINEAR",
675            Self::GEOMETRIC => "GEOMETRIC",
676            Self::WEIGHTED_FAVORABLE => "WEIGHTED_FAVORABLE",
677        }
678    }
679    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
680        match name {
681            "LADDER_DISTRIBUTION_UNSPECIFIED" => {
682                ::core::option::Option::Some(Self::LADDER_DISTRIBUTION_UNSPECIFIED)
683            }
684            "LINEAR" => ::core::option::Option::Some(Self::LINEAR),
685            "GEOMETRIC" => ::core::option::Option::Some(Self::GEOMETRIC),
686            "WEIGHTED_FAVORABLE" => {
687                ::core::option::Option::Some(Self::WEIGHTED_FAVORABLE)
688            }
689            _ => ::core::option::Option::None,
690        }
691    }
692    fn values() -> &'static [Self] {
693        &[
694            Self::LADDER_DISTRIBUTION_UNSPECIFIED,
695            Self::LINEAR,
696            Self::GEOMETRIC,
697            Self::WEIGHTED_FAVORABLE,
698        ]
699    }
700}
701/// =============================================================================
702/// Create Trigger Request/Response
703/// =============================================================================
704///
705/// TriggerMarketIoc configures an immediate market child.
706#[derive(Clone, PartialEq, Default)]
707#[derive(::serde::Serialize, ::serde::Deserialize)]
708#[serde(default)]
709pub struct TriggerMarketIoc {
710    #[serde(skip)]
711    #[doc(hidden)]
712    pub __buffa_unknown_fields: ::buffa::UnknownFields,
713}
714impl ::core::fmt::Debug for TriggerMarketIoc {
715    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
716        f.debug_struct("TriggerMarketIoc").finish()
717    }
718}
719impl TriggerMarketIoc {
720    /// Protobuf type URL for this message, for use with `Any::pack` and
721    /// `Any::unpack_if`.
722    ///
723    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
724    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerMarketIoc";
725}
726::buffa::impl_default_instance!(TriggerMarketIoc);
727impl ::buffa::MessageName for TriggerMarketIoc {
728    const PACKAGE: &'static str = "triggers.v1";
729    const NAME: &'static str = "TriggerMarketIoc";
730    const FULL_NAME: &'static str = "triggers.v1.TriggerMarketIoc";
731    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerMarketIoc";
732}
733impl ::buffa::Message for TriggerMarketIoc {
734    /// Returns the total encoded size in bytes.
735    ///
736    /// The result is a `u32`; the protobuf specification requires all
737    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
738    /// compliant message will never overflow this type.
739    #[allow(clippy::let_and_return)]
740    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
741        #[allow(unused_imports)]
742        use ::buffa::Enumeration as _;
743        let mut size = 0u32;
744        size += self.__buffa_unknown_fields.encoded_len() as u32;
745        size
746    }
747    fn write_to(
748        &self,
749        _cache: &mut ::buffa::SizeCache,
750        buf: &mut impl ::buffa::bytes::BufMut,
751    ) {
752        #[allow(unused_imports)]
753        use ::buffa::Enumeration as _;
754        self.__buffa_unknown_fields.write_to(buf);
755    }
756    fn merge_field(
757        &mut self,
758        tag: ::buffa::encoding::Tag,
759        buf: &mut impl ::buffa::bytes::Buf,
760        ctx: ::buffa::DecodeContext<'_>,
761    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
762        #[allow(unused_imports)]
763        use ::buffa::bytes::Buf as _;
764        #[allow(unused_imports)]
765        use ::buffa::Enumeration as _;
766        match tag.field_number() {
767            _ => {
768                self.__buffa_unknown_fields
769                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
770            }
771        }
772        ::core::result::Result::Ok(())
773    }
774    fn clear(&mut self) {
775        self.__buffa_unknown_fields.clear();
776    }
777}
778impl ::buffa::ExtensionSet for TriggerMarketIoc {
779    const PROTO_FQN: &'static str = "triggers.v1.TriggerMarketIoc";
780    fn unknown_fields(&self) -> &::buffa::UnknownFields {
781        &self.__buffa_unknown_fields
782    }
783    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
784        &mut self.__buffa_unknown_fields
785    }
786}
787impl ::buffa::json_helpers::ProtoElemJson for TriggerMarketIoc {
788    fn serialize_proto_json<S: ::serde::Serializer>(
789        v: &Self,
790        s: S,
791    ) -> ::core::result::Result<S::Ok, S::Error> {
792        ::serde::Serialize::serialize(v, s)
793    }
794    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
795        d: D,
796    ) -> ::core::result::Result<Self, D::Error> {
797        <Self as ::serde::Deserialize>::deserialize(d)
798    }
799}
800#[doc(hidden)]
801pub const __TRIGGER_MARKET_IOC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
802    type_url: "type.googleapis.com/triggers.v1.TriggerMarketIoc",
803    to_json: ::buffa::type_registry::any_to_json::<TriggerMarketIoc>,
804    from_json: ::buffa::type_registry::any_from_json::<TriggerMarketIoc>,
805    is_wkt: false,
806};
807/// TriggerLimitGtc configures a resting limit child.
808#[derive(Clone, PartialEq, Default)]
809#[derive(::serde::Serialize, ::serde::Deserialize)]
810#[serde(default)]
811pub struct TriggerLimitGtc {
812    /// Limit price in quote units scaled by 1e6.
813    ///
814    /// Field 1: `price_ticks`
815    #[serde(
816        rename = "priceTicks",
817        alias = "price_ticks",
818        with = "::buffa::json_helpers::int64",
819        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
820    )]
821    pub price_ticks: i64,
822    /// Reject instead of taking liquidity.
823    ///
824    /// Field 2: `post_only`
825    #[serde(
826        rename = "postOnly",
827        alias = "post_only",
828        with = "::buffa::json_helpers::proto_bool",
829        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
830    )]
831    pub post_only: bool,
832    #[serde(skip)]
833    #[doc(hidden)]
834    pub __buffa_unknown_fields: ::buffa::UnknownFields,
835}
836impl ::core::fmt::Debug for TriggerLimitGtc {
837    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
838        f.debug_struct("TriggerLimitGtc")
839            .field("price_ticks", &self.price_ticks)
840            .field("post_only", &self.post_only)
841            .finish()
842    }
843}
844impl TriggerLimitGtc {
845    /// Protobuf type URL for this message, for use with `Any::pack` and
846    /// `Any::unpack_if`.
847    ///
848    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
849    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitGtc";
850}
851::buffa::impl_default_instance!(TriggerLimitGtc);
852impl ::buffa::MessageName for TriggerLimitGtc {
853    const PACKAGE: &'static str = "triggers.v1";
854    const NAME: &'static str = "TriggerLimitGtc";
855    const FULL_NAME: &'static str = "triggers.v1.TriggerLimitGtc";
856    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitGtc";
857}
858impl ::buffa::Message for TriggerLimitGtc {
859    /// Returns the total encoded size in bytes.
860    ///
861    /// The result is a `u32`; the protobuf specification requires all
862    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
863    /// compliant message will never overflow this type.
864    #[allow(clippy::let_and_return)]
865    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
866        #[allow(unused_imports)]
867        use ::buffa::Enumeration as _;
868        let mut size = 0u32;
869        if self.price_ticks != 0i64 {
870            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
871        }
872        if self.post_only {
873            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
874        }
875        size += self.__buffa_unknown_fields.encoded_len() as u32;
876        size
877    }
878    fn write_to(
879        &self,
880        _cache: &mut ::buffa::SizeCache,
881        buf: &mut impl ::buffa::bytes::BufMut,
882    ) {
883        #[allow(unused_imports)]
884        use ::buffa::Enumeration as _;
885        if self.price_ticks != 0i64 {
886            ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
887        }
888        if self.post_only {
889            ::buffa::types::put_bool_field(2u32, self.post_only, buf);
890        }
891        self.__buffa_unknown_fields.write_to(buf);
892    }
893    fn merge_field(
894        &mut self,
895        tag: ::buffa::encoding::Tag,
896        buf: &mut impl ::buffa::bytes::Buf,
897        ctx: ::buffa::DecodeContext<'_>,
898    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
899        #[allow(unused_imports)]
900        use ::buffa::bytes::Buf as _;
901        #[allow(unused_imports)]
902        use ::buffa::Enumeration as _;
903        match tag.field_number() {
904            1u32 => {
905                ::buffa::encoding::check_wire_type(
906                    tag,
907                    ::buffa::encoding::WireType::Varint,
908                )?;
909                self.price_ticks = ::buffa::types::decode_int64(buf)?;
910            }
911            2u32 => {
912                ::buffa::encoding::check_wire_type(
913                    tag,
914                    ::buffa::encoding::WireType::Varint,
915                )?;
916                self.post_only = ::buffa::types::decode_bool(buf)?;
917            }
918            _ => {
919                self.__buffa_unknown_fields
920                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
921            }
922        }
923        ::core::result::Result::Ok(())
924    }
925    fn clear(&mut self) {
926        self.price_ticks = 0i64;
927        self.post_only = false;
928        self.__buffa_unknown_fields.clear();
929    }
930}
931impl ::buffa::ExtensionSet for TriggerLimitGtc {
932    const PROTO_FQN: &'static str = "triggers.v1.TriggerLimitGtc";
933    fn unknown_fields(&self) -> &::buffa::UnknownFields {
934        &self.__buffa_unknown_fields
935    }
936    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
937        &mut self.__buffa_unknown_fields
938    }
939}
940impl ::buffa::json_helpers::ProtoElemJson for TriggerLimitGtc {
941    fn serialize_proto_json<S: ::serde::Serializer>(
942        v: &Self,
943        s: S,
944    ) -> ::core::result::Result<S::Ok, S::Error> {
945        ::serde::Serialize::serialize(v, s)
946    }
947    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
948        d: D,
949    ) -> ::core::result::Result<Self, D::Error> {
950        <Self as ::serde::Deserialize>::deserialize(d)
951    }
952}
953#[doc(hidden)]
954pub const __TRIGGER_LIMIT_GTC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
955    type_url: "type.googleapis.com/triggers.v1.TriggerLimitGtc",
956    to_json: ::buffa::type_registry::any_to_json::<TriggerLimitGtc>,
957    from_json: ::buffa::type_registry::any_from_json::<TriggerLimitGtc>,
958    is_wkt: false,
959};
960/// TriggerLimitIoc configures an immediate-or-cancel limit child.
961#[derive(Clone, PartialEq, Default)]
962#[derive(::serde::Serialize, ::serde::Deserialize)]
963#[serde(default)]
964pub struct TriggerLimitIoc {
965    /// Limit price in quote units scaled by 1e6.
966    ///
967    /// Field 1: `price_ticks`
968    #[serde(
969        rename = "priceTicks",
970        alias = "price_ticks",
971        with = "::buffa::json_helpers::int64",
972        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
973    )]
974    pub price_ticks: i64,
975    #[serde(skip)]
976    #[doc(hidden)]
977    pub __buffa_unknown_fields: ::buffa::UnknownFields,
978}
979impl ::core::fmt::Debug for TriggerLimitIoc {
980    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
981        f.debug_struct("TriggerLimitIoc")
982            .field("price_ticks", &self.price_ticks)
983            .finish()
984    }
985}
986impl TriggerLimitIoc {
987    /// Protobuf type URL for this message, for use with `Any::pack` and
988    /// `Any::unpack_if`.
989    ///
990    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
991    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitIoc";
992}
993::buffa::impl_default_instance!(TriggerLimitIoc);
994impl ::buffa::MessageName for TriggerLimitIoc {
995    const PACKAGE: &'static str = "triggers.v1";
996    const NAME: &'static str = "TriggerLimitIoc";
997    const FULL_NAME: &'static str = "triggers.v1.TriggerLimitIoc";
998    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitIoc";
999}
1000impl ::buffa::Message for TriggerLimitIoc {
1001    /// Returns the total encoded size in bytes.
1002    ///
1003    /// The result is a `u32`; the protobuf specification requires all
1004    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1005    /// compliant message will never overflow this type.
1006    #[allow(clippy::let_and_return)]
1007    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1008        #[allow(unused_imports)]
1009        use ::buffa::Enumeration as _;
1010        let mut size = 0u32;
1011        if self.price_ticks != 0i64 {
1012            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
1013        }
1014        size += self.__buffa_unknown_fields.encoded_len() as u32;
1015        size
1016    }
1017    fn write_to(
1018        &self,
1019        _cache: &mut ::buffa::SizeCache,
1020        buf: &mut impl ::buffa::bytes::BufMut,
1021    ) {
1022        #[allow(unused_imports)]
1023        use ::buffa::Enumeration as _;
1024        if self.price_ticks != 0i64 {
1025            ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
1026        }
1027        self.__buffa_unknown_fields.write_to(buf);
1028    }
1029    fn merge_field(
1030        &mut self,
1031        tag: ::buffa::encoding::Tag,
1032        buf: &mut impl ::buffa::bytes::Buf,
1033        ctx: ::buffa::DecodeContext<'_>,
1034    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1035        #[allow(unused_imports)]
1036        use ::buffa::bytes::Buf as _;
1037        #[allow(unused_imports)]
1038        use ::buffa::Enumeration as _;
1039        match tag.field_number() {
1040            1u32 => {
1041                ::buffa::encoding::check_wire_type(
1042                    tag,
1043                    ::buffa::encoding::WireType::Varint,
1044                )?;
1045                self.price_ticks = ::buffa::types::decode_int64(buf)?;
1046            }
1047            _ => {
1048                self.__buffa_unknown_fields
1049                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1050            }
1051        }
1052        ::core::result::Result::Ok(())
1053    }
1054    fn clear(&mut self) {
1055        self.price_ticks = 0i64;
1056        self.__buffa_unknown_fields.clear();
1057    }
1058}
1059impl ::buffa::ExtensionSet for TriggerLimitIoc {
1060    const PROTO_FQN: &'static str = "triggers.v1.TriggerLimitIoc";
1061    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1062        &self.__buffa_unknown_fields
1063    }
1064    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1065        &mut self.__buffa_unknown_fields
1066    }
1067}
1068impl ::buffa::json_helpers::ProtoElemJson for TriggerLimitIoc {
1069    fn serialize_proto_json<S: ::serde::Serializer>(
1070        v: &Self,
1071        s: S,
1072    ) -> ::core::result::Result<S::Ok, S::Error> {
1073        ::serde::Serialize::serialize(v, s)
1074    }
1075    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1076        d: D,
1077    ) -> ::core::result::Result<Self, D::Error> {
1078        <Self as ::serde::Deserialize>::deserialize(d)
1079    }
1080}
1081#[doc(hidden)]
1082pub const __TRIGGER_LIMIT_IOC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1083    type_url: "type.googleapis.com/triggers.v1.TriggerLimitIoc",
1084    to_json: ::buffa::type_registry::any_to_json::<TriggerLimitIoc>,
1085    from_json: ::buffa::type_registry::any_from_json::<TriggerLimitIoc>,
1086    is_wkt: false,
1087};
1088/// TriggerLimitFok configures a fill-or-kill limit child.
1089#[derive(Clone, PartialEq, Default)]
1090#[derive(::serde::Serialize, ::serde::Deserialize)]
1091#[serde(default)]
1092pub struct TriggerLimitFok {
1093    /// Limit price in quote units scaled by 1e6.
1094    ///
1095    /// Field 1: `price_ticks`
1096    #[serde(
1097        rename = "priceTicks",
1098        alias = "price_ticks",
1099        with = "::buffa::json_helpers::int64",
1100        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1101    )]
1102    pub price_ticks: i64,
1103    #[serde(skip)]
1104    #[doc(hidden)]
1105    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1106}
1107impl ::core::fmt::Debug for TriggerLimitFok {
1108    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1109        f.debug_struct("TriggerLimitFok")
1110            .field("price_ticks", &self.price_ticks)
1111            .finish()
1112    }
1113}
1114impl TriggerLimitFok {
1115    /// Protobuf type URL for this message, for use with `Any::pack` and
1116    /// `Any::unpack_if`.
1117    ///
1118    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1119    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitFok";
1120}
1121::buffa::impl_default_instance!(TriggerLimitFok);
1122impl ::buffa::MessageName for TriggerLimitFok {
1123    const PACKAGE: &'static str = "triggers.v1";
1124    const NAME: &'static str = "TriggerLimitFok";
1125    const FULL_NAME: &'static str = "triggers.v1.TriggerLimitFok";
1126    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitFok";
1127}
1128impl ::buffa::Message for TriggerLimitFok {
1129    /// Returns the total encoded size in bytes.
1130    ///
1131    /// The result is a `u32`; the protobuf specification requires all
1132    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1133    /// compliant message will never overflow this type.
1134    #[allow(clippy::let_and_return)]
1135    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1136        #[allow(unused_imports)]
1137        use ::buffa::Enumeration as _;
1138        let mut size = 0u32;
1139        if self.price_ticks != 0i64 {
1140            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
1141        }
1142        size += self.__buffa_unknown_fields.encoded_len() as u32;
1143        size
1144    }
1145    fn write_to(
1146        &self,
1147        _cache: &mut ::buffa::SizeCache,
1148        buf: &mut impl ::buffa::bytes::BufMut,
1149    ) {
1150        #[allow(unused_imports)]
1151        use ::buffa::Enumeration as _;
1152        if self.price_ticks != 0i64 {
1153            ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
1154        }
1155        self.__buffa_unknown_fields.write_to(buf);
1156    }
1157    fn merge_field(
1158        &mut self,
1159        tag: ::buffa::encoding::Tag,
1160        buf: &mut impl ::buffa::bytes::Buf,
1161        ctx: ::buffa::DecodeContext<'_>,
1162    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1163        #[allow(unused_imports)]
1164        use ::buffa::bytes::Buf as _;
1165        #[allow(unused_imports)]
1166        use ::buffa::Enumeration as _;
1167        match tag.field_number() {
1168            1u32 => {
1169                ::buffa::encoding::check_wire_type(
1170                    tag,
1171                    ::buffa::encoding::WireType::Varint,
1172                )?;
1173                self.price_ticks = ::buffa::types::decode_int64(buf)?;
1174            }
1175            _ => {
1176                self.__buffa_unknown_fields
1177                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1178            }
1179        }
1180        ::core::result::Result::Ok(())
1181    }
1182    fn clear(&mut self) {
1183        self.price_ticks = 0i64;
1184        self.__buffa_unknown_fields.clear();
1185    }
1186}
1187impl ::buffa::ExtensionSet for TriggerLimitFok {
1188    const PROTO_FQN: &'static str = "triggers.v1.TriggerLimitFok";
1189    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1190        &self.__buffa_unknown_fields
1191    }
1192    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1193        &mut self.__buffa_unknown_fields
1194    }
1195}
1196impl ::buffa::json_helpers::ProtoElemJson for TriggerLimitFok {
1197    fn serialize_proto_json<S: ::serde::Serializer>(
1198        v: &Self,
1199        s: S,
1200    ) -> ::core::result::Result<S::Ok, S::Error> {
1201        ::serde::Serialize::serialize(v, s)
1202    }
1203    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1204        d: D,
1205    ) -> ::core::result::Result<Self, D::Error> {
1206        <Self as ::serde::Deserialize>::deserialize(d)
1207    }
1208}
1209#[doc(hidden)]
1210pub const __TRIGGER_LIMIT_FOK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1211    type_url: "type.googleapis.com/triggers.v1.TriggerLimitFok",
1212    to_json: ::buffa::type_registry::any_to_json::<TriggerLimitFok>,
1213    from_json: ::buffa::type_registry::any_from_json::<TriggerLimitFok>,
1214    is_wkt: false,
1215};
1216/// ConditionalChildExecution selects the child submitted by a stop-loss or
1217/// take-profit trigger. BUY market children are not supported in spot.
1218#[derive(Clone, PartialEq, Default)]
1219#[derive(::serde::Serialize)]
1220#[serde(default)]
1221pub struct ConditionalChildExecution {
1222    #[serde(flatten)]
1223    pub execution: ::core::option::Option<
1224        __buffa::oneof::conditional_child_execution::Execution,
1225    >,
1226    #[serde(skip)]
1227    #[doc(hidden)]
1228    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1229}
1230impl ::core::fmt::Debug for ConditionalChildExecution {
1231    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1232        f.debug_struct("ConditionalChildExecution")
1233            .field("execution", &self.execution)
1234            .finish()
1235    }
1236}
1237impl ConditionalChildExecution {
1238    /// Protobuf type URL for this message, for use with `Any::pack` and
1239    /// `Any::unpack_if`.
1240    ///
1241    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1242    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalChildExecution";
1243}
1244::buffa::impl_default_instance!(ConditionalChildExecution);
1245impl ::buffa::MessageName for ConditionalChildExecution {
1246    const PACKAGE: &'static str = "triggers.v1";
1247    const NAME: &'static str = "ConditionalChildExecution";
1248    const FULL_NAME: &'static str = "triggers.v1.ConditionalChildExecution";
1249    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalChildExecution";
1250}
1251impl ::buffa::Message for ConditionalChildExecution {
1252    /// Returns the total encoded size in bytes.
1253    ///
1254    /// The result is a `u32`; the protobuf specification requires all
1255    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1256    /// compliant message will never overflow this type.
1257    #[allow(clippy::let_and_return)]
1258    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1259        #[allow(unused_imports)]
1260        use ::buffa::Enumeration as _;
1261        let mut size = 0u32;
1262        if let ::core::option::Option::Some(ref v) = self.execution {
1263            match v {
1264                __buffa::oneof::conditional_child_execution::Execution::MarketIoc(x) => {
1265                    let __slot = __cache.reserve();
1266                    let inner = x.compute_size(__cache);
1267                    __cache.set(__slot, inner);
1268                    size
1269                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
1270                            + inner;
1271                }
1272                __buffa::oneof::conditional_child_execution::Execution::LimitGtc(x) => {
1273                    let __slot = __cache.reserve();
1274                    let inner = x.compute_size(__cache);
1275                    __cache.set(__slot, inner);
1276                    size
1277                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
1278                            + inner;
1279                }
1280                __buffa::oneof::conditional_child_execution::Execution::LimitIoc(x) => {
1281                    let __slot = __cache.reserve();
1282                    let inner = x.compute_size(__cache);
1283                    __cache.set(__slot, inner);
1284                    size
1285                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
1286                            + inner;
1287                }
1288                __buffa::oneof::conditional_child_execution::Execution::LimitFok(x) => {
1289                    let __slot = __cache.reserve();
1290                    let inner = x.compute_size(__cache);
1291                    __cache.set(__slot, inner);
1292                    size
1293                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
1294                            + inner;
1295                }
1296            }
1297        }
1298        size += self.__buffa_unknown_fields.encoded_len() as u32;
1299        size
1300    }
1301    fn write_to(
1302        &self,
1303        __cache: &mut ::buffa::SizeCache,
1304        buf: &mut impl ::buffa::bytes::BufMut,
1305    ) {
1306        #[allow(unused_imports)]
1307        use ::buffa::Enumeration as _;
1308        if let ::core::option::Option::Some(ref v) = self.execution {
1309            match v {
1310                __buffa::oneof::conditional_child_execution::Execution::MarketIoc(x) => {
1311                    ::buffa::types::put_len_delimited_header(
1312                        1u32,
1313                        __cache.consume_next(),
1314                        buf,
1315                    );
1316                    x.write_to(__cache, buf);
1317                }
1318                __buffa::oneof::conditional_child_execution::Execution::LimitGtc(x) => {
1319                    ::buffa::types::put_len_delimited_header(
1320                        2u32,
1321                        __cache.consume_next(),
1322                        buf,
1323                    );
1324                    x.write_to(__cache, buf);
1325                }
1326                __buffa::oneof::conditional_child_execution::Execution::LimitIoc(x) => {
1327                    ::buffa::types::put_len_delimited_header(
1328                        3u32,
1329                        __cache.consume_next(),
1330                        buf,
1331                    );
1332                    x.write_to(__cache, buf);
1333                }
1334                __buffa::oneof::conditional_child_execution::Execution::LimitFok(x) => {
1335                    ::buffa::types::put_len_delimited_header(
1336                        4u32,
1337                        __cache.consume_next(),
1338                        buf,
1339                    );
1340                    x.write_to(__cache, buf);
1341                }
1342            }
1343        }
1344        self.__buffa_unknown_fields.write_to(buf);
1345    }
1346    fn merge_field(
1347        &mut self,
1348        tag: ::buffa::encoding::Tag,
1349        buf: &mut impl ::buffa::bytes::Buf,
1350        ctx: ::buffa::DecodeContext<'_>,
1351    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1352        #[allow(unused_imports)]
1353        use ::buffa::bytes::Buf as _;
1354        #[allow(unused_imports)]
1355        use ::buffa::Enumeration as _;
1356        match tag.field_number() {
1357            1u32 => {
1358                ::buffa::encoding::check_wire_type(
1359                    tag,
1360                    ::buffa::encoding::WireType::LengthDelimited,
1361                )?;
1362                if let ::core::option::Option::Some(
1363                    __buffa::oneof::conditional_child_execution::Execution::MarketIoc(
1364                        ref mut existing,
1365                    ),
1366                ) = self.execution
1367                {
1368                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
1369                } else {
1370                    let mut val = ::core::default::Default::default();
1371                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
1372                    self.execution = ::core::option::Option::Some(
1373                        __buffa::oneof::conditional_child_execution::Execution::MarketIoc(
1374                            ::buffa::alloc::boxed::Box::new(val),
1375                        ),
1376                    );
1377                }
1378            }
1379            2u32 => {
1380                ::buffa::encoding::check_wire_type(
1381                    tag,
1382                    ::buffa::encoding::WireType::LengthDelimited,
1383                )?;
1384                if let ::core::option::Option::Some(
1385                    __buffa::oneof::conditional_child_execution::Execution::LimitGtc(
1386                        ref mut existing,
1387                    ),
1388                ) = self.execution
1389                {
1390                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
1391                } else {
1392                    let mut val = ::core::default::Default::default();
1393                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
1394                    self.execution = ::core::option::Option::Some(
1395                        __buffa::oneof::conditional_child_execution::Execution::LimitGtc(
1396                            ::buffa::alloc::boxed::Box::new(val),
1397                        ),
1398                    );
1399                }
1400            }
1401            3u32 => {
1402                ::buffa::encoding::check_wire_type(
1403                    tag,
1404                    ::buffa::encoding::WireType::LengthDelimited,
1405                )?;
1406                if let ::core::option::Option::Some(
1407                    __buffa::oneof::conditional_child_execution::Execution::LimitIoc(
1408                        ref mut existing,
1409                    ),
1410                ) = self.execution
1411                {
1412                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
1413                } else {
1414                    let mut val = ::core::default::Default::default();
1415                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
1416                    self.execution = ::core::option::Option::Some(
1417                        __buffa::oneof::conditional_child_execution::Execution::LimitIoc(
1418                            ::buffa::alloc::boxed::Box::new(val),
1419                        ),
1420                    );
1421                }
1422            }
1423            4u32 => {
1424                ::buffa::encoding::check_wire_type(
1425                    tag,
1426                    ::buffa::encoding::WireType::LengthDelimited,
1427                )?;
1428                if let ::core::option::Option::Some(
1429                    __buffa::oneof::conditional_child_execution::Execution::LimitFok(
1430                        ref mut existing,
1431                    ),
1432                ) = self.execution
1433                {
1434                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
1435                } else {
1436                    let mut val = ::core::default::Default::default();
1437                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
1438                    self.execution = ::core::option::Option::Some(
1439                        __buffa::oneof::conditional_child_execution::Execution::LimitFok(
1440                            ::buffa::alloc::boxed::Box::new(val),
1441                        ),
1442                    );
1443                }
1444            }
1445            _ => {
1446                self.__buffa_unknown_fields
1447                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1448            }
1449        }
1450        ::core::result::Result::Ok(())
1451    }
1452    fn clear(&mut self) {
1453        self.execution = ::core::option::Option::None;
1454        self.__buffa_unknown_fields.clear();
1455    }
1456}
1457impl ::buffa::ExtensionSet for ConditionalChildExecution {
1458    const PROTO_FQN: &'static str = "triggers.v1.ConditionalChildExecution";
1459    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1460        &self.__buffa_unknown_fields
1461    }
1462    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1463        &mut self.__buffa_unknown_fields
1464    }
1465}
1466impl<'de> serde::Deserialize<'de> for ConditionalChildExecution {
1467    fn deserialize<D: serde::Deserializer<'de>>(
1468        d: D,
1469    ) -> ::core::result::Result<Self, D::Error> {
1470        struct _V;
1471        impl<'de> serde::de::Visitor<'de> for _V {
1472            type Value = ConditionalChildExecution;
1473            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1474                f.write_str("struct ConditionalChildExecution")
1475            }
1476            #[allow(clippy::field_reassign_with_default)]
1477            fn visit_map<A: serde::de::MapAccess<'de>>(
1478                self,
1479                mut map: A,
1480            ) -> ::core::result::Result<ConditionalChildExecution, A::Error> {
1481                let mut __oneof_execution: ::core::option::Option<
1482                    __buffa::oneof::conditional_child_execution::Execution,
1483                > = None;
1484                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
1485                    match key.as_str() {
1486                        "marketIoc" | "market_ioc" => {
1487                            let v: ::core::option::Option<TriggerMarketIoc> = map
1488                                .next_value_seed(
1489                                    ::buffa::json_helpers::NullableDeserializeSeed(
1490                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
1491                                            TriggerMarketIoc,
1492                                        >::new(),
1493                                    ),
1494                                )?;
1495                            if let Some(v) = v {
1496                                if __oneof_execution.is_some() {
1497                                    return Err(
1498                                        serde::de::Error::custom(
1499                                            "multiple oneof fields set for 'execution'",
1500                                        ),
1501                                    );
1502                                }
1503                                __oneof_execution = Some(
1504                                    __buffa::oneof::conditional_child_execution::Execution::MarketIoc(
1505                                        ::buffa::alloc::boxed::Box::new(v),
1506                                    ),
1507                                );
1508                            }
1509                        }
1510                        "limitGtc" | "limit_gtc" => {
1511                            let v: ::core::option::Option<TriggerLimitGtc> = map
1512                                .next_value_seed(
1513                                    ::buffa::json_helpers::NullableDeserializeSeed(
1514                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
1515                                            TriggerLimitGtc,
1516                                        >::new(),
1517                                    ),
1518                                )?;
1519                            if let Some(v) = v {
1520                                if __oneof_execution.is_some() {
1521                                    return Err(
1522                                        serde::de::Error::custom(
1523                                            "multiple oneof fields set for 'execution'",
1524                                        ),
1525                                    );
1526                                }
1527                                __oneof_execution = Some(
1528                                    __buffa::oneof::conditional_child_execution::Execution::LimitGtc(
1529                                        ::buffa::alloc::boxed::Box::new(v),
1530                                    ),
1531                                );
1532                            }
1533                        }
1534                        "limitIoc" | "limit_ioc" => {
1535                            let v: ::core::option::Option<TriggerLimitIoc> = map
1536                                .next_value_seed(
1537                                    ::buffa::json_helpers::NullableDeserializeSeed(
1538                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
1539                                            TriggerLimitIoc,
1540                                        >::new(),
1541                                    ),
1542                                )?;
1543                            if let Some(v) = v {
1544                                if __oneof_execution.is_some() {
1545                                    return Err(
1546                                        serde::de::Error::custom(
1547                                            "multiple oneof fields set for 'execution'",
1548                                        ),
1549                                    );
1550                                }
1551                                __oneof_execution = Some(
1552                                    __buffa::oneof::conditional_child_execution::Execution::LimitIoc(
1553                                        ::buffa::alloc::boxed::Box::new(v),
1554                                    ),
1555                                );
1556                            }
1557                        }
1558                        "limitFok" | "limit_fok" => {
1559                            let v: ::core::option::Option<TriggerLimitFok> = map
1560                                .next_value_seed(
1561                                    ::buffa::json_helpers::NullableDeserializeSeed(
1562                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
1563                                            TriggerLimitFok,
1564                                        >::new(),
1565                                    ),
1566                                )?;
1567                            if let Some(v) = v {
1568                                if __oneof_execution.is_some() {
1569                                    return Err(
1570                                        serde::de::Error::custom(
1571                                            "multiple oneof fields set for 'execution'",
1572                                        ),
1573                                    );
1574                                }
1575                                __oneof_execution = Some(
1576                                    __buffa::oneof::conditional_child_execution::Execution::LimitFok(
1577                                        ::buffa::alloc::boxed::Box::new(v),
1578                                    ),
1579                                );
1580                            }
1581                        }
1582                        _ => {
1583                            map.next_value::<serde::de::IgnoredAny>()?;
1584                        }
1585                    }
1586                }
1587                let mut __r = <ConditionalChildExecution as ::core::default::Default>::default();
1588                __r.execution = __oneof_execution;
1589                Ok(__r)
1590            }
1591        }
1592        d.deserialize_map(_V)
1593    }
1594}
1595impl ::buffa::json_helpers::ProtoElemJson for ConditionalChildExecution {
1596    fn serialize_proto_json<S: ::serde::Serializer>(
1597        v: &Self,
1598        s: S,
1599    ) -> ::core::result::Result<S::Ok, S::Error> {
1600        ::serde::Serialize::serialize(v, s)
1601    }
1602    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1603        d: D,
1604    ) -> ::core::result::Result<Self, D::Error> {
1605        <Self as ::serde::Deserialize>::deserialize(d)
1606    }
1607}
1608#[doc(hidden)]
1609pub const __CONDITIONAL_CHILD_EXECUTION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1610    type_url: "type.googleapis.com/triggers.v1.ConditionalChildExecution",
1611    to_json: ::buffa::type_registry::any_to_json::<ConditionalChildExecution>,
1612    from_json: ::buffa::type_registry::any_from_json::<ConditionalChildExecution>,
1613    is_wkt: false,
1614};
1615pub mod conditional_child_execution {
1616    #[allow(unused_imports)]
1617    use super::*;
1618    #[doc(inline)]
1619    pub use super::__buffa::oneof::conditional_child_execution::Execution;
1620    #[doc(inline)]
1621    pub use super::__buffa::view::oneof::conditional_child_execution::Execution as ExecutionView;
1622}
1623/// ConditionalTrigger configures a standalone stop-loss or take-profit.
1624#[derive(Clone, PartialEq, Default)]
1625#[derive(::serde::Serialize, ::serde::Deserialize)]
1626#[serde(default)]
1627pub struct ConditionalTrigger {
1628    /// Trigger threshold in quote units scaled by 1e6.
1629    ///
1630    /// Field 1: `trigger_price_ticks`
1631    #[serde(
1632        rename = "triggerPriceTicks",
1633        alias = "trigger_price_ticks",
1634        with = "::buffa::json_helpers::int64",
1635        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1636    )]
1637    pub trigger_price_ticks: i64,
1638    /// Child order side.
1639    ///
1640    /// Field 2: `side`
1641    #[serde(
1642        rename = "side",
1643        with = "::buffa::json_helpers::proto_enum",
1644        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
1645    )]
1646    pub side: ::buffa::EnumValue<super::super::orders::v1::Side>,
1647    /// Child execution.
1648    ///
1649    /// Field 3: `child`
1650    #[serde(
1651        rename = "child",
1652        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1653    )]
1654    pub child: ::buffa::MessageField<ConditionalChildExecution>,
1655    #[serde(skip)]
1656    #[doc(hidden)]
1657    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1658}
1659impl ::core::fmt::Debug for ConditionalTrigger {
1660    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1661        f.debug_struct("ConditionalTrigger")
1662            .field("trigger_price_ticks", &self.trigger_price_ticks)
1663            .field("side", &self.side)
1664            .field("child", &self.child)
1665            .finish()
1666    }
1667}
1668impl ConditionalTrigger {
1669    /// Protobuf type URL for this message, for use with `Any::pack` and
1670    /// `Any::unpack_if`.
1671    ///
1672    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1673    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalTrigger";
1674}
1675::buffa::impl_default_instance!(ConditionalTrigger);
1676impl ::buffa::MessageName for ConditionalTrigger {
1677    const PACKAGE: &'static str = "triggers.v1";
1678    const NAME: &'static str = "ConditionalTrigger";
1679    const FULL_NAME: &'static str = "triggers.v1.ConditionalTrigger";
1680    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalTrigger";
1681}
1682impl ::buffa::Message for ConditionalTrigger {
1683    /// Returns the total encoded size in bytes.
1684    ///
1685    /// The result is a `u32`; the protobuf specification requires all
1686    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1687    /// compliant message will never overflow this type.
1688    #[allow(clippy::let_and_return)]
1689    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1690        #[allow(unused_imports)]
1691        use ::buffa::Enumeration as _;
1692        let mut size = 0u32;
1693        if self.trigger_price_ticks != 0i64 {
1694            size
1695                += 1u32
1696                    + ::buffa::types::int64_encoded_len(self.trigger_price_ticks) as u32;
1697        }
1698        {
1699            let val = self.side.to_i32();
1700            if val != 0 {
1701                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1702            }
1703        }
1704        if self.child.is_set() {
1705            let __slot = __cache.reserve();
1706            let inner_size = self.child.compute_size(__cache);
1707            __cache.set(__slot, inner_size);
1708            size
1709                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1710                    + inner_size;
1711        }
1712        size += self.__buffa_unknown_fields.encoded_len() as u32;
1713        size
1714    }
1715    fn write_to(
1716        &self,
1717        __cache: &mut ::buffa::SizeCache,
1718        buf: &mut impl ::buffa::bytes::BufMut,
1719    ) {
1720        #[allow(unused_imports)]
1721        use ::buffa::Enumeration as _;
1722        if self.trigger_price_ticks != 0i64 {
1723            ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
1724        }
1725        {
1726            let val = self.side.to_i32();
1727            if val != 0 {
1728                ::buffa::types::put_int32_field(2u32, val, buf);
1729            }
1730        }
1731        if self.child.is_set() {
1732            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
1733            self.child.write_to(__cache, buf);
1734        }
1735        self.__buffa_unknown_fields.write_to(buf);
1736    }
1737    fn merge_field(
1738        &mut self,
1739        tag: ::buffa::encoding::Tag,
1740        buf: &mut impl ::buffa::bytes::Buf,
1741        ctx: ::buffa::DecodeContext<'_>,
1742    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1743        #[allow(unused_imports)]
1744        use ::buffa::bytes::Buf as _;
1745        #[allow(unused_imports)]
1746        use ::buffa::Enumeration as _;
1747        match tag.field_number() {
1748            1u32 => {
1749                ::buffa::encoding::check_wire_type(
1750                    tag,
1751                    ::buffa::encoding::WireType::Varint,
1752                )?;
1753                self.trigger_price_ticks = ::buffa::types::decode_int64(buf)?;
1754            }
1755            2u32 => {
1756                ::buffa::encoding::check_wire_type(
1757                    tag,
1758                    ::buffa::encoding::WireType::Varint,
1759                )?;
1760                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
1761            }
1762            3u32 => {
1763                ::buffa::encoding::check_wire_type(
1764                    tag,
1765                    ::buffa::encoding::WireType::LengthDelimited,
1766                )?;
1767                ::buffa::Message::merge_length_delimited(
1768                    self.child.get_or_insert_default(),
1769                    buf,
1770                    ctx,
1771                )?;
1772            }
1773            _ => {
1774                self.__buffa_unknown_fields
1775                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1776            }
1777        }
1778        ::core::result::Result::Ok(())
1779    }
1780    fn clear(&mut self) {
1781        self.trigger_price_ticks = 0i64;
1782        self.side = ::buffa::EnumValue::from(0);
1783        self.child = ::buffa::MessageField::none();
1784        self.__buffa_unknown_fields.clear();
1785    }
1786}
1787impl ::buffa::ExtensionSet for ConditionalTrigger {
1788    const PROTO_FQN: &'static str = "triggers.v1.ConditionalTrigger";
1789    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1790        &self.__buffa_unknown_fields
1791    }
1792    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1793        &mut self.__buffa_unknown_fields
1794    }
1795}
1796impl ::buffa::json_helpers::ProtoElemJson for ConditionalTrigger {
1797    fn serialize_proto_json<S: ::serde::Serializer>(
1798        v: &Self,
1799        s: S,
1800    ) -> ::core::result::Result<S::Ok, S::Error> {
1801        ::serde::Serialize::serialize(v, s)
1802    }
1803    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1804        d: D,
1805    ) -> ::core::result::Result<Self, D::Error> {
1806        <Self as ::serde::Deserialize>::deserialize(d)
1807    }
1808}
1809#[doc(hidden)]
1810pub const __CONDITIONAL_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1811    type_url: "type.googleapis.com/triggers.v1.ConditionalTrigger",
1812    to_json: ::buffa::type_registry::any_to_json::<ConditionalTrigger>,
1813    from_json: ::buffa::type_registry::any_from_json::<ConditionalTrigger>,
1814    is_wkt: false,
1815};
1816/// TrailingStopTrigger configures the supported spot trailing-stop strategy.
1817/// It tracks last trade price and submits a SELL market-IOC child when fired.
1818#[derive(Clone, PartialEq, Default)]
1819#[derive(::serde::Serialize)]
1820#[serde(default)]
1821pub struct TrailingStopTrigger {
1822    /// Optional activation price in quote units scaled by 1e6.
1823    ///
1824    /// Field 3: `activation_price_ticks`
1825    #[serde(
1826        rename = "activationPriceTicks",
1827        alias = "activation_price_ticks",
1828        with = "::buffa::json_helpers::int64",
1829        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1830    )]
1831    pub activation_price_ticks: i64,
1832    #[serde(flatten)]
1833    pub trailing_distance: ::core::option::Option<
1834        __buffa::oneof::trailing_stop_trigger::TrailingDistance,
1835    >,
1836    #[serde(flatten)]
1837    pub max_slippage: ::core::option::Option<
1838        __buffa::oneof::trailing_stop_trigger::MaxSlippage,
1839    >,
1840    #[serde(skip)]
1841    #[doc(hidden)]
1842    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1843}
1844impl ::core::fmt::Debug for TrailingStopTrigger {
1845    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1846        f.debug_struct("TrailingStopTrigger")
1847            .field("activation_price_ticks", &self.activation_price_ticks)
1848            .field("trailing_distance", &self.trailing_distance)
1849            .field("max_slippage", &self.max_slippage)
1850            .finish()
1851    }
1852}
1853impl TrailingStopTrigger {
1854    /// Protobuf type URL for this message, for use with `Any::pack` and
1855    /// `Any::unpack_if`.
1856    ///
1857    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1858    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
1859}
1860::buffa::impl_default_instance!(TrailingStopTrigger);
1861impl ::buffa::MessageName for TrailingStopTrigger {
1862    const PACKAGE: &'static str = "triggers.v1";
1863    const NAME: &'static str = "TrailingStopTrigger";
1864    const FULL_NAME: &'static str = "triggers.v1.TrailingStopTrigger";
1865    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
1866}
1867impl ::buffa::Message for TrailingStopTrigger {
1868    /// Returns the total encoded size in bytes.
1869    ///
1870    /// The result is a `u32`; the protobuf specification requires all
1871    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1872    /// compliant message will never overflow this type.
1873    #[allow(clippy::let_and_return)]
1874    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1875        #[allow(unused_imports)]
1876        use ::buffa::Enumeration as _;
1877        let mut size = 0u32;
1878        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
1879            match v {
1880                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
1881                    v,
1882                ) => {
1883                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
1884                }
1885                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
1886                    v,
1887                ) => {
1888                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1889                }
1890            }
1891        }
1892        if self.activation_price_ticks != 0i64 {
1893            size
1894                += 1u32
1895                    + ::buffa::types::int64_encoded_len(self.activation_price_ticks)
1896                        as u32;
1897        }
1898        if let ::core::option::Option::Some(ref v) = self.max_slippage {
1899            match v {
1900                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
1901                    v,
1902                ) => {
1903                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1904                }
1905                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
1906                    v,
1907                ) => {
1908                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1909                }
1910            }
1911        }
1912        size += self.__buffa_unknown_fields.encoded_len() as u32;
1913        size
1914    }
1915    fn write_to(
1916        &self,
1917        _cache: &mut ::buffa::SizeCache,
1918        buf: &mut impl ::buffa::bytes::BufMut,
1919    ) {
1920        #[allow(unused_imports)]
1921        use ::buffa::Enumeration as _;
1922        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
1923            match v {
1924                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
1925                    x,
1926                ) => {
1927                    ::buffa::types::put_int64_field(1u32, *x, buf);
1928                }
1929                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
1930                    x,
1931                ) => {
1932                    ::buffa::types::put_int32_field(2u32, *x, buf);
1933                }
1934            }
1935        }
1936        if self.activation_price_ticks != 0i64 {
1937            ::buffa::types::put_int64_field(3u32, self.activation_price_ticks, buf);
1938        }
1939        if let ::core::option::Option::Some(ref v) = self.max_slippage {
1940            match v {
1941                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
1942                    x,
1943                ) => {
1944                    ::buffa::types::put_int32_field(4u32, *x, buf);
1945                }
1946                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
1947                    x,
1948                ) => {
1949                    ::buffa::types::put_int32_field(5u32, *x, buf);
1950                }
1951            }
1952        }
1953        self.__buffa_unknown_fields.write_to(buf);
1954    }
1955    fn merge_field(
1956        &mut self,
1957        tag: ::buffa::encoding::Tag,
1958        buf: &mut impl ::buffa::bytes::Buf,
1959        ctx: ::buffa::DecodeContext<'_>,
1960    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1961        #[allow(unused_imports)]
1962        use ::buffa::bytes::Buf as _;
1963        #[allow(unused_imports)]
1964        use ::buffa::Enumeration as _;
1965        match tag.field_number() {
1966            1u32 => {
1967                ::buffa::encoding::check_wire_type(
1968                    tag,
1969                    ::buffa::encoding::WireType::Varint,
1970                )?;
1971                self.trailing_distance = ::core::option::Option::Some(
1972                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
1973                        ::buffa::types::decode_int64(buf)?,
1974                    ),
1975                );
1976            }
1977            2u32 => {
1978                ::buffa::encoding::check_wire_type(
1979                    tag,
1980                    ::buffa::encoding::WireType::Varint,
1981                )?;
1982                self.trailing_distance = ::core::option::Option::Some(
1983                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
1984                        ::buffa::types::decode_int32(buf)?,
1985                    ),
1986                );
1987            }
1988            3u32 => {
1989                ::buffa::encoding::check_wire_type(
1990                    tag,
1991                    ::buffa::encoding::WireType::Varint,
1992                )?;
1993                self.activation_price_ticks = ::buffa::types::decode_int64(buf)?;
1994            }
1995            4u32 => {
1996                ::buffa::encoding::check_wire_type(
1997                    tag,
1998                    ::buffa::encoding::WireType::Varint,
1999                )?;
2000                self.max_slippage = ::core::option::Option::Some(
2001                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
2002                        ::buffa::types::decode_int32(buf)?,
2003                    ),
2004                );
2005            }
2006            5u32 => {
2007                ::buffa::encoding::check_wire_type(
2008                    tag,
2009                    ::buffa::encoding::WireType::Varint,
2010                )?;
2011                self.max_slippage = ::core::option::Option::Some(
2012                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
2013                        ::buffa::types::decode_int32(buf)?,
2014                    ),
2015                );
2016            }
2017            _ => {
2018                self.__buffa_unknown_fields
2019                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2020            }
2021        }
2022        ::core::result::Result::Ok(())
2023    }
2024    fn clear(&mut self) {
2025        self.trailing_distance = ::core::option::Option::None;
2026        self.activation_price_ticks = 0i64;
2027        self.max_slippage = ::core::option::Option::None;
2028        self.__buffa_unknown_fields.clear();
2029    }
2030}
2031impl ::buffa::ExtensionSet for TrailingStopTrigger {
2032    const PROTO_FQN: &'static str = "triggers.v1.TrailingStopTrigger";
2033    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2034        &self.__buffa_unknown_fields
2035    }
2036    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2037        &mut self.__buffa_unknown_fields
2038    }
2039}
2040impl<'de> serde::Deserialize<'de> for TrailingStopTrigger {
2041    fn deserialize<D: serde::Deserializer<'de>>(
2042        d: D,
2043    ) -> ::core::result::Result<Self, D::Error> {
2044        struct _V;
2045        impl<'de> serde::de::Visitor<'de> for _V {
2046            type Value = TrailingStopTrigger;
2047            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2048                f.write_str("struct TrailingStopTrigger")
2049            }
2050            #[allow(clippy::field_reassign_with_default)]
2051            fn visit_map<A: serde::de::MapAccess<'de>>(
2052                self,
2053                mut map: A,
2054            ) -> ::core::result::Result<TrailingStopTrigger, A::Error> {
2055                let mut __f_activation_price_ticks: ::core::option::Option<i64> = None;
2056                let mut __oneof_trailing_distance: ::core::option::Option<
2057                    __buffa::oneof::trailing_stop_trigger::TrailingDistance,
2058                > = None;
2059                let mut __oneof_max_slippage: ::core::option::Option<
2060                    __buffa::oneof::trailing_stop_trigger::MaxSlippage,
2061                > = None;
2062                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
2063                    match key.as_str() {
2064                        "activationPriceTicks" | "activation_price_ticks" => {
2065                            __f_activation_price_ticks = Some({
2066                                struct _S;
2067                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2068                                    type Value = i64;
2069                                    fn deserialize<D: serde::Deserializer<'de>>(
2070                                        self,
2071                                        d: D,
2072                                    ) -> ::core::result::Result<i64, D::Error> {
2073                                        ::buffa::json_helpers::int64::deserialize(d)
2074                                    }
2075                                }
2076                                map.next_value_seed(_S)?
2077                            });
2078                        }
2079                        "trailingDistanceTicks" | "trailing_distance_ticks" => {
2080                            struct _DeserSeed;
2081                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2082                                type Value = i64;
2083                                fn deserialize<D: serde::Deserializer<'de>>(
2084                                    self,
2085                                    d: D,
2086                                ) -> ::core::result::Result<i64, D::Error> {
2087                                    ::buffa::json_helpers::int64::deserialize(d)
2088                                }
2089                            }
2090                            let v: ::core::option::Option<i64> = map
2091                                .next_value_seed(
2092                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2093                                )?;
2094                            if let Some(v) = v {
2095                                if __oneof_trailing_distance.is_some() {
2096                                    return Err(
2097                                        serde::de::Error::custom(
2098                                            "multiple oneof fields set for 'trailing_distance'",
2099                                        ),
2100                                    );
2101                                }
2102                                __oneof_trailing_distance = Some(
2103                                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
2104                                        v,
2105                                    ),
2106                                );
2107                            }
2108                        }
2109                        "trailingDistanceBps" | "trailing_distance_bps" => {
2110                            struct _DeserSeed;
2111                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2112                                type Value = i32;
2113                                fn deserialize<D: serde::Deserializer<'de>>(
2114                                    self,
2115                                    d: D,
2116                                ) -> ::core::result::Result<i32, D::Error> {
2117                                    ::buffa::json_helpers::int32::deserialize(d)
2118                                }
2119                            }
2120                            let v: ::core::option::Option<i32> = map
2121                                .next_value_seed(
2122                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2123                                )?;
2124                            if let Some(v) = v {
2125                                if __oneof_trailing_distance.is_some() {
2126                                    return Err(
2127                                        serde::de::Error::custom(
2128                                            "multiple oneof fields set for 'trailing_distance'",
2129                                        ),
2130                                    );
2131                                }
2132                                __oneof_trailing_distance = Some(
2133                                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
2134                                        v,
2135                                    ),
2136                                );
2137                            }
2138                        }
2139                        "maxSlippageTicks" | "max_slippage_ticks" => {
2140                            struct _DeserSeed;
2141                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2142                                type Value = i32;
2143                                fn deserialize<D: serde::Deserializer<'de>>(
2144                                    self,
2145                                    d: D,
2146                                ) -> ::core::result::Result<i32, D::Error> {
2147                                    ::buffa::json_helpers::int32::deserialize(d)
2148                                }
2149                            }
2150                            let v: ::core::option::Option<i32> = map
2151                                .next_value_seed(
2152                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2153                                )?;
2154                            if let Some(v) = v {
2155                                if __oneof_max_slippage.is_some() {
2156                                    return Err(
2157                                        serde::de::Error::custom(
2158                                            "multiple oneof fields set for 'max_slippage'",
2159                                        ),
2160                                    );
2161                                }
2162                                __oneof_max_slippage = Some(
2163                                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
2164                                        v,
2165                                    ),
2166                                );
2167                            }
2168                        }
2169                        "maxSlippageBps" | "max_slippage_bps" => {
2170                            struct _DeserSeed;
2171                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2172                                type Value = i32;
2173                                fn deserialize<D: serde::Deserializer<'de>>(
2174                                    self,
2175                                    d: D,
2176                                ) -> ::core::result::Result<i32, D::Error> {
2177                                    ::buffa::json_helpers::int32::deserialize(d)
2178                                }
2179                            }
2180                            let v: ::core::option::Option<i32> = map
2181                                .next_value_seed(
2182                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2183                                )?;
2184                            if let Some(v) = v {
2185                                if __oneof_max_slippage.is_some() {
2186                                    return Err(
2187                                        serde::de::Error::custom(
2188                                            "multiple oneof fields set for 'max_slippage'",
2189                                        ),
2190                                    );
2191                                }
2192                                __oneof_max_slippage = Some(
2193                                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
2194                                        v,
2195                                    ),
2196                                );
2197                            }
2198                        }
2199                        _ => {
2200                            map.next_value::<serde::de::IgnoredAny>()?;
2201                        }
2202                    }
2203                }
2204                let mut __r = <TrailingStopTrigger as ::core::default::Default>::default();
2205                if let ::core::option::Option::Some(v) = __f_activation_price_ticks {
2206                    __r.activation_price_ticks = v;
2207                }
2208                __r.trailing_distance = __oneof_trailing_distance;
2209                __r.max_slippage = __oneof_max_slippage;
2210                Ok(__r)
2211            }
2212        }
2213        d.deserialize_map(_V)
2214    }
2215}
2216impl ::buffa::json_helpers::ProtoElemJson for TrailingStopTrigger {
2217    fn serialize_proto_json<S: ::serde::Serializer>(
2218        v: &Self,
2219        s: S,
2220    ) -> ::core::result::Result<S::Ok, S::Error> {
2221        ::serde::Serialize::serialize(v, s)
2222    }
2223    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2224        d: D,
2225    ) -> ::core::result::Result<Self, D::Error> {
2226        <Self as ::serde::Deserialize>::deserialize(d)
2227    }
2228}
2229#[doc(hidden)]
2230pub const __TRAILING_STOP_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2231    type_url: "type.googleapis.com/triggers.v1.TrailingStopTrigger",
2232    to_json: ::buffa::type_registry::any_to_json::<TrailingStopTrigger>,
2233    from_json: ::buffa::type_registry::any_from_json::<TrailingStopTrigger>,
2234    is_wkt: false,
2235};
2236pub mod trailing_stop_trigger {
2237    #[allow(unused_imports)]
2238    use super::*;
2239    #[doc(inline)]
2240    pub use super::__buffa::oneof::trailing_stop_trigger::TrailingDistance;
2241    #[doc(inline)]
2242    pub use super::__buffa::oneof::trailing_stop_trigger::MaxSlippage;
2243    #[doc(inline)]
2244    pub use super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance as TrailingDistanceView;
2245    #[doc(inline)]
2246    pub use super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage as MaxSlippageView;
2247}
2248/// TwapMarketIoc configures server-priced market-IOC slices.
2249#[derive(Clone, PartialEq, Default)]
2250#[derive(::serde::Serialize, ::serde::Deserialize)]
2251#[serde(default)]
2252pub struct TwapMarketIoc {
2253    #[serde(skip)]
2254    #[doc(hidden)]
2255    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2256}
2257impl ::core::fmt::Debug for TwapMarketIoc {
2258    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2259        f.debug_struct("TwapMarketIoc").finish()
2260    }
2261}
2262impl TwapMarketIoc {
2263    /// Protobuf type URL for this message, for use with `Any::pack` and
2264    /// `Any::unpack_if`.
2265    ///
2266    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2267    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
2268}
2269::buffa::impl_default_instance!(TwapMarketIoc);
2270impl ::buffa::MessageName for TwapMarketIoc {
2271    const PACKAGE: &'static str = "triggers.v1";
2272    const NAME: &'static str = "TwapMarketIoc";
2273    const FULL_NAME: &'static str = "triggers.v1.TwapMarketIoc";
2274    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
2275}
2276impl ::buffa::Message for TwapMarketIoc {
2277    /// Returns the total encoded size in bytes.
2278    ///
2279    /// The result is a `u32`; the protobuf specification requires all
2280    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2281    /// compliant message will never overflow this type.
2282    #[allow(clippy::let_and_return)]
2283    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2284        #[allow(unused_imports)]
2285        use ::buffa::Enumeration as _;
2286        let mut size = 0u32;
2287        size += self.__buffa_unknown_fields.encoded_len() as u32;
2288        size
2289    }
2290    fn write_to(
2291        &self,
2292        _cache: &mut ::buffa::SizeCache,
2293        buf: &mut impl ::buffa::bytes::BufMut,
2294    ) {
2295        #[allow(unused_imports)]
2296        use ::buffa::Enumeration as _;
2297        self.__buffa_unknown_fields.write_to(buf);
2298    }
2299    fn merge_field(
2300        &mut self,
2301        tag: ::buffa::encoding::Tag,
2302        buf: &mut impl ::buffa::bytes::Buf,
2303        ctx: ::buffa::DecodeContext<'_>,
2304    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2305        #[allow(unused_imports)]
2306        use ::buffa::bytes::Buf as _;
2307        #[allow(unused_imports)]
2308        use ::buffa::Enumeration as _;
2309        match tag.field_number() {
2310            _ => {
2311                self.__buffa_unknown_fields
2312                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2313            }
2314        }
2315        ::core::result::Result::Ok(())
2316    }
2317    fn clear(&mut self) {
2318        self.__buffa_unknown_fields.clear();
2319    }
2320}
2321impl ::buffa::ExtensionSet for TwapMarketIoc {
2322    const PROTO_FQN: &'static str = "triggers.v1.TwapMarketIoc";
2323    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2324        &self.__buffa_unknown_fields
2325    }
2326    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2327        &mut self.__buffa_unknown_fields
2328    }
2329}
2330impl ::buffa::json_helpers::ProtoElemJson for TwapMarketIoc {
2331    fn serialize_proto_json<S: ::serde::Serializer>(
2332        v: &Self,
2333        s: S,
2334    ) -> ::core::result::Result<S::Ok, S::Error> {
2335        ::serde::Serialize::serialize(v, s)
2336    }
2337    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2338        d: D,
2339    ) -> ::core::result::Result<Self, D::Error> {
2340        <Self as ::serde::Deserialize>::deserialize(d)
2341    }
2342}
2343#[doc(hidden)]
2344pub const __TWAP_MARKET_IOC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2345    type_url: "type.googleapis.com/triggers.v1.TwapMarketIoc",
2346    to_json: ::buffa::type_registry::any_to_json::<TwapMarketIoc>,
2347    from_json: ::buffa::type_registry::any_from_json::<TwapMarketIoc>,
2348    is_wkt: false,
2349};
2350/// TwapLimitGtc configures one resting limit slice at a time. A previous open
2351/// slice is canceled before the next interval.
2352#[derive(Clone, PartialEq, Default)]
2353#[derive(::serde::Serialize, ::serde::Deserialize)]
2354#[serde(default)]
2355pub struct TwapLimitGtc {
2356    /// Slice limit price in quote units scaled by 1e6.
2357    ///
2358    /// Field 1: `price_ticks`
2359    #[serde(
2360        rename = "priceTicks",
2361        alias = "price_ticks",
2362        with = "::buffa::json_helpers::int64",
2363        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2364    )]
2365    pub price_ticks: i64,
2366    #[serde(skip)]
2367    #[doc(hidden)]
2368    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2369}
2370impl ::core::fmt::Debug for TwapLimitGtc {
2371    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2372        f.debug_struct("TwapLimitGtc").field("price_ticks", &self.price_ticks).finish()
2373    }
2374}
2375impl TwapLimitGtc {
2376    /// Protobuf type URL for this message, for use with `Any::pack` and
2377    /// `Any::unpack_if`.
2378    ///
2379    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2380    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
2381}
2382::buffa::impl_default_instance!(TwapLimitGtc);
2383impl ::buffa::MessageName for TwapLimitGtc {
2384    const PACKAGE: &'static str = "triggers.v1";
2385    const NAME: &'static str = "TwapLimitGtc";
2386    const FULL_NAME: &'static str = "triggers.v1.TwapLimitGtc";
2387    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
2388}
2389impl ::buffa::Message for TwapLimitGtc {
2390    /// Returns the total encoded size in bytes.
2391    ///
2392    /// The result is a `u32`; the protobuf specification requires all
2393    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2394    /// compliant message will never overflow this type.
2395    #[allow(clippy::let_and_return)]
2396    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2397        #[allow(unused_imports)]
2398        use ::buffa::Enumeration as _;
2399        let mut size = 0u32;
2400        if self.price_ticks != 0i64 {
2401            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
2402        }
2403        size += self.__buffa_unknown_fields.encoded_len() as u32;
2404        size
2405    }
2406    fn write_to(
2407        &self,
2408        _cache: &mut ::buffa::SizeCache,
2409        buf: &mut impl ::buffa::bytes::BufMut,
2410    ) {
2411        #[allow(unused_imports)]
2412        use ::buffa::Enumeration as _;
2413        if self.price_ticks != 0i64 {
2414            ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
2415        }
2416        self.__buffa_unknown_fields.write_to(buf);
2417    }
2418    fn merge_field(
2419        &mut self,
2420        tag: ::buffa::encoding::Tag,
2421        buf: &mut impl ::buffa::bytes::Buf,
2422        ctx: ::buffa::DecodeContext<'_>,
2423    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2424        #[allow(unused_imports)]
2425        use ::buffa::bytes::Buf as _;
2426        #[allow(unused_imports)]
2427        use ::buffa::Enumeration as _;
2428        match tag.field_number() {
2429            1u32 => {
2430                ::buffa::encoding::check_wire_type(
2431                    tag,
2432                    ::buffa::encoding::WireType::Varint,
2433                )?;
2434                self.price_ticks = ::buffa::types::decode_int64(buf)?;
2435            }
2436            _ => {
2437                self.__buffa_unknown_fields
2438                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2439            }
2440        }
2441        ::core::result::Result::Ok(())
2442    }
2443    fn clear(&mut self) {
2444        self.price_ticks = 0i64;
2445        self.__buffa_unknown_fields.clear();
2446    }
2447}
2448impl ::buffa::ExtensionSet for TwapLimitGtc {
2449    const PROTO_FQN: &'static str = "triggers.v1.TwapLimitGtc";
2450    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2451        &self.__buffa_unknown_fields
2452    }
2453    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2454        &mut self.__buffa_unknown_fields
2455    }
2456}
2457impl ::buffa::json_helpers::ProtoElemJson for TwapLimitGtc {
2458    fn serialize_proto_json<S: ::serde::Serializer>(
2459        v: &Self,
2460        s: S,
2461    ) -> ::core::result::Result<S::Ok, S::Error> {
2462        ::serde::Serialize::serialize(v, s)
2463    }
2464    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2465        d: D,
2466    ) -> ::core::result::Result<Self, D::Error> {
2467        <Self as ::serde::Deserialize>::deserialize(d)
2468    }
2469}
2470#[doc(hidden)]
2471pub const __TWAP_LIMIT_GTC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2472    type_url: "type.googleapis.com/triggers.v1.TwapLimitGtc",
2473    to_json: ::buffa::type_registry::any_to_json::<TwapLimitGtc>,
2474    from_json: ::buffa::type_registry::any_from_json::<TwapLimitGtc>,
2475    is_wkt: false,
2476};
2477/// TwapTrigger configures a proven TWAP execution mode.
2478#[derive(Clone, PartialEq, Default)]
2479#[derive(::serde::Serialize)]
2480#[serde(default)]
2481pub struct TwapTrigger {
2482    /// Child side.
2483    ///
2484    /// Field 1: `side`
2485    #[serde(
2486        rename = "side",
2487        with = "::buffa::json_helpers::proto_enum",
2488        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2489    )]
2490    pub side: ::buffa::EnumValue<super::super::orders::v1::Side>,
2491    /// Total execution duration in milliseconds.
2492    ///
2493    /// Field 2: `duration_ms`
2494    #[serde(
2495        rename = "durationMs",
2496        alias = "duration_ms",
2497        with = "::buffa::json_helpers::int64",
2498        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2499    )]
2500    pub duration_ms: i64,
2501    /// Interval between slices in milliseconds.
2502    ///
2503    /// Field 3: `slice_interval_ms`
2504    #[serde(
2505        rename = "sliceIntervalMs",
2506        alias = "slice_interval_ms",
2507        with = "::buffa::json_helpers::int64",
2508        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2509    )]
2510    pub slice_interval_ms: i64,
2511    #[serde(flatten)]
2512    pub execution: ::core::option::Option<__buffa::oneof::twap_trigger::Execution>,
2513    #[serde(skip)]
2514    #[doc(hidden)]
2515    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2516}
2517impl ::core::fmt::Debug for TwapTrigger {
2518    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2519        f.debug_struct("TwapTrigger")
2520            .field("side", &self.side)
2521            .field("duration_ms", &self.duration_ms)
2522            .field("slice_interval_ms", &self.slice_interval_ms)
2523            .field("execution", &self.execution)
2524            .finish()
2525    }
2526}
2527impl TwapTrigger {
2528    /// Protobuf type URL for this message, for use with `Any::pack` and
2529    /// `Any::unpack_if`.
2530    ///
2531    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2532    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
2533}
2534::buffa::impl_default_instance!(TwapTrigger);
2535impl ::buffa::MessageName for TwapTrigger {
2536    const PACKAGE: &'static str = "triggers.v1";
2537    const NAME: &'static str = "TwapTrigger";
2538    const FULL_NAME: &'static str = "triggers.v1.TwapTrigger";
2539    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
2540}
2541impl ::buffa::Message for TwapTrigger {
2542    /// Returns the total encoded size in bytes.
2543    ///
2544    /// The result is a `u32`; the protobuf specification requires all
2545    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2546    /// compliant message will never overflow this type.
2547    #[allow(clippy::let_and_return)]
2548    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2549        #[allow(unused_imports)]
2550        use ::buffa::Enumeration as _;
2551        let mut size = 0u32;
2552        {
2553            let val = self.side.to_i32();
2554            if val != 0 {
2555                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2556            }
2557        }
2558        if self.duration_ms != 0i64 {
2559            size += 1u32 + ::buffa::types::int64_encoded_len(self.duration_ms) as u32;
2560        }
2561        if self.slice_interval_ms != 0i64 {
2562            size
2563                += 1u32
2564                    + ::buffa::types::int64_encoded_len(self.slice_interval_ms) as u32;
2565        }
2566        if let ::core::option::Option::Some(ref v) = self.execution {
2567            match v {
2568                __buffa::oneof::twap_trigger::Execution::MarketIoc(x) => {
2569                    let __slot = __cache.reserve();
2570                    let inner = x.compute_size(__cache);
2571                    __cache.set(__slot, inner);
2572                    size
2573                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
2574                            + inner;
2575                }
2576                __buffa::oneof::twap_trigger::Execution::LimitGtc(x) => {
2577                    let __slot = __cache.reserve();
2578                    let inner = x.compute_size(__cache);
2579                    __cache.set(__slot, inner);
2580                    size
2581                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
2582                            + inner;
2583                }
2584            }
2585        }
2586        size += self.__buffa_unknown_fields.encoded_len() as u32;
2587        size
2588    }
2589    fn write_to(
2590        &self,
2591        __cache: &mut ::buffa::SizeCache,
2592        buf: &mut impl ::buffa::bytes::BufMut,
2593    ) {
2594        #[allow(unused_imports)]
2595        use ::buffa::Enumeration as _;
2596        {
2597            let val = self.side.to_i32();
2598            if val != 0 {
2599                ::buffa::types::put_int32_field(1u32, val, buf);
2600            }
2601        }
2602        if self.duration_ms != 0i64 {
2603            ::buffa::types::put_int64_field(2u32, self.duration_ms, buf);
2604        }
2605        if self.slice_interval_ms != 0i64 {
2606            ::buffa::types::put_int64_field(3u32, self.slice_interval_ms, buf);
2607        }
2608        if let ::core::option::Option::Some(ref v) = self.execution {
2609            match v {
2610                __buffa::oneof::twap_trigger::Execution::MarketIoc(x) => {
2611                    ::buffa::types::put_len_delimited_header(
2612                        4u32,
2613                        __cache.consume_next(),
2614                        buf,
2615                    );
2616                    x.write_to(__cache, buf);
2617                }
2618                __buffa::oneof::twap_trigger::Execution::LimitGtc(x) => {
2619                    ::buffa::types::put_len_delimited_header(
2620                        5u32,
2621                        __cache.consume_next(),
2622                        buf,
2623                    );
2624                    x.write_to(__cache, buf);
2625                }
2626            }
2627        }
2628        self.__buffa_unknown_fields.write_to(buf);
2629    }
2630    fn merge_field(
2631        &mut self,
2632        tag: ::buffa::encoding::Tag,
2633        buf: &mut impl ::buffa::bytes::Buf,
2634        ctx: ::buffa::DecodeContext<'_>,
2635    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2636        #[allow(unused_imports)]
2637        use ::buffa::bytes::Buf as _;
2638        #[allow(unused_imports)]
2639        use ::buffa::Enumeration as _;
2640        match tag.field_number() {
2641            1u32 => {
2642                ::buffa::encoding::check_wire_type(
2643                    tag,
2644                    ::buffa::encoding::WireType::Varint,
2645                )?;
2646                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
2647            }
2648            2u32 => {
2649                ::buffa::encoding::check_wire_type(
2650                    tag,
2651                    ::buffa::encoding::WireType::Varint,
2652                )?;
2653                self.duration_ms = ::buffa::types::decode_int64(buf)?;
2654            }
2655            3u32 => {
2656                ::buffa::encoding::check_wire_type(
2657                    tag,
2658                    ::buffa::encoding::WireType::Varint,
2659                )?;
2660                self.slice_interval_ms = ::buffa::types::decode_int64(buf)?;
2661            }
2662            4u32 => {
2663                ::buffa::encoding::check_wire_type(
2664                    tag,
2665                    ::buffa::encoding::WireType::LengthDelimited,
2666                )?;
2667                if let ::core::option::Option::Some(
2668                    __buffa::oneof::twap_trigger::Execution::MarketIoc(ref mut existing),
2669                ) = self.execution
2670                {
2671                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
2672                } else {
2673                    let mut val = ::core::default::Default::default();
2674                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
2675                    self.execution = ::core::option::Option::Some(
2676                        __buffa::oneof::twap_trigger::Execution::MarketIoc(
2677                            ::buffa::alloc::boxed::Box::new(val),
2678                        ),
2679                    );
2680                }
2681            }
2682            5u32 => {
2683                ::buffa::encoding::check_wire_type(
2684                    tag,
2685                    ::buffa::encoding::WireType::LengthDelimited,
2686                )?;
2687                if let ::core::option::Option::Some(
2688                    __buffa::oneof::twap_trigger::Execution::LimitGtc(ref mut existing),
2689                ) = self.execution
2690                {
2691                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
2692                } else {
2693                    let mut val = ::core::default::Default::default();
2694                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
2695                    self.execution = ::core::option::Option::Some(
2696                        __buffa::oneof::twap_trigger::Execution::LimitGtc(
2697                            ::buffa::alloc::boxed::Box::new(val),
2698                        ),
2699                    );
2700                }
2701            }
2702            _ => {
2703                self.__buffa_unknown_fields
2704                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2705            }
2706        }
2707        ::core::result::Result::Ok(())
2708    }
2709    fn clear(&mut self) {
2710        self.side = ::buffa::EnumValue::from(0);
2711        self.duration_ms = 0i64;
2712        self.slice_interval_ms = 0i64;
2713        self.execution = ::core::option::Option::None;
2714        self.__buffa_unknown_fields.clear();
2715    }
2716}
2717impl ::buffa::ExtensionSet for TwapTrigger {
2718    const PROTO_FQN: &'static str = "triggers.v1.TwapTrigger";
2719    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2720        &self.__buffa_unknown_fields
2721    }
2722    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2723        &mut self.__buffa_unknown_fields
2724    }
2725}
2726impl<'de> serde::Deserialize<'de> for TwapTrigger {
2727    fn deserialize<D: serde::Deserializer<'de>>(
2728        d: D,
2729    ) -> ::core::result::Result<Self, D::Error> {
2730        struct _V;
2731        impl<'de> serde::de::Visitor<'de> for _V {
2732            type Value = TwapTrigger;
2733            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2734                f.write_str("struct TwapTrigger")
2735            }
2736            #[allow(clippy::field_reassign_with_default)]
2737            fn visit_map<A: serde::de::MapAccess<'de>>(
2738                self,
2739                mut map: A,
2740            ) -> ::core::result::Result<TwapTrigger, A::Error> {
2741                let mut __f_side: ::core::option::Option<
2742                    ::buffa::EnumValue<super::super::orders::v1::Side>,
2743                > = None;
2744                let mut __f_duration_ms: ::core::option::Option<i64> = None;
2745                let mut __f_slice_interval_ms: ::core::option::Option<i64> = None;
2746                let mut __oneof_execution: ::core::option::Option<
2747                    __buffa::oneof::twap_trigger::Execution,
2748                > = None;
2749                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
2750                    match key.as_str() {
2751                        "side" => {
2752                            __f_side = Some({
2753                                struct _S;
2754                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2755                                    type Value = ::buffa::EnumValue<
2756                                        super::super::orders::v1::Side,
2757                                    >;
2758                                    fn deserialize<D: serde::Deserializer<'de>>(
2759                                        self,
2760                                        d: D,
2761                                    ) -> ::core::result::Result<
2762                                        ::buffa::EnumValue<super::super::orders::v1::Side>,
2763                                        D::Error,
2764                                    > {
2765                                        ::buffa::json_helpers::proto_enum::deserialize(d)
2766                                    }
2767                                }
2768                                map.next_value_seed(_S)?
2769                            });
2770                        }
2771                        "durationMs" | "duration_ms" => {
2772                            __f_duration_ms = Some({
2773                                struct _S;
2774                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2775                                    type Value = i64;
2776                                    fn deserialize<D: serde::Deserializer<'de>>(
2777                                        self,
2778                                        d: D,
2779                                    ) -> ::core::result::Result<i64, D::Error> {
2780                                        ::buffa::json_helpers::int64::deserialize(d)
2781                                    }
2782                                }
2783                                map.next_value_seed(_S)?
2784                            });
2785                        }
2786                        "sliceIntervalMs" | "slice_interval_ms" => {
2787                            __f_slice_interval_ms = Some({
2788                                struct _S;
2789                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2790                                    type Value = i64;
2791                                    fn deserialize<D: serde::Deserializer<'de>>(
2792                                        self,
2793                                        d: D,
2794                                    ) -> ::core::result::Result<i64, D::Error> {
2795                                        ::buffa::json_helpers::int64::deserialize(d)
2796                                    }
2797                                }
2798                                map.next_value_seed(_S)?
2799                            });
2800                        }
2801                        "marketIoc" | "market_ioc" => {
2802                            let v: ::core::option::Option<TwapMarketIoc> = map
2803                                .next_value_seed(
2804                                    ::buffa::json_helpers::NullableDeserializeSeed(
2805                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
2806                                            TwapMarketIoc,
2807                                        >::new(),
2808                                    ),
2809                                )?;
2810                            if let Some(v) = v {
2811                                if __oneof_execution.is_some() {
2812                                    return Err(
2813                                        serde::de::Error::custom(
2814                                            "multiple oneof fields set for 'execution'",
2815                                        ),
2816                                    );
2817                                }
2818                                __oneof_execution = Some(
2819                                    __buffa::oneof::twap_trigger::Execution::MarketIoc(
2820                                        ::buffa::alloc::boxed::Box::new(v),
2821                                    ),
2822                                );
2823                            }
2824                        }
2825                        "limitGtc" | "limit_gtc" => {
2826                            let v: ::core::option::Option<TwapLimitGtc> = map
2827                                .next_value_seed(
2828                                    ::buffa::json_helpers::NullableDeserializeSeed(
2829                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
2830                                            TwapLimitGtc,
2831                                        >::new(),
2832                                    ),
2833                                )?;
2834                            if let Some(v) = v {
2835                                if __oneof_execution.is_some() {
2836                                    return Err(
2837                                        serde::de::Error::custom(
2838                                            "multiple oneof fields set for 'execution'",
2839                                        ),
2840                                    );
2841                                }
2842                                __oneof_execution = Some(
2843                                    __buffa::oneof::twap_trigger::Execution::LimitGtc(
2844                                        ::buffa::alloc::boxed::Box::new(v),
2845                                    ),
2846                                );
2847                            }
2848                        }
2849                        _ => {
2850                            map.next_value::<serde::de::IgnoredAny>()?;
2851                        }
2852                    }
2853                }
2854                let mut __r = <TwapTrigger as ::core::default::Default>::default();
2855                if let ::core::option::Option::Some(v) = __f_side {
2856                    __r.side = v;
2857                }
2858                if let ::core::option::Option::Some(v) = __f_duration_ms {
2859                    __r.duration_ms = v;
2860                }
2861                if let ::core::option::Option::Some(v) = __f_slice_interval_ms {
2862                    __r.slice_interval_ms = v;
2863                }
2864                __r.execution = __oneof_execution;
2865                Ok(__r)
2866            }
2867        }
2868        d.deserialize_map(_V)
2869    }
2870}
2871impl ::buffa::json_helpers::ProtoElemJson for TwapTrigger {
2872    fn serialize_proto_json<S: ::serde::Serializer>(
2873        v: &Self,
2874        s: S,
2875    ) -> ::core::result::Result<S::Ok, S::Error> {
2876        ::serde::Serialize::serialize(v, s)
2877    }
2878    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2879        d: D,
2880    ) -> ::core::result::Result<Self, D::Error> {
2881        <Self as ::serde::Deserialize>::deserialize(d)
2882    }
2883}
2884#[doc(hidden)]
2885pub const __TWAP_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2886    type_url: "type.googleapis.com/triggers.v1.TwapTrigger",
2887    to_json: ::buffa::type_registry::any_to_json::<TwapTrigger>,
2888    from_json: ::buffa::type_registry::any_from_json::<TwapTrigger>,
2889    is_wkt: false,
2890};
2891pub mod twap_trigger {
2892    #[allow(unused_imports)]
2893    use super::*;
2894    #[doc(inline)]
2895    pub use super::__buffa::oneof::twap_trigger::Execution;
2896    #[doc(inline)]
2897    pub use super::__buffa::view::oneof::twap_trigger::Execution as ExecutionView;
2898}
2899/// LadderTrigger configures the supported LINEAR limit-GTC ladder. All levels
2900/// are admitted immediately and may rest concurrently.
2901#[derive(Clone, PartialEq, Default)]
2902#[derive(::serde::Serialize, ::serde::Deserialize)]
2903#[serde(default)]
2904pub struct LadderTrigger {
2905    /// Child side.
2906    ///
2907    /// Field 1: `side`
2908    #[serde(
2909        rename = "side",
2910        with = "::buffa::json_helpers::proto_enum",
2911        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2912    )]
2913    pub side: ::buffa::EnumValue<super::super::orders::v1::Side>,
2914    /// Minimum generated level price in quote units scaled by 1e6.
2915    ///
2916    /// Field 2: `price_min_ticks`
2917    #[serde(
2918        rename = "priceMinTicks",
2919        alias = "price_min_ticks",
2920        with = "::buffa::json_helpers::int64",
2921        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2922    )]
2923    pub price_min_ticks: i64,
2924    /// Maximum generated level price in quote units scaled by 1e6.
2925    ///
2926    /// Field 3: `price_max_ticks`
2927    #[serde(
2928        rename = "priceMaxTicks",
2929        alias = "price_max_ticks",
2930        with = "::buffa::json_helpers::int64",
2931        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2932    )]
2933    pub price_max_ticks: i64,
2934    /// Number of linearly distributed levels.
2935    ///
2936    /// Field 4: `levels`
2937    #[serde(
2938        rename = "levels",
2939        with = "::buffa::json_helpers::int32",
2940        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
2941    )]
2942    pub levels: i32,
2943    /// Reject each level instead of taking liquidity.
2944    ///
2945    /// Field 5: `post_only`
2946    #[serde(
2947        rename = "postOnly",
2948        alias = "post_only",
2949        with = "::buffa::json_helpers::proto_bool",
2950        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
2951    )]
2952    pub post_only: bool,
2953    #[serde(skip)]
2954    #[doc(hidden)]
2955    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2956}
2957impl ::core::fmt::Debug for LadderTrigger {
2958    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2959        f.debug_struct("LadderTrigger")
2960            .field("side", &self.side)
2961            .field("price_min_ticks", &self.price_min_ticks)
2962            .field("price_max_ticks", &self.price_max_ticks)
2963            .field("levels", &self.levels)
2964            .field("post_only", &self.post_only)
2965            .finish()
2966    }
2967}
2968impl LadderTrigger {
2969    /// Protobuf type URL for this message, for use with `Any::pack` and
2970    /// `Any::unpack_if`.
2971    ///
2972    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2973    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
2974}
2975::buffa::impl_default_instance!(LadderTrigger);
2976impl ::buffa::MessageName for LadderTrigger {
2977    const PACKAGE: &'static str = "triggers.v1";
2978    const NAME: &'static str = "LadderTrigger";
2979    const FULL_NAME: &'static str = "triggers.v1.LadderTrigger";
2980    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
2981}
2982impl ::buffa::Message for LadderTrigger {
2983    /// Returns the total encoded size in bytes.
2984    ///
2985    /// The result is a `u32`; the protobuf specification requires all
2986    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2987    /// compliant message will never overflow this type.
2988    #[allow(clippy::let_and_return)]
2989    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2990        #[allow(unused_imports)]
2991        use ::buffa::Enumeration as _;
2992        let mut size = 0u32;
2993        {
2994            let val = self.side.to_i32();
2995            if val != 0 {
2996                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2997            }
2998        }
2999        if self.price_min_ticks != 0i64 {
3000            size
3001                += 1u32 + ::buffa::types::int64_encoded_len(self.price_min_ticks) as u32;
3002        }
3003        if self.price_max_ticks != 0i64 {
3004            size
3005                += 1u32 + ::buffa::types::int64_encoded_len(self.price_max_ticks) as u32;
3006        }
3007        if self.levels != 0i32 {
3008            size += 1u32 + ::buffa::types::int32_encoded_len(self.levels) as u32;
3009        }
3010        if self.post_only {
3011            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
3012        }
3013        size += self.__buffa_unknown_fields.encoded_len() as u32;
3014        size
3015    }
3016    fn write_to(
3017        &self,
3018        _cache: &mut ::buffa::SizeCache,
3019        buf: &mut impl ::buffa::bytes::BufMut,
3020    ) {
3021        #[allow(unused_imports)]
3022        use ::buffa::Enumeration as _;
3023        {
3024            let val = self.side.to_i32();
3025            if val != 0 {
3026                ::buffa::types::put_int32_field(1u32, val, buf);
3027            }
3028        }
3029        if self.price_min_ticks != 0i64 {
3030            ::buffa::types::put_int64_field(2u32, self.price_min_ticks, buf);
3031        }
3032        if self.price_max_ticks != 0i64 {
3033            ::buffa::types::put_int64_field(3u32, self.price_max_ticks, buf);
3034        }
3035        if self.levels != 0i32 {
3036            ::buffa::types::put_int32_field(4u32, self.levels, buf);
3037        }
3038        if self.post_only {
3039            ::buffa::types::put_bool_field(5u32, self.post_only, buf);
3040        }
3041        self.__buffa_unknown_fields.write_to(buf);
3042    }
3043    fn merge_field(
3044        &mut self,
3045        tag: ::buffa::encoding::Tag,
3046        buf: &mut impl ::buffa::bytes::Buf,
3047        ctx: ::buffa::DecodeContext<'_>,
3048    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3049        #[allow(unused_imports)]
3050        use ::buffa::bytes::Buf as _;
3051        #[allow(unused_imports)]
3052        use ::buffa::Enumeration as _;
3053        match tag.field_number() {
3054            1u32 => {
3055                ::buffa::encoding::check_wire_type(
3056                    tag,
3057                    ::buffa::encoding::WireType::Varint,
3058                )?;
3059                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
3060            }
3061            2u32 => {
3062                ::buffa::encoding::check_wire_type(
3063                    tag,
3064                    ::buffa::encoding::WireType::Varint,
3065                )?;
3066                self.price_min_ticks = ::buffa::types::decode_int64(buf)?;
3067            }
3068            3u32 => {
3069                ::buffa::encoding::check_wire_type(
3070                    tag,
3071                    ::buffa::encoding::WireType::Varint,
3072                )?;
3073                self.price_max_ticks = ::buffa::types::decode_int64(buf)?;
3074            }
3075            4u32 => {
3076                ::buffa::encoding::check_wire_type(
3077                    tag,
3078                    ::buffa::encoding::WireType::Varint,
3079                )?;
3080                self.levels = ::buffa::types::decode_int32(buf)?;
3081            }
3082            5u32 => {
3083                ::buffa::encoding::check_wire_type(
3084                    tag,
3085                    ::buffa::encoding::WireType::Varint,
3086                )?;
3087                self.post_only = ::buffa::types::decode_bool(buf)?;
3088            }
3089            _ => {
3090                self.__buffa_unknown_fields
3091                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3092            }
3093        }
3094        ::core::result::Result::Ok(())
3095    }
3096    fn clear(&mut self) {
3097        self.side = ::buffa::EnumValue::from(0);
3098        self.price_min_ticks = 0i64;
3099        self.price_max_ticks = 0i64;
3100        self.levels = 0i32;
3101        self.post_only = false;
3102        self.__buffa_unknown_fields.clear();
3103    }
3104}
3105impl ::buffa::ExtensionSet for LadderTrigger {
3106    const PROTO_FQN: &'static str = "triggers.v1.LadderTrigger";
3107    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3108        &self.__buffa_unknown_fields
3109    }
3110    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3111        &mut self.__buffa_unknown_fields
3112    }
3113}
3114impl ::buffa::json_helpers::ProtoElemJson for LadderTrigger {
3115    fn serialize_proto_json<S: ::serde::Serializer>(
3116        v: &Self,
3117        s: S,
3118    ) -> ::core::result::Result<S::Ok, S::Error> {
3119        ::serde::Serialize::serialize(v, s)
3120    }
3121    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3122        d: D,
3123    ) -> ::core::result::Result<Self, D::Error> {
3124        <Self as ::serde::Deserialize>::deserialize(d)
3125    }
3126}
3127#[doc(hidden)]
3128pub const __LADDER_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3129    type_url: "type.googleapis.com/triggers.v1.LadderTrigger",
3130    to_json: ::buffa::type_registry::any_to_json::<LadderTrigger>,
3131    from_json: ::buffa::type_registry::any_from_json::<LadderTrigger>,
3132    is_wkt: false,
3133};
3134/// TriggerIntent contains one standalone trigger's immutable configuration.
3135#[derive(Clone, PartialEq, Default)]
3136#[derive(::serde::Serialize)]
3137#[serde(default)]
3138pub struct TriggerIntent {
3139    /// Symbol, for example "BTC-USDT".
3140    ///
3141    /// Field 1: `symbol`
3142    #[serde(
3143        rename = "symbol",
3144        with = "::buffa::json_helpers::proto_string",
3145        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3146    )]
3147    pub symbol: ::buffa::alloc::string::String,
3148    /// Total quantity scaled by the pair's base_quantity_scale.
3149    ///
3150    /// Field 2: `qty_scaled`
3151    #[serde(
3152        rename = "qtyScaled",
3153        alias = "qty_scaled",
3154        with = "::buffa::json_helpers::int64",
3155        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
3156    )]
3157    pub qty_scaled: i64,
3158    /// Fee asset for BUY children. SELL children must use QUOTE.
3159    ///
3160    /// Field 3: `fee_asset`
3161    #[serde(
3162        rename = "feeAsset",
3163        alias = "fee_asset",
3164        with = "::buffa::json_helpers::proto_enum",
3165        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3166    )]
3167    pub fee_asset: ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
3168    /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
3169    ///
3170    /// Field 4: `self_trade_prevention_mode`
3171    #[serde(
3172        rename = "selfTradePreventionMode",
3173        alias = "self_trade_prevention_mode",
3174        with = "::buffa::json_helpers::proto_enum",
3175        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3176    )]
3177    pub self_trade_prevention_mode: ::buffa::EnumValue<
3178        super::super::orders::v1::SelfTradePreventionMode,
3179    >,
3180    /// Client-provided trigger ID for idempotency.
3181    ///
3182    /// Field 5: `client_trigger_id`
3183    #[serde(
3184        rename = "clientTriggerId",
3185        alias = "client_trigger_id",
3186        with = "::buffa::json_helpers::proto_string",
3187        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3188    )]
3189    pub client_trigger_id: ::buffa::alloc::string::String,
3190    #[serde(flatten)]
3191    pub strategy: ::core::option::Option<__buffa::oneof::trigger_intent::Strategy>,
3192    #[serde(skip)]
3193    #[doc(hidden)]
3194    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3195}
3196impl ::core::fmt::Debug for TriggerIntent {
3197    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3198        f.debug_struct("TriggerIntent")
3199            .field("symbol", &self.symbol)
3200            .field("qty_scaled", &self.qty_scaled)
3201            .field("fee_asset", &self.fee_asset)
3202            .field("self_trade_prevention_mode", &self.self_trade_prevention_mode)
3203            .field("client_trigger_id", &self.client_trigger_id)
3204            .field("strategy", &self.strategy)
3205            .finish()
3206    }
3207}
3208impl TriggerIntent {
3209    /// Protobuf type URL for this message, for use with `Any::pack` and
3210    /// `Any::unpack_if`.
3211    ///
3212    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3213    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
3214}
3215::buffa::impl_default_instance!(TriggerIntent);
3216impl ::buffa::MessageName for TriggerIntent {
3217    const PACKAGE: &'static str = "triggers.v1";
3218    const NAME: &'static str = "TriggerIntent";
3219    const FULL_NAME: &'static str = "triggers.v1.TriggerIntent";
3220    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
3221}
3222impl ::buffa::Message for TriggerIntent {
3223    /// Returns the total encoded size in bytes.
3224    ///
3225    /// The result is a `u32`; the protobuf specification requires all
3226    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3227    /// compliant message will never overflow this type.
3228    #[allow(clippy::let_and_return)]
3229    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3230        #[allow(unused_imports)]
3231        use ::buffa::Enumeration as _;
3232        let mut size = 0u32;
3233        if !self.symbol.is_empty() {
3234            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
3235        }
3236        if self.qty_scaled != 0i64 {
3237            size += 1u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
3238        }
3239        {
3240            let val = self.fee_asset.to_i32();
3241            if val != 0 {
3242                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3243            }
3244        }
3245        {
3246            let val = self.self_trade_prevention_mode.to_i32();
3247            if val != 0 {
3248                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3249            }
3250        }
3251        if !self.client_trigger_id.is_empty() {
3252            size
3253                += 1u32
3254                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
3255        }
3256        if let ::core::option::Option::Some(ref v) = self.strategy {
3257            match v {
3258                __buffa::oneof::trigger_intent::Strategy::StopLoss(x) => {
3259                    let __slot = __cache.reserve();
3260                    let inner = x.compute_size(__cache);
3261                    __cache.set(__slot, inner);
3262                    size
3263                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3264                            + inner;
3265                }
3266                __buffa::oneof::trigger_intent::Strategy::TakeProfit(x) => {
3267                    let __slot = __cache.reserve();
3268                    let inner = x.compute_size(__cache);
3269                    __cache.set(__slot, inner);
3270                    size
3271                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3272                            + inner;
3273                }
3274                __buffa::oneof::trigger_intent::Strategy::TrailingStop(x) => {
3275                    let __slot = __cache.reserve();
3276                    let inner = x.compute_size(__cache);
3277                    __cache.set(__slot, inner);
3278                    size
3279                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3280                            + inner;
3281                }
3282                __buffa::oneof::trigger_intent::Strategy::Twap(x) => {
3283                    let __slot = __cache.reserve();
3284                    let inner = x.compute_size(__cache);
3285                    __cache.set(__slot, inner);
3286                    size
3287                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3288                            + inner;
3289                }
3290                __buffa::oneof::trigger_intent::Strategy::Ladder(x) => {
3291                    let __slot = __cache.reserve();
3292                    let inner = x.compute_size(__cache);
3293                    __cache.set(__slot, inner);
3294                    size
3295                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3296                            + inner;
3297                }
3298            }
3299        }
3300        size += self.__buffa_unknown_fields.encoded_len() as u32;
3301        size
3302    }
3303    fn write_to(
3304        &self,
3305        __cache: &mut ::buffa::SizeCache,
3306        buf: &mut impl ::buffa::bytes::BufMut,
3307    ) {
3308        #[allow(unused_imports)]
3309        use ::buffa::Enumeration as _;
3310        if !self.symbol.is_empty() {
3311            ::buffa::types::put_string_field(1u32, &self.symbol, buf);
3312        }
3313        if self.qty_scaled != 0i64 {
3314            ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
3315        }
3316        {
3317            let val = self.fee_asset.to_i32();
3318            if val != 0 {
3319                ::buffa::types::put_int32_field(3u32, val, buf);
3320            }
3321        }
3322        {
3323            let val = self.self_trade_prevention_mode.to_i32();
3324            if val != 0 {
3325                ::buffa::types::put_int32_field(4u32, val, buf);
3326            }
3327        }
3328        if !self.client_trigger_id.is_empty() {
3329            ::buffa::types::put_string_field(5u32, &self.client_trigger_id, buf);
3330        }
3331        if let ::core::option::Option::Some(ref v) = self.strategy {
3332            match v {
3333                __buffa::oneof::trigger_intent::Strategy::StopLoss(x) => {
3334                    ::buffa::types::put_len_delimited_header(
3335                        10u32,
3336                        __cache.consume_next(),
3337                        buf,
3338                    );
3339                    x.write_to(__cache, buf);
3340                }
3341                __buffa::oneof::trigger_intent::Strategy::TakeProfit(x) => {
3342                    ::buffa::types::put_len_delimited_header(
3343                        11u32,
3344                        __cache.consume_next(),
3345                        buf,
3346                    );
3347                    x.write_to(__cache, buf);
3348                }
3349                __buffa::oneof::trigger_intent::Strategy::TrailingStop(x) => {
3350                    ::buffa::types::put_len_delimited_header(
3351                        12u32,
3352                        __cache.consume_next(),
3353                        buf,
3354                    );
3355                    x.write_to(__cache, buf);
3356                }
3357                __buffa::oneof::trigger_intent::Strategy::Twap(x) => {
3358                    ::buffa::types::put_len_delimited_header(
3359                        13u32,
3360                        __cache.consume_next(),
3361                        buf,
3362                    );
3363                    x.write_to(__cache, buf);
3364                }
3365                __buffa::oneof::trigger_intent::Strategy::Ladder(x) => {
3366                    ::buffa::types::put_len_delimited_header(
3367                        14u32,
3368                        __cache.consume_next(),
3369                        buf,
3370                    );
3371                    x.write_to(__cache, buf);
3372                }
3373            }
3374        }
3375        self.__buffa_unknown_fields.write_to(buf);
3376    }
3377    fn merge_field(
3378        &mut self,
3379        tag: ::buffa::encoding::Tag,
3380        buf: &mut impl ::buffa::bytes::Buf,
3381        ctx: ::buffa::DecodeContext<'_>,
3382    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3383        #[allow(unused_imports)]
3384        use ::buffa::bytes::Buf as _;
3385        #[allow(unused_imports)]
3386        use ::buffa::Enumeration as _;
3387        match tag.field_number() {
3388            1u32 => {
3389                ::buffa::encoding::check_wire_type(
3390                    tag,
3391                    ::buffa::encoding::WireType::LengthDelimited,
3392                )?;
3393                ::buffa::types::merge_string(&mut self.symbol, buf)?;
3394            }
3395            2u32 => {
3396                ::buffa::encoding::check_wire_type(
3397                    tag,
3398                    ::buffa::encoding::WireType::Varint,
3399                )?;
3400                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
3401            }
3402            3u32 => {
3403                ::buffa::encoding::check_wire_type(
3404                    tag,
3405                    ::buffa::encoding::WireType::Varint,
3406                )?;
3407                self.fee_asset = ::buffa::EnumValue::from(
3408                    ::buffa::types::decode_int32(buf)?,
3409                );
3410            }
3411            4u32 => {
3412                ::buffa::encoding::check_wire_type(
3413                    tag,
3414                    ::buffa::encoding::WireType::Varint,
3415                )?;
3416                self.self_trade_prevention_mode = ::buffa::EnumValue::from(
3417                    ::buffa::types::decode_int32(buf)?,
3418                );
3419            }
3420            5u32 => {
3421                ::buffa::encoding::check_wire_type(
3422                    tag,
3423                    ::buffa::encoding::WireType::LengthDelimited,
3424                )?;
3425                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
3426            }
3427            10u32 => {
3428                ::buffa::encoding::check_wire_type(
3429                    tag,
3430                    ::buffa::encoding::WireType::LengthDelimited,
3431                )?;
3432                if let ::core::option::Option::Some(
3433                    __buffa::oneof::trigger_intent::Strategy::StopLoss(ref mut existing),
3434                ) = self.strategy
3435                {
3436                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3437                } else {
3438                    let mut val = ::core::default::Default::default();
3439                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3440                    self.strategy = ::core::option::Option::Some(
3441                        __buffa::oneof::trigger_intent::Strategy::StopLoss(
3442                            ::buffa::alloc::boxed::Box::new(val),
3443                        ),
3444                    );
3445                }
3446            }
3447            11u32 => {
3448                ::buffa::encoding::check_wire_type(
3449                    tag,
3450                    ::buffa::encoding::WireType::LengthDelimited,
3451                )?;
3452                if let ::core::option::Option::Some(
3453                    __buffa::oneof::trigger_intent::Strategy::TakeProfit(
3454                        ref mut existing,
3455                    ),
3456                ) = self.strategy
3457                {
3458                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3459                } else {
3460                    let mut val = ::core::default::Default::default();
3461                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3462                    self.strategy = ::core::option::Option::Some(
3463                        __buffa::oneof::trigger_intent::Strategy::TakeProfit(
3464                            ::buffa::alloc::boxed::Box::new(val),
3465                        ),
3466                    );
3467                }
3468            }
3469            12u32 => {
3470                ::buffa::encoding::check_wire_type(
3471                    tag,
3472                    ::buffa::encoding::WireType::LengthDelimited,
3473                )?;
3474                if let ::core::option::Option::Some(
3475                    __buffa::oneof::trigger_intent::Strategy::TrailingStop(
3476                        ref mut existing,
3477                    ),
3478                ) = self.strategy
3479                {
3480                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3481                } else {
3482                    let mut val = ::core::default::Default::default();
3483                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3484                    self.strategy = ::core::option::Option::Some(
3485                        __buffa::oneof::trigger_intent::Strategy::TrailingStop(
3486                            ::buffa::alloc::boxed::Box::new(val),
3487                        ),
3488                    );
3489                }
3490            }
3491            13u32 => {
3492                ::buffa::encoding::check_wire_type(
3493                    tag,
3494                    ::buffa::encoding::WireType::LengthDelimited,
3495                )?;
3496                if let ::core::option::Option::Some(
3497                    __buffa::oneof::trigger_intent::Strategy::Twap(ref mut existing),
3498                ) = self.strategy
3499                {
3500                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3501                } else {
3502                    let mut val = ::core::default::Default::default();
3503                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3504                    self.strategy = ::core::option::Option::Some(
3505                        __buffa::oneof::trigger_intent::Strategy::Twap(
3506                            ::buffa::alloc::boxed::Box::new(val),
3507                        ),
3508                    );
3509                }
3510            }
3511            14u32 => {
3512                ::buffa::encoding::check_wire_type(
3513                    tag,
3514                    ::buffa::encoding::WireType::LengthDelimited,
3515                )?;
3516                if let ::core::option::Option::Some(
3517                    __buffa::oneof::trigger_intent::Strategy::Ladder(ref mut existing),
3518                ) = self.strategy
3519                {
3520                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3521                } else {
3522                    let mut val = ::core::default::Default::default();
3523                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3524                    self.strategy = ::core::option::Option::Some(
3525                        __buffa::oneof::trigger_intent::Strategy::Ladder(
3526                            ::buffa::alloc::boxed::Box::new(val),
3527                        ),
3528                    );
3529                }
3530            }
3531            _ => {
3532                self.__buffa_unknown_fields
3533                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3534            }
3535        }
3536        ::core::result::Result::Ok(())
3537    }
3538    fn clear(&mut self) {
3539        self.symbol.clear();
3540        self.qty_scaled = 0i64;
3541        self.fee_asset = ::buffa::EnumValue::from(0);
3542        self.self_trade_prevention_mode = ::buffa::EnumValue::from(0);
3543        self.client_trigger_id.clear();
3544        self.strategy = ::core::option::Option::None;
3545        self.__buffa_unknown_fields.clear();
3546    }
3547}
3548impl ::buffa::ExtensionSet for TriggerIntent {
3549    const PROTO_FQN: &'static str = "triggers.v1.TriggerIntent";
3550    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3551        &self.__buffa_unknown_fields
3552    }
3553    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3554        &mut self.__buffa_unknown_fields
3555    }
3556}
3557impl<'de> serde::Deserialize<'de> for TriggerIntent {
3558    fn deserialize<D: serde::Deserializer<'de>>(
3559        d: D,
3560    ) -> ::core::result::Result<Self, D::Error> {
3561        struct _V;
3562        impl<'de> serde::de::Visitor<'de> for _V {
3563            type Value = TriggerIntent;
3564            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3565                f.write_str("struct TriggerIntent")
3566            }
3567            #[allow(clippy::field_reassign_with_default)]
3568            fn visit_map<A: serde::de::MapAccess<'de>>(
3569                self,
3570                mut map: A,
3571            ) -> ::core::result::Result<TriggerIntent, A::Error> {
3572                let mut __f_symbol: ::core::option::Option<
3573                    ::buffa::alloc::string::String,
3574                > = None;
3575                let mut __f_qty_scaled: ::core::option::Option<i64> = None;
3576                let mut __f_fee_asset: ::core::option::Option<
3577                    ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
3578                > = None;
3579                let mut __f_self_trade_prevention_mode: ::core::option::Option<
3580                    ::buffa::EnumValue<super::super::orders::v1::SelfTradePreventionMode>,
3581                > = None;
3582                let mut __f_client_trigger_id: ::core::option::Option<
3583                    ::buffa::alloc::string::String,
3584                > = None;
3585                let mut __oneof_strategy: ::core::option::Option<
3586                    __buffa::oneof::trigger_intent::Strategy,
3587                > = None;
3588                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
3589                    match key.as_str() {
3590                        "symbol" => {
3591                            __f_symbol = Some({
3592                                struct _S;
3593                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3594                                    type Value = ::buffa::alloc::string::String;
3595                                    fn deserialize<D: serde::Deserializer<'de>>(
3596                                        self,
3597                                        d: D,
3598                                    ) -> ::core::result::Result<
3599                                        ::buffa::alloc::string::String,
3600                                        D::Error,
3601                                    > {
3602                                        ::buffa::json_helpers::proto_string::deserialize(d)
3603                                    }
3604                                }
3605                                map.next_value_seed(_S)?
3606                            });
3607                        }
3608                        "qtyScaled" | "qty_scaled" => {
3609                            __f_qty_scaled = Some({
3610                                struct _S;
3611                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3612                                    type Value = i64;
3613                                    fn deserialize<D: serde::Deserializer<'de>>(
3614                                        self,
3615                                        d: D,
3616                                    ) -> ::core::result::Result<i64, D::Error> {
3617                                        ::buffa::json_helpers::int64::deserialize(d)
3618                                    }
3619                                }
3620                                map.next_value_seed(_S)?
3621                            });
3622                        }
3623                        "feeAsset" | "fee_asset" => {
3624                            __f_fee_asset = Some({
3625                                struct _S;
3626                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3627                                    type Value = ::buffa::EnumValue<
3628                                        super::super::orders::v1::FeeAsset,
3629                                    >;
3630                                    fn deserialize<D: serde::Deserializer<'de>>(
3631                                        self,
3632                                        d: D,
3633                                    ) -> ::core::result::Result<
3634                                        ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
3635                                        D::Error,
3636                                    > {
3637                                        ::buffa::json_helpers::proto_enum::deserialize(d)
3638                                    }
3639                                }
3640                                map.next_value_seed(_S)?
3641                            });
3642                        }
3643                        "selfTradePreventionMode" | "self_trade_prevention_mode" => {
3644                            __f_self_trade_prevention_mode = Some({
3645                                struct _S;
3646                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3647                                    type Value = ::buffa::EnumValue<
3648                                        super::super::orders::v1::SelfTradePreventionMode,
3649                                    >;
3650                                    fn deserialize<D: serde::Deserializer<'de>>(
3651                                        self,
3652                                        d: D,
3653                                    ) -> ::core::result::Result<
3654                                        ::buffa::EnumValue<
3655                                            super::super::orders::v1::SelfTradePreventionMode,
3656                                        >,
3657                                        D::Error,
3658                                    > {
3659                                        ::buffa::json_helpers::proto_enum::deserialize(d)
3660                                    }
3661                                }
3662                                map.next_value_seed(_S)?
3663                            });
3664                        }
3665                        "clientTriggerId" | "client_trigger_id" => {
3666                            __f_client_trigger_id = Some({
3667                                struct _S;
3668                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3669                                    type Value = ::buffa::alloc::string::String;
3670                                    fn deserialize<D: serde::Deserializer<'de>>(
3671                                        self,
3672                                        d: D,
3673                                    ) -> ::core::result::Result<
3674                                        ::buffa::alloc::string::String,
3675                                        D::Error,
3676                                    > {
3677                                        ::buffa::json_helpers::proto_string::deserialize(d)
3678                                    }
3679                                }
3680                                map.next_value_seed(_S)?
3681                            });
3682                        }
3683                        "stopLoss" | "stop_loss" => {
3684                            let v: ::core::option::Option<ConditionalTrigger> = map
3685                                .next_value_seed(
3686                                    ::buffa::json_helpers::NullableDeserializeSeed(
3687                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3688                                            ConditionalTrigger,
3689                                        >::new(),
3690                                    ),
3691                                )?;
3692                            if let Some(v) = v {
3693                                if __oneof_strategy.is_some() {
3694                                    return Err(
3695                                        serde::de::Error::custom(
3696                                            "multiple oneof fields set for 'strategy'",
3697                                        ),
3698                                    );
3699                                }
3700                                __oneof_strategy = Some(
3701                                    __buffa::oneof::trigger_intent::Strategy::StopLoss(
3702                                        ::buffa::alloc::boxed::Box::new(v),
3703                                    ),
3704                                );
3705                            }
3706                        }
3707                        "takeProfit" | "take_profit" => {
3708                            let v: ::core::option::Option<ConditionalTrigger> = map
3709                                .next_value_seed(
3710                                    ::buffa::json_helpers::NullableDeserializeSeed(
3711                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3712                                            ConditionalTrigger,
3713                                        >::new(),
3714                                    ),
3715                                )?;
3716                            if let Some(v) = v {
3717                                if __oneof_strategy.is_some() {
3718                                    return Err(
3719                                        serde::de::Error::custom(
3720                                            "multiple oneof fields set for 'strategy'",
3721                                        ),
3722                                    );
3723                                }
3724                                __oneof_strategy = Some(
3725                                    __buffa::oneof::trigger_intent::Strategy::TakeProfit(
3726                                        ::buffa::alloc::boxed::Box::new(v),
3727                                    ),
3728                                );
3729                            }
3730                        }
3731                        "trailingStop" | "trailing_stop" => {
3732                            let v: ::core::option::Option<TrailingStopTrigger> = map
3733                                .next_value_seed(
3734                                    ::buffa::json_helpers::NullableDeserializeSeed(
3735                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3736                                            TrailingStopTrigger,
3737                                        >::new(),
3738                                    ),
3739                                )?;
3740                            if let Some(v) = v {
3741                                if __oneof_strategy.is_some() {
3742                                    return Err(
3743                                        serde::de::Error::custom(
3744                                            "multiple oneof fields set for 'strategy'",
3745                                        ),
3746                                    );
3747                                }
3748                                __oneof_strategy = Some(
3749                                    __buffa::oneof::trigger_intent::Strategy::TrailingStop(
3750                                        ::buffa::alloc::boxed::Box::new(v),
3751                                    ),
3752                                );
3753                            }
3754                        }
3755                        "twap" => {
3756                            let v: ::core::option::Option<TwapTrigger> = map
3757                                .next_value_seed(
3758                                    ::buffa::json_helpers::NullableDeserializeSeed(
3759                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3760                                            TwapTrigger,
3761                                        >::new(),
3762                                    ),
3763                                )?;
3764                            if let Some(v) = v {
3765                                if __oneof_strategy.is_some() {
3766                                    return Err(
3767                                        serde::de::Error::custom(
3768                                            "multiple oneof fields set for 'strategy'",
3769                                        ),
3770                                    );
3771                                }
3772                                __oneof_strategy = Some(
3773                                    __buffa::oneof::trigger_intent::Strategy::Twap(
3774                                        ::buffa::alloc::boxed::Box::new(v),
3775                                    ),
3776                                );
3777                            }
3778                        }
3779                        "ladder" => {
3780                            let v: ::core::option::Option<LadderTrigger> = map
3781                                .next_value_seed(
3782                                    ::buffa::json_helpers::NullableDeserializeSeed(
3783                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3784                                            LadderTrigger,
3785                                        >::new(),
3786                                    ),
3787                                )?;
3788                            if let Some(v) = v {
3789                                if __oneof_strategy.is_some() {
3790                                    return Err(
3791                                        serde::de::Error::custom(
3792                                            "multiple oneof fields set for 'strategy'",
3793                                        ),
3794                                    );
3795                                }
3796                                __oneof_strategy = Some(
3797                                    __buffa::oneof::trigger_intent::Strategy::Ladder(
3798                                        ::buffa::alloc::boxed::Box::new(v),
3799                                    ),
3800                                );
3801                            }
3802                        }
3803                        _ => {
3804                            map.next_value::<serde::de::IgnoredAny>()?;
3805                        }
3806                    }
3807                }
3808                let mut __r = <TriggerIntent as ::core::default::Default>::default();
3809                if let ::core::option::Option::Some(v) = __f_symbol {
3810                    __r.symbol = v;
3811                }
3812                if let ::core::option::Option::Some(v) = __f_qty_scaled {
3813                    __r.qty_scaled = v;
3814                }
3815                if let ::core::option::Option::Some(v) = __f_fee_asset {
3816                    __r.fee_asset = v;
3817                }
3818                if let ::core::option::Option::Some(v) = __f_self_trade_prevention_mode {
3819                    __r.self_trade_prevention_mode = v;
3820                }
3821                if let ::core::option::Option::Some(v) = __f_client_trigger_id {
3822                    __r.client_trigger_id = v;
3823                }
3824                __r.strategy = __oneof_strategy;
3825                Ok(__r)
3826            }
3827        }
3828        d.deserialize_map(_V)
3829    }
3830}
3831impl ::buffa::json_helpers::ProtoElemJson for TriggerIntent {
3832    fn serialize_proto_json<S: ::serde::Serializer>(
3833        v: &Self,
3834        s: S,
3835    ) -> ::core::result::Result<S::Ok, S::Error> {
3836        ::serde::Serialize::serialize(v, s)
3837    }
3838    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3839        d: D,
3840    ) -> ::core::result::Result<Self, D::Error> {
3841        <Self as ::serde::Deserialize>::deserialize(d)
3842    }
3843}
3844#[doc(hidden)]
3845pub const __TRIGGER_INTENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3846    type_url: "type.googleapis.com/triggers.v1.TriggerIntent",
3847    to_json: ::buffa::type_registry::any_to_json::<TriggerIntent>,
3848    from_json: ::buffa::type_registry::any_from_json::<TriggerIntent>,
3849    is_wkt: false,
3850};
3851pub mod trigger_intent {
3852    #[allow(unused_imports)]
3853    use super::*;
3854    #[doc(inline)]
3855    pub use super::__buffa::oneof::trigger_intent::Strategy;
3856    #[doc(inline)]
3857    pub use super::__buffa::view::oneof::trigger_intent::Strategy as StrategyView;
3858}
3859/// CreateTriggerRequest submits one standalone trigger intent for admission.
3860#[derive(Clone, PartialEq, Default)]
3861#[derive(::serde::Serialize, ::serde::Deserialize)]
3862#[serde(default)]
3863pub struct CreateTriggerRequest {
3864    /// Target sub-account. When omitted, uses the caller's root account.
3865    ///
3866    /// Field 1: `subaccount_id`
3867    #[serde(
3868        rename = "subaccountId",
3869        alias = "subaccount_id",
3870        with = "::buffa::json_helpers::opt_uint64",
3871        skip_serializing_if = "::core::option::Option::is_none"
3872    )]
3873    pub subaccount_id: ::core::option::Option<u64>,
3874    /// Trigger to admit.
3875    ///
3876    /// Field 2: `trigger`
3877    #[serde(
3878        rename = "trigger",
3879        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
3880    )]
3881    pub trigger: ::buffa::MessageField<TriggerIntent>,
3882    #[serde(skip)]
3883    #[doc(hidden)]
3884    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3885}
3886impl ::core::fmt::Debug for CreateTriggerRequest {
3887    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3888        f.debug_struct("CreateTriggerRequest")
3889            .field("subaccount_id", &self.subaccount_id)
3890            .field("trigger", &self.trigger)
3891            .finish()
3892    }
3893}
3894impl CreateTriggerRequest {
3895    /// Protobuf type URL for this message, for use with `Any::pack` and
3896    /// `Any::unpack_if`.
3897    ///
3898    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3899    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
3900}
3901impl CreateTriggerRequest {
3902    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3903    #[inline]
3904    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
3905    pub fn with_subaccount_id(mut self, value: u64) -> Self {
3906        self.subaccount_id = Some(value);
3907        self
3908    }
3909}
3910::buffa::impl_default_instance!(CreateTriggerRequest);
3911impl ::buffa::MessageName for CreateTriggerRequest {
3912    const PACKAGE: &'static str = "triggers.v1";
3913    const NAME: &'static str = "CreateTriggerRequest";
3914    const FULL_NAME: &'static str = "triggers.v1.CreateTriggerRequest";
3915    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
3916}
3917impl ::buffa::Message for CreateTriggerRequest {
3918    /// Returns the total encoded size in bytes.
3919    ///
3920    /// The result is a `u32`; the protobuf specification requires all
3921    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3922    /// compliant message will never overflow this type.
3923    #[allow(clippy::let_and_return)]
3924    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3925        #[allow(unused_imports)]
3926        use ::buffa::Enumeration as _;
3927        let mut size = 0u32;
3928        if self.subaccount_id.is_some() {
3929            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
3930        }
3931        if self.trigger.is_set() {
3932            let __slot = __cache.reserve();
3933            let inner_size = self.trigger.compute_size(__cache);
3934            __cache.set(__slot, inner_size);
3935            size
3936                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3937                    + inner_size;
3938        }
3939        size += self.__buffa_unknown_fields.encoded_len() as u32;
3940        size
3941    }
3942    fn write_to(
3943        &self,
3944        __cache: &mut ::buffa::SizeCache,
3945        buf: &mut impl ::buffa::bytes::BufMut,
3946    ) {
3947        #[allow(unused_imports)]
3948        use ::buffa::Enumeration as _;
3949        if let Some(v) = self.subaccount_id {
3950            ::buffa::types::put_fixed64_field(1u32, v, buf);
3951        }
3952        if self.trigger.is_set() {
3953            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
3954            self.trigger.write_to(__cache, buf);
3955        }
3956        self.__buffa_unknown_fields.write_to(buf);
3957    }
3958    fn merge_field(
3959        &mut self,
3960        tag: ::buffa::encoding::Tag,
3961        buf: &mut impl ::buffa::bytes::Buf,
3962        ctx: ::buffa::DecodeContext<'_>,
3963    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3964        #[allow(unused_imports)]
3965        use ::buffa::bytes::Buf as _;
3966        #[allow(unused_imports)]
3967        use ::buffa::Enumeration as _;
3968        match tag.field_number() {
3969            1u32 => {
3970                ::buffa::encoding::check_wire_type(
3971                    tag,
3972                    ::buffa::encoding::WireType::Fixed64,
3973                )?;
3974                self.subaccount_id = ::core::option::Option::Some(
3975                    ::buffa::types::decode_fixed64(buf)?,
3976                );
3977            }
3978            2u32 => {
3979                ::buffa::encoding::check_wire_type(
3980                    tag,
3981                    ::buffa::encoding::WireType::LengthDelimited,
3982                )?;
3983                ::buffa::Message::merge_length_delimited(
3984                    self.trigger.get_or_insert_default(),
3985                    buf,
3986                    ctx,
3987                )?;
3988            }
3989            _ => {
3990                self.__buffa_unknown_fields
3991                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3992            }
3993        }
3994        ::core::result::Result::Ok(())
3995    }
3996    fn clear(&mut self) {
3997        self.subaccount_id = ::core::option::Option::None;
3998        self.trigger = ::buffa::MessageField::none();
3999        self.__buffa_unknown_fields.clear();
4000    }
4001}
4002impl ::buffa::ExtensionSet for CreateTriggerRequest {
4003    const PROTO_FQN: &'static str = "triggers.v1.CreateTriggerRequest";
4004    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4005        &self.__buffa_unknown_fields
4006    }
4007    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4008        &mut self.__buffa_unknown_fields
4009    }
4010}
4011impl ::buffa::json_helpers::ProtoElemJson for CreateTriggerRequest {
4012    fn serialize_proto_json<S: ::serde::Serializer>(
4013        v: &Self,
4014        s: S,
4015    ) -> ::core::result::Result<S::Ok, S::Error> {
4016        ::serde::Serialize::serialize(v, s)
4017    }
4018    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4019        d: D,
4020    ) -> ::core::result::Result<Self, D::Error> {
4021        <Self as ::serde::Deserialize>::deserialize(d)
4022    }
4023}
4024#[doc(hidden)]
4025pub const __CREATE_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4026    type_url: "type.googleapis.com/triggers.v1.CreateTriggerRequest",
4027    to_json: ::buffa::type_registry::any_to_json::<CreateTriggerRequest>,
4028    from_json: ::buffa::type_registry::any_from_json::<CreateTriggerRequest>,
4029    is_wkt: false,
4030};
4031/// CreateTriggerResponse acknowledges trigger creation only. Arming and child
4032/// execution happen asynchronously and are visible through trigger reads/events.
4033#[derive(Clone, PartialEq, Default)]
4034#[derive(::serde::Serialize, ::serde::Deserialize)]
4035#[serde(default)]
4036pub struct CreateTriggerResponse {
4037    /// Assigned trigger ID.
4038    ///
4039    /// Field 1: `trigger_id`
4040    #[serde(
4041        rename = "triggerId",
4042        alias = "trigger_id",
4043        with = "::buffa::json_helpers::uint64",
4044        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4045    )]
4046    pub trigger_id: u64,
4047    /// Echoed client trigger ID.
4048    ///
4049    /// Field 2: `client_trigger_id`
4050    #[serde(
4051        rename = "clientTriggerId",
4052        alias = "client_trigger_id",
4053        with = "::buffa::json_helpers::proto_string",
4054        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4055    )]
4056    pub client_trigger_id: ::buffa::alloc::string::String,
4057    /// Time creation admission completed.
4058    ///
4059    /// Field 3: `accepted_at`
4060    #[serde(
4061        rename = "acceptedAt",
4062        alias = "accepted_at",
4063        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4064    )]
4065    pub accepted_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
4066    /// Admission completion time in nanoseconds since epoch (UTC).
4067    ///
4068    /// Field 4: `accepted_at_ts_ns`
4069    #[serde(
4070        rename = "acceptedAtTsNs",
4071        alias = "accepted_at_ts_ns",
4072        with = "::buffa::json_helpers::uint64",
4073        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4074    )]
4075    pub accepted_at_ts_ns: u64,
4076    #[serde(skip)]
4077    #[doc(hidden)]
4078    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4079}
4080impl ::core::fmt::Debug for CreateTriggerResponse {
4081    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4082        f.debug_struct("CreateTriggerResponse")
4083            .field("trigger_id", &self.trigger_id)
4084            .field("client_trigger_id", &self.client_trigger_id)
4085            .field("accepted_at", &self.accepted_at)
4086            .field("accepted_at_ts_ns", &self.accepted_at_ts_ns)
4087            .finish()
4088    }
4089}
4090impl CreateTriggerResponse {
4091    /// Protobuf type URL for this message, for use with `Any::pack` and
4092    /// `Any::unpack_if`.
4093    ///
4094    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4095    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
4096}
4097::buffa::impl_default_instance!(CreateTriggerResponse);
4098impl ::buffa::MessageName for CreateTriggerResponse {
4099    const PACKAGE: &'static str = "triggers.v1";
4100    const NAME: &'static str = "CreateTriggerResponse";
4101    const FULL_NAME: &'static str = "triggers.v1.CreateTriggerResponse";
4102    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
4103}
4104impl ::buffa::Message for CreateTriggerResponse {
4105    /// Returns the total encoded size in bytes.
4106    ///
4107    /// The result is a `u32`; the protobuf specification requires all
4108    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4109    /// compliant message will never overflow this type.
4110    #[allow(clippy::let_and_return)]
4111    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4112        #[allow(unused_imports)]
4113        use ::buffa::Enumeration as _;
4114        let mut size = 0u32;
4115        if self.trigger_id != 0u64 {
4116            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4117        }
4118        if !self.client_trigger_id.is_empty() {
4119            size
4120                += 1u32
4121                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
4122        }
4123        if self.accepted_at.is_set() {
4124            let __slot = __cache.reserve();
4125            let inner_size = self.accepted_at.compute_size(__cache);
4126            __cache.set(__slot, inner_size);
4127            size
4128                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4129                    + inner_size;
4130        }
4131        if self.accepted_at_ts_ns != 0u64 {
4132            size
4133                += 1u32
4134                    + ::buffa::types::uint64_encoded_len(self.accepted_at_ts_ns) as u32;
4135        }
4136        size += self.__buffa_unknown_fields.encoded_len() as u32;
4137        size
4138    }
4139    fn write_to(
4140        &self,
4141        __cache: &mut ::buffa::SizeCache,
4142        buf: &mut impl ::buffa::bytes::BufMut,
4143    ) {
4144        #[allow(unused_imports)]
4145        use ::buffa::Enumeration as _;
4146        if self.trigger_id != 0u64 {
4147            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
4148        }
4149        if !self.client_trigger_id.is_empty() {
4150            ::buffa::types::put_string_field(2u32, &self.client_trigger_id, buf);
4151        }
4152        if self.accepted_at.is_set() {
4153            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
4154            self.accepted_at.write_to(__cache, buf);
4155        }
4156        if self.accepted_at_ts_ns != 0u64 {
4157            ::buffa::types::put_uint64_field(4u32, self.accepted_at_ts_ns, buf);
4158        }
4159        self.__buffa_unknown_fields.write_to(buf);
4160    }
4161    fn merge_field(
4162        &mut self,
4163        tag: ::buffa::encoding::Tag,
4164        buf: &mut impl ::buffa::bytes::Buf,
4165        ctx: ::buffa::DecodeContext<'_>,
4166    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4167        #[allow(unused_imports)]
4168        use ::buffa::bytes::Buf as _;
4169        #[allow(unused_imports)]
4170        use ::buffa::Enumeration as _;
4171        match tag.field_number() {
4172            1u32 => {
4173                ::buffa::encoding::check_wire_type(
4174                    tag,
4175                    ::buffa::encoding::WireType::Fixed64,
4176                )?;
4177                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
4178            }
4179            2u32 => {
4180                ::buffa::encoding::check_wire_type(
4181                    tag,
4182                    ::buffa::encoding::WireType::LengthDelimited,
4183                )?;
4184                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
4185            }
4186            3u32 => {
4187                ::buffa::encoding::check_wire_type(
4188                    tag,
4189                    ::buffa::encoding::WireType::LengthDelimited,
4190                )?;
4191                ::buffa::Message::merge_length_delimited(
4192                    self.accepted_at.get_or_insert_default(),
4193                    buf,
4194                    ctx,
4195                )?;
4196            }
4197            4u32 => {
4198                ::buffa::encoding::check_wire_type(
4199                    tag,
4200                    ::buffa::encoding::WireType::Varint,
4201                )?;
4202                self.accepted_at_ts_ns = ::buffa::types::decode_uint64(buf)?;
4203            }
4204            _ => {
4205                self.__buffa_unknown_fields
4206                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4207            }
4208        }
4209        ::core::result::Result::Ok(())
4210    }
4211    fn clear(&mut self) {
4212        self.trigger_id = 0u64;
4213        self.client_trigger_id.clear();
4214        self.accepted_at = ::buffa::MessageField::none();
4215        self.accepted_at_ts_ns = 0u64;
4216        self.__buffa_unknown_fields.clear();
4217    }
4218}
4219impl ::buffa::ExtensionSet for CreateTriggerResponse {
4220    const PROTO_FQN: &'static str = "triggers.v1.CreateTriggerResponse";
4221    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4222        &self.__buffa_unknown_fields
4223    }
4224    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4225        &mut self.__buffa_unknown_fields
4226    }
4227}
4228impl ::buffa::json_helpers::ProtoElemJson for CreateTriggerResponse {
4229    fn serialize_proto_json<S: ::serde::Serializer>(
4230        v: &Self,
4231        s: S,
4232    ) -> ::core::result::Result<S::Ok, S::Error> {
4233        ::serde::Serialize::serialize(v, s)
4234    }
4235    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4236        d: D,
4237    ) -> ::core::result::Result<Self, D::Error> {
4238        <Self as ::serde::Deserialize>::deserialize(d)
4239    }
4240}
4241#[doc(hidden)]
4242pub const __CREATE_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4243    type_url: "type.googleapis.com/triggers.v1.CreateTriggerResponse",
4244    to_json: ::buffa::type_registry::any_to_json::<CreateTriggerResponse>,
4245    from_json: ::buffa::type_registry::any_from_json::<CreateTriggerResponse>,
4246    is_wkt: false,
4247};
4248/// =============================================================================
4249/// Get Trigger
4250/// =============================================================================
4251///
4252/// GetTriggerRequest retrieves one trigger by ID.
4253#[derive(Clone, PartialEq, Default)]
4254#[derive(::serde::Serialize, ::serde::Deserialize)]
4255#[serde(default)]
4256pub struct GetTriggerRequest {
4257    /// Trigger ID to retrieve.
4258    ///
4259    /// Field 1: `trigger_id`
4260    #[serde(
4261        rename = "triggerId",
4262        alias = "trigger_id",
4263        with = "::buffa::json_helpers::uint64",
4264        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4265    )]
4266    pub trigger_id: u64,
4267    /// Optional sub-account for authorization.
4268    ///
4269    /// Field 2: `subaccount_id`
4270    #[serde(
4271        rename = "subaccountId",
4272        alias = "subaccount_id",
4273        with = "::buffa::json_helpers::opt_uint64",
4274        skip_serializing_if = "::core::option::Option::is_none"
4275    )]
4276    pub subaccount_id: ::core::option::Option<u64>,
4277    #[serde(skip)]
4278    #[doc(hidden)]
4279    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4280}
4281impl ::core::fmt::Debug for GetTriggerRequest {
4282    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4283        f.debug_struct("GetTriggerRequest")
4284            .field("trigger_id", &self.trigger_id)
4285            .field("subaccount_id", &self.subaccount_id)
4286            .finish()
4287    }
4288}
4289impl GetTriggerRequest {
4290    /// Protobuf type URL for this message, for use with `Any::pack` and
4291    /// `Any::unpack_if`.
4292    ///
4293    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4294    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
4295}
4296impl GetTriggerRequest {
4297    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4298    #[inline]
4299    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
4300    pub fn with_subaccount_id(mut self, value: u64) -> Self {
4301        self.subaccount_id = Some(value);
4302        self
4303    }
4304}
4305::buffa::impl_default_instance!(GetTriggerRequest);
4306impl ::buffa::MessageName for GetTriggerRequest {
4307    const PACKAGE: &'static str = "triggers.v1";
4308    const NAME: &'static str = "GetTriggerRequest";
4309    const FULL_NAME: &'static str = "triggers.v1.GetTriggerRequest";
4310    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
4311}
4312impl ::buffa::Message for GetTriggerRequest {
4313    /// Returns the total encoded size in bytes.
4314    ///
4315    /// The result is a `u32`; the protobuf specification requires all
4316    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4317    /// compliant message will never overflow this type.
4318    #[allow(clippy::let_and_return)]
4319    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4320        #[allow(unused_imports)]
4321        use ::buffa::Enumeration as _;
4322        let mut size = 0u32;
4323        if self.trigger_id != 0u64 {
4324            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4325        }
4326        if self.subaccount_id.is_some() {
4327            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4328        }
4329        size += self.__buffa_unknown_fields.encoded_len() as u32;
4330        size
4331    }
4332    fn write_to(
4333        &self,
4334        _cache: &mut ::buffa::SizeCache,
4335        buf: &mut impl ::buffa::bytes::BufMut,
4336    ) {
4337        #[allow(unused_imports)]
4338        use ::buffa::Enumeration as _;
4339        if self.trigger_id != 0u64 {
4340            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
4341        }
4342        if let Some(v) = self.subaccount_id {
4343            ::buffa::types::put_fixed64_field(2u32, v, buf);
4344        }
4345        self.__buffa_unknown_fields.write_to(buf);
4346    }
4347    fn merge_field(
4348        &mut self,
4349        tag: ::buffa::encoding::Tag,
4350        buf: &mut impl ::buffa::bytes::Buf,
4351        ctx: ::buffa::DecodeContext<'_>,
4352    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4353        #[allow(unused_imports)]
4354        use ::buffa::bytes::Buf as _;
4355        #[allow(unused_imports)]
4356        use ::buffa::Enumeration as _;
4357        match tag.field_number() {
4358            1u32 => {
4359                ::buffa::encoding::check_wire_type(
4360                    tag,
4361                    ::buffa::encoding::WireType::Fixed64,
4362                )?;
4363                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
4364            }
4365            2u32 => {
4366                ::buffa::encoding::check_wire_type(
4367                    tag,
4368                    ::buffa::encoding::WireType::Fixed64,
4369                )?;
4370                self.subaccount_id = ::core::option::Option::Some(
4371                    ::buffa::types::decode_fixed64(buf)?,
4372                );
4373            }
4374            _ => {
4375                self.__buffa_unknown_fields
4376                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4377            }
4378        }
4379        ::core::result::Result::Ok(())
4380    }
4381    fn clear(&mut self) {
4382        self.trigger_id = 0u64;
4383        self.subaccount_id = ::core::option::Option::None;
4384        self.__buffa_unknown_fields.clear();
4385    }
4386}
4387impl ::buffa::ExtensionSet for GetTriggerRequest {
4388    const PROTO_FQN: &'static str = "triggers.v1.GetTriggerRequest";
4389    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4390        &self.__buffa_unknown_fields
4391    }
4392    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4393        &mut self.__buffa_unknown_fields
4394    }
4395}
4396impl ::buffa::json_helpers::ProtoElemJson for GetTriggerRequest {
4397    fn serialize_proto_json<S: ::serde::Serializer>(
4398        v: &Self,
4399        s: S,
4400    ) -> ::core::result::Result<S::Ok, S::Error> {
4401        ::serde::Serialize::serialize(v, s)
4402    }
4403    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4404        d: D,
4405    ) -> ::core::result::Result<Self, D::Error> {
4406        <Self as ::serde::Deserialize>::deserialize(d)
4407    }
4408}
4409#[doc(hidden)]
4410pub const __GET_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4411    type_url: "type.googleapis.com/triggers.v1.GetTriggerRequest",
4412    to_json: ::buffa::type_registry::any_to_json::<GetTriggerRequest>,
4413    from_json: ::buffa::type_registry::any_from_json::<GetTriggerRequest>,
4414    is_wkt: false,
4415};
4416/// GetTriggerResponse returns the requested trigger.
4417#[derive(Clone, PartialEq, Default)]
4418#[derive(::serde::Serialize, ::serde::Deserialize)]
4419#[serde(default)]
4420pub struct GetTriggerResponse {
4421    /// Trigger state and configuration.
4422    ///
4423    /// Field 1: `trigger`
4424    #[serde(
4425        rename = "trigger",
4426        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4427    )]
4428    pub trigger: ::buffa::MessageField<Trigger>,
4429    #[serde(skip)]
4430    #[doc(hidden)]
4431    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4432}
4433impl ::core::fmt::Debug for GetTriggerResponse {
4434    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4435        f.debug_struct("GetTriggerResponse").field("trigger", &self.trigger).finish()
4436    }
4437}
4438impl GetTriggerResponse {
4439    /// Protobuf type URL for this message, for use with `Any::pack` and
4440    /// `Any::unpack_if`.
4441    ///
4442    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4443    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
4444}
4445::buffa::impl_default_instance!(GetTriggerResponse);
4446impl ::buffa::MessageName for GetTriggerResponse {
4447    const PACKAGE: &'static str = "triggers.v1";
4448    const NAME: &'static str = "GetTriggerResponse";
4449    const FULL_NAME: &'static str = "triggers.v1.GetTriggerResponse";
4450    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
4451}
4452impl ::buffa::Message for GetTriggerResponse {
4453    /// Returns the total encoded size in bytes.
4454    ///
4455    /// The result is a `u32`; the protobuf specification requires all
4456    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4457    /// compliant message will never overflow this type.
4458    #[allow(clippy::let_and_return)]
4459    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4460        #[allow(unused_imports)]
4461        use ::buffa::Enumeration as _;
4462        let mut size = 0u32;
4463        if self.trigger.is_set() {
4464            let __slot = __cache.reserve();
4465            let inner_size = self.trigger.compute_size(__cache);
4466            __cache.set(__slot, inner_size);
4467            size
4468                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4469                    + inner_size;
4470        }
4471        size += self.__buffa_unknown_fields.encoded_len() as u32;
4472        size
4473    }
4474    fn write_to(
4475        &self,
4476        __cache: &mut ::buffa::SizeCache,
4477        buf: &mut impl ::buffa::bytes::BufMut,
4478    ) {
4479        #[allow(unused_imports)]
4480        use ::buffa::Enumeration as _;
4481        if self.trigger.is_set() {
4482            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
4483            self.trigger.write_to(__cache, buf);
4484        }
4485        self.__buffa_unknown_fields.write_to(buf);
4486    }
4487    fn merge_field(
4488        &mut self,
4489        tag: ::buffa::encoding::Tag,
4490        buf: &mut impl ::buffa::bytes::Buf,
4491        ctx: ::buffa::DecodeContext<'_>,
4492    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4493        #[allow(unused_imports)]
4494        use ::buffa::bytes::Buf as _;
4495        #[allow(unused_imports)]
4496        use ::buffa::Enumeration as _;
4497        match tag.field_number() {
4498            1u32 => {
4499                ::buffa::encoding::check_wire_type(
4500                    tag,
4501                    ::buffa::encoding::WireType::LengthDelimited,
4502                )?;
4503                ::buffa::Message::merge_length_delimited(
4504                    self.trigger.get_or_insert_default(),
4505                    buf,
4506                    ctx,
4507                )?;
4508            }
4509            _ => {
4510                self.__buffa_unknown_fields
4511                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4512            }
4513        }
4514        ::core::result::Result::Ok(())
4515    }
4516    fn clear(&mut self) {
4517        self.trigger = ::buffa::MessageField::none();
4518        self.__buffa_unknown_fields.clear();
4519    }
4520}
4521impl ::buffa::ExtensionSet for GetTriggerResponse {
4522    const PROTO_FQN: &'static str = "triggers.v1.GetTriggerResponse";
4523    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4524        &self.__buffa_unknown_fields
4525    }
4526    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4527        &mut self.__buffa_unknown_fields
4528    }
4529}
4530impl ::buffa::json_helpers::ProtoElemJson for GetTriggerResponse {
4531    fn serialize_proto_json<S: ::serde::Serializer>(
4532        v: &Self,
4533        s: S,
4534    ) -> ::core::result::Result<S::Ok, S::Error> {
4535        ::serde::Serialize::serialize(v, s)
4536    }
4537    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4538        d: D,
4539    ) -> ::core::result::Result<Self, D::Error> {
4540        <Self as ::serde::Deserialize>::deserialize(d)
4541    }
4542}
4543#[doc(hidden)]
4544pub const __GET_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4545    type_url: "type.googleapis.com/triggers.v1.GetTriggerResponse",
4546    to_json: ::buffa::type_registry::any_to_json::<GetTriggerResponse>,
4547    from_json: ::buffa::type_registry::any_from_json::<GetTriggerResponse>,
4548    is_wkt: false,
4549};
4550/// =============================================================================
4551/// List Triggers
4552/// =============================================================================
4553///
4554/// ListTriggersRequest lists triggers for an account.
4555#[derive(Clone, PartialEq, Default)]
4556#[derive(::serde::Serialize, ::serde::Deserialize)]
4557#[serde(default)]
4558pub struct ListTriggersRequest {
4559    /// Optional sub-account to list triggers for. When empty or omitted, uses the
4560    /// caller's root account.
4561    ///
4562    /// Field 1: `subaccount_id`
4563    #[serde(
4564        rename = "subaccountId",
4565        alias = "subaccount_id",
4566        with = "::buffa::json_helpers::opt_uint64",
4567        skip_serializing_if = "::core::option::Option::is_none"
4568    )]
4569    pub subaccount_id: ::core::option::Option<u64>,
4570    /// Optional filter by symbol.
4571    ///
4572    /// Field 2: `symbol`
4573    #[serde(
4574        rename = "symbol",
4575        with = "::buffa::json_helpers::proto_string",
4576        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4577    )]
4578    pub symbol: ::buffa::alloc::string::String,
4579    /// Optional filter by status (can specify multiple).
4580    ///
4581    /// Field 3: `status`
4582    #[serde(
4583        rename = "status",
4584        with = "::buffa::json_helpers::repeated_enum",
4585        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
4586    )]
4587    pub status: ::buffa::alloc::vec::Vec<::buffa::EnumValue<TriggerStatus>>,
4588    /// Optional filter by type.
4589    ///
4590    /// Field 4: `trigger_type`
4591    #[serde(
4592        rename = "triggerType",
4593        alias = "trigger_type",
4594        with = "::buffa::json_helpers::proto_enum",
4595        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
4596    )]
4597    pub trigger_type: ::buffa::EnumValue<TriggerType>,
4598    /// Optional filter by attached parent order ID.
4599    ///
4600    /// Field 5: `parent_order_id`
4601    #[serde(
4602        rename = "parentOrderId",
4603        alias = "parent_order_id",
4604        with = "::buffa::json_helpers::opt_uint64",
4605        skip_serializing_if = "::core::option::Option::is_none"
4606    )]
4607    pub parent_order_id: ::core::option::Option<u64>,
4608    /// Maximum number of triggers to return. Defaults to 100 when omitted;
4609    /// maximum is 1000.
4610    ///
4611    /// Field 10: `limit`
4612    #[serde(
4613        rename = "limit",
4614        with = "::buffa::json_helpers::uint32",
4615        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4616    )]
4617    pub limit: u32,
4618    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
4619    /// bound to the authenticated account, sub-account scope, filters, and newest
4620    /// first sort order.
4621    ///
4622    /// Field 12: `page_token`
4623    #[serde(
4624        rename = "pageToken",
4625        alias = "page_token",
4626        with = "::buffa::json_helpers::proto_string",
4627        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4628    )]
4629    pub page_token: ::buffa::alloc::string::String,
4630    #[serde(skip)]
4631    #[doc(hidden)]
4632    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4633}
4634impl ::core::fmt::Debug for ListTriggersRequest {
4635    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4636        f.debug_struct("ListTriggersRequest")
4637            .field("subaccount_id", &self.subaccount_id)
4638            .field("symbol", &self.symbol)
4639            .field("status", &self.status)
4640            .field("trigger_type", &self.trigger_type)
4641            .field("parent_order_id", &self.parent_order_id)
4642            .field("limit", &self.limit)
4643            .field("page_token", &self.page_token)
4644            .finish()
4645    }
4646}
4647impl ListTriggersRequest {
4648    /// Protobuf type URL for this message, for use with `Any::pack` and
4649    /// `Any::unpack_if`.
4650    ///
4651    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4652    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
4653}
4654impl ListTriggersRequest {
4655    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4656    #[inline]
4657    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
4658    pub fn with_subaccount_id(mut self, value: u64) -> Self {
4659        self.subaccount_id = Some(value);
4660        self
4661    }
4662    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4663    #[inline]
4664    ///Sets [`Self::parent_order_id`] to `Some(value)`, consuming and returning `self`.
4665    pub fn with_parent_order_id(mut self, value: u64) -> Self {
4666        self.parent_order_id = Some(value);
4667        self
4668    }
4669}
4670::buffa::impl_default_instance!(ListTriggersRequest);
4671impl ::buffa::MessageName for ListTriggersRequest {
4672    const PACKAGE: &'static str = "triggers.v1";
4673    const NAME: &'static str = "ListTriggersRequest";
4674    const FULL_NAME: &'static str = "triggers.v1.ListTriggersRequest";
4675    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
4676}
4677impl ::buffa::Message for ListTriggersRequest {
4678    /// Returns the total encoded size in bytes.
4679    ///
4680    /// The result is a `u32`; the protobuf specification requires all
4681    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4682    /// compliant message will never overflow this type.
4683    #[allow(clippy::let_and_return)]
4684    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4685        #[allow(unused_imports)]
4686        use ::buffa::Enumeration as _;
4687        let mut size = 0u32;
4688        if self.subaccount_id.is_some() {
4689            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4690        }
4691        if !self.symbol.is_empty() {
4692            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
4693        }
4694        if !self.status.is_empty() {
4695            let payload: u32 = self
4696                .status
4697                .iter()
4698                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
4699                .sum::<u32>();
4700            size
4701                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
4702        }
4703        {
4704            let val = self.trigger_type.to_i32();
4705            if val != 0 {
4706                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4707            }
4708        }
4709        if self.parent_order_id.is_some() {
4710            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4711        }
4712        if self.limit != 0u32 {
4713            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
4714        }
4715        if !self.page_token.is_empty() {
4716            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
4717        }
4718        size += self.__buffa_unknown_fields.encoded_len() as u32;
4719        size
4720    }
4721    fn write_to(
4722        &self,
4723        _cache: &mut ::buffa::SizeCache,
4724        buf: &mut impl ::buffa::bytes::BufMut,
4725    ) {
4726        #[allow(unused_imports)]
4727        use ::buffa::Enumeration as _;
4728        if let Some(v) = self.subaccount_id {
4729            ::buffa::types::put_fixed64_field(1u32, v, buf);
4730        }
4731        if !self.symbol.is_empty() {
4732            ::buffa::types::put_string_field(2u32, &self.symbol, buf);
4733        }
4734        if !self.status.is_empty() {
4735            let payload: u32 = self
4736                .status
4737                .iter()
4738                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
4739                .sum::<u32>();
4740            ::buffa::types::put_len_delimited_header(3u32, payload, buf);
4741            for v in &self.status {
4742                ::buffa::types::encode_int32(v.to_i32(), buf);
4743            }
4744        }
4745        {
4746            let val = self.trigger_type.to_i32();
4747            if val != 0 {
4748                ::buffa::types::put_int32_field(4u32, val, buf);
4749            }
4750        }
4751        if let Some(v) = self.parent_order_id {
4752            ::buffa::types::put_fixed64_field(5u32, v, buf);
4753        }
4754        if self.limit != 0u32 {
4755            ::buffa::types::put_uint32_field(10u32, self.limit, buf);
4756        }
4757        if !self.page_token.is_empty() {
4758            ::buffa::types::put_string_field(12u32, &self.page_token, buf);
4759        }
4760        self.__buffa_unknown_fields.write_to(buf);
4761    }
4762    fn merge_field(
4763        &mut self,
4764        tag: ::buffa::encoding::Tag,
4765        buf: &mut impl ::buffa::bytes::Buf,
4766        ctx: ::buffa::DecodeContext<'_>,
4767    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4768        #[allow(unused_imports)]
4769        use ::buffa::bytes::Buf as _;
4770        #[allow(unused_imports)]
4771        use ::buffa::Enumeration as _;
4772        match tag.field_number() {
4773            1u32 => {
4774                ::buffa::encoding::check_wire_type(
4775                    tag,
4776                    ::buffa::encoding::WireType::Fixed64,
4777                )?;
4778                self.subaccount_id = ::core::option::Option::Some(
4779                    ::buffa::types::decode_fixed64(buf)?,
4780                );
4781            }
4782            2u32 => {
4783                ::buffa::encoding::check_wire_type(
4784                    tag,
4785                    ::buffa::encoding::WireType::LengthDelimited,
4786                )?;
4787                ::buffa::types::merge_string(&mut self.symbol, buf)?;
4788            }
4789            3u32 => {
4790                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
4791                    let len = ::buffa::encoding::decode_varint(buf)?;
4792                    let len = usize::try_from(len)
4793                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
4794                    if buf.remaining() < len {
4795                        return ::core::result::Result::Err(
4796                            ::buffa::DecodeError::UnexpectedEof,
4797                        );
4798                    }
4799                    self.status.reserve(len);
4800                    let mut limited = buf.take(len);
4801                    while limited.has_remaining() {
4802                        self.status
4803                            .push(
4804                                ::buffa::EnumValue::from(
4805                                    ::buffa::types::decode_int32(&mut limited)?,
4806                                ),
4807                            );
4808                    }
4809                    let leftover = limited.remaining();
4810                    if leftover > 0 {
4811                        limited.advance(leftover);
4812                    }
4813                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
4814                    self.status
4815                        .push(
4816                            ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
4817                        );
4818                } else {
4819                    return ::core::result::Result::Err(
4820                        ::buffa::encoding::wire_type_mismatch(
4821                            tag,
4822                            ::buffa::encoding::WireType::LengthDelimited,
4823                        ),
4824                    );
4825                }
4826            }
4827            4u32 => {
4828                ::buffa::encoding::check_wire_type(
4829                    tag,
4830                    ::buffa::encoding::WireType::Varint,
4831                )?;
4832                self.trigger_type = ::buffa::EnumValue::from(
4833                    ::buffa::types::decode_int32(buf)?,
4834                );
4835            }
4836            5u32 => {
4837                ::buffa::encoding::check_wire_type(
4838                    tag,
4839                    ::buffa::encoding::WireType::Fixed64,
4840                )?;
4841                self.parent_order_id = ::core::option::Option::Some(
4842                    ::buffa::types::decode_fixed64(buf)?,
4843                );
4844            }
4845            10u32 => {
4846                ::buffa::encoding::check_wire_type(
4847                    tag,
4848                    ::buffa::encoding::WireType::Varint,
4849                )?;
4850                self.limit = ::buffa::types::decode_uint32(buf)?;
4851            }
4852            12u32 => {
4853                ::buffa::encoding::check_wire_type(
4854                    tag,
4855                    ::buffa::encoding::WireType::LengthDelimited,
4856                )?;
4857                ::buffa::types::merge_string(&mut self.page_token, buf)?;
4858            }
4859            _ => {
4860                self.__buffa_unknown_fields
4861                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4862            }
4863        }
4864        ::core::result::Result::Ok(())
4865    }
4866    fn clear(&mut self) {
4867        self.subaccount_id = ::core::option::Option::None;
4868        self.symbol.clear();
4869        self.status.clear();
4870        self.trigger_type = ::buffa::EnumValue::from(0);
4871        self.parent_order_id = ::core::option::Option::None;
4872        self.limit = 0u32;
4873        self.page_token.clear();
4874        self.__buffa_unknown_fields.clear();
4875    }
4876}
4877impl ::buffa::ExtensionSet for ListTriggersRequest {
4878    const PROTO_FQN: &'static str = "triggers.v1.ListTriggersRequest";
4879    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4880        &self.__buffa_unknown_fields
4881    }
4882    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4883        &mut self.__buffa_unknown_fields
4884    }
4885}
4886impl ::buffa::json_helpers::ProtoElemJson for ListTriggersRequest {
4887    fn serialize_proto_json<S: ::serde::Serializer>(
4888        v: &Self,
4889        s: S,
4890    ) -> ::core::result::Result<S::Ok, S::Error> {
4891        ::serde::Serialize::serialize(v, s)
4892    }
4893    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4894        d: D,
4895    ) -> ::core::result::Result<Self, D::Error> {
4896        <Self as ::serde::Deserialize>::deserialize(d)
4897    }
4898}
4899#[doc(hidden)]
4900pub const __LIST_TRIGGERS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4901    type_url: "type.googleapis.com/triggers.v1.ListTriggersRequest",
4902    to_json: ::buffa::type_registry::any_to_json::<ListTriggersRequest>,
4903    from_json: ::buffa::type_registry::any_from_json::<ListTriggersRequest>,
4904    is_wkt: false,
4905};
4906/// ListTriggersResponse returns triggers ordered newest-first.
4907#[derive(Clone, PartialEq, Default)]
4908#[derive(::serde::Serialize, ::serde::Deserialize)]
4909#[serde(default)]
4910pub struct ListTriggersResponse {
4911    /// Triggers ordered by creation time descending, then trigger ID descending.
4912    ///
4913    /// Field 1: `triggers`
4914    #[serde(
4915        rename = "triggers",
4916        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
4917        deserialize_with = "::buffa::json_helpers::null_as_default"
4918    )]
4919    pub triggers: ::buffa::alloc::vec::Vec<Trigger>,
4920    /// Opaque cursor for the next page. Empty when no more results exist.
4921    ///
4922    /// Field 3: `next_page_token`
4923    #[serde(
4924        rename = "nextPageToken",
4925        alias = "next_page_token",
4926        with = "::buffa::json_helpers::proto_string",
4927        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4928    )]
4929    pub next_page_token: ::buffa::alloc::string::String,
4930    #[serde(skip)]
4931    #[doc(hidden)]
4932    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4933}
4934impl ::core::fmt::Debug for ListTriggersResponse {
4935    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4936        f.debug_struct("ListTriggersResponse")
4937            .field("triggers", &self.triggers)
4938            .field("next_page_token", &self.next_page_token)
4939            .finish()
4940    }
4941}
4942impl ListTriggersResponse {
4943    /// Protobuf type URL for this message, for use with `Any::pack` and
4944    /// `Any::unpack_if`.
4945    ///
4946    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4947    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
4948}
4949::buffa::impl_default_instance!(ListTriggersResponse);
4950impl ::buffa::MessageName for ListTriggersResponse {
4951    const PACKAGE: &'static str = "triggers.v1";
4952    const NAME: &'static str = "ListTriggersResponse";
4953    const FULL_NAME: &'static str = "triggers.v1.ListTriggersResponse";
4954    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
4955}
4956impl ::buffa::Message for ListTriggersResponse {
4957    /// Returns the total encoded size in bytes.
4958    ///
4959    /// The result is a `u32`; the protobuf specification requires all
4960    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4961    /// compliant message will never overflow this type.
4962    #[allow(clippy::let_and_return)]
4963    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4964        #[allow(unused_imports)]
4965        use ::buffa::Enumeration as _;
4966        let mut size = 0u32;
4967        for v in &self.triggers {
4968            let __slot = __cache.reserve();
4969            let inner_size = v.compute_size(__cache);
4970            __cache.set(__slot, inner_size);
4971            size
4972                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4973                    + inner_size;
4974        }
4975        if !self.next_page_token.is_empty() {
4976            size
4977                += 1u32
4978                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
4979        }
4980        size += self.__buffa_unknown_fields.encoded_len() as u32;
4981        size
4982    }
4983    fn write_to(
4984        &self,
4985        __cache: &mut ::buffa::SizeCache,
4986        buf: &mut impl ::buffa::bytes::BufMut,
4987    ) {
4988        #[allow(unused_imports)]
4989        use ::buffa::Enumeration as _;
4990        for v in &self.triggers {
4991            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
4992            v.write_to(__cache, buf);
4993        }
4994        if !self.next_page_token.is_empty() {
4995            ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
4996        }
4997        self.__buffa_unknown_fields.write_to(buf);
4998    }
4999    fn merge_field(
5000        &mut self,
5001        tag: ::buffa::encoding::Tag,
5002        buf: &mut impl ::buffa::bytes::Buf,
5003        ctx: ::buffa::DecodeContext<'_>,
5004    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5005        #[allow(unused_imports)]
5006        use ::buffa::bytes::Buf as _;
5007        #[allow(unused_imports)]
5008        use ::buffa::Enumeration as _;
5009        match tag.field_number() {
5010            1u32 => {
5011                ::buffa::encoding::check_wire_type(
5012                    tag,
5013                    ::buffa::encoding::WireType::LengthDelimited,
5014                )?;
5015                let mut elem = ::core::default::Default::default();
5016                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5017                self.triggers.push(elem);
5018            }
5019            3u32 => {
5020                ::buffa::encoding::check_wire_type(
5021                    tag,
5022                    ::buffa::encoding::WireType::LengthDelimited,
5023                )?;
5024                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5025            }
5026            _ => {
5027                self.__buffa_unknown_fields
5028                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5029            }
5030        }
5031        ::core::result::Result::Ok(())
5032    }
5033    fn clear(&mut self) {
5034        self.triggers.clear();
5035        self.next_page_token.clear();
5036        self.__buffa_unknown_fields.clear();
5037    }
5038}
5039impl ::buffa::ExtensionSet for ListTriggersResponse {
5040    const PROTO_FQN: &'static str = "triggers.v1.ListTriggersResponse";
5041    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5042        &self.__buffa_unknown_fields
5043    }
5044    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5045        &mut self.__buffa_unknown_fields
5046    }
5047}
5048impl ::buffa::json_helpers::ProtoElemJson for ListTriggersResponse {
5049    fn serialize_proto_json<S: ::serde::Serializer>(
5050        v: &Self,
5051        s: S,
5052    ) -> ::core::result::Result<S::Ok, S::Error> {
5053        ::serde::Serialize::serialize(v, s)
5054    }
5055    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5056        d: D,
5057    ) -> ::core::result::Result<Self, D::Error> {
5058        <Self as ::serde::Deserialize>::deserialize(d)
5059    }
5060}
5061#[doc(hidden)]
5062pub const __LIST_TRIGGERS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5063    type_url: "type.googleapis.com/triggers.v1.ListTriggersResponse",
5064    to_json: ::buffa::type_registry::any_to_json::<ListTriggersResponse>,
5065    from_json: ::buffa::type_registry::any_from_json::<ListTriggersResponse>,
5066    is_wkt: false,
5067};
5068/// =============================================================================
5069/// Trigger Events (History / Audit)
5070/// =============================================================================
5071///
5072/// ListTriggerEventsRequest lists historical events for one trigger.
5073#[derive(Clone, PartialEq, Default)]
5074#[derive(::serde::Serialize, ::serde::Deserialize)]
5075#[serde(default)]
5076pub struct ListTriggerEventsRequest {
5077    /// Trigger ID to list events for.
5078    ///
5079    /// Field 1: `trigger_id`
5080    #[serde(
5081        rename = "triggerId",
5082        alias = "trigger_id",
5083        with = "::buffa::json_helpers::uint64",
5084        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5085    )]
5086    pub trigger_id: u64,
5087    /// Optional sub-account (authorization). When empty or omitted, uses the
5088    /// caller's root account.
5089    ///
5090    /// Field 2: `subaccount_id`
5091    #[serde(
5092        rename = "subaccountId",
5093        alias = "subaccount_id",
5094        with = "::buffa::json_helpers::opt_uint64",
5095        skip_serializing_if = "::core::option::Option::is_none"
5096    )]
5097    pub subaccount_id: ::core::option::Option<u64>,
5098    /// Maximum number of events to return. Defaults to 100 when omitted; maximum
5099    /// is 1000.
5100    ///
5101    /// Field 3: `limit`
5102    #[serde(
5103        rename = "limit",
5104        with = "::buffa::json_helpers::uint32",
5105        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5106    )]
5107    pub limit: u32,
5108    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
5109    /// bound to the authenticated account, trigger, sub-account scope, and newest
5110    /// first sort order.
5111    ///
5112    /// Field 5: `page_token`
5113    #[serde(
5114        rename = "pageToken",
5115        alias = "page_token",
5116        with = "::buffa::json_helpers::proto_string",
5117        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5118    )]
5119    pub page_token: ::buffa::alloc::string::String,
5120    #[serde(skip)]
5121    #[doc(hidden)]
5122    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5123}
5124impl ::core::fmt::Debug for ListTriggerEventsRequest {
5125    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5126        f.debug_struct("ListTriggerEventsRequest")
5127            .field("trigger_id", &self.trigger_id)
5128            .field("subaccount_id", &self.subaccount_id)
5129            .field("limit", &self.limit)
5130            .field("page_token", &self.page_token)
5131            .finish()
5132    }
5133}
5134impl ListTriggerEventsRequest {
5135    /// Protobuf type URL for this message, for use with `Any::pack` and
5136    /// `Any::unpack_if`.
5137    ///
5138    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5139    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
5140}
5141impl ListTriggerEventsRequest {
5142    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5143    #[inline]
5144    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
5145    pub fn with_subaccount_id(mut self, value: u64) -> Self {
5146        self.subaccount_id = Some(value);
5147        self
5148    }
5149}
5150::buffa::impl_default_instance!(ListTriggerEventsRequest);
5151impl ::buffa::MessageName for ListTriggerEventsRequest {
5152    const PACKAGE: &'static str = "triggers.v1";
5153    const NAME: &'static str = "ListTriggerEventsRequest";
5154    const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsRequest";
5155    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
5156}
5157impl ::buffa::Message for ListTriggerEventsRequest {
5158    /// Returns the total encoded size in bytes.
5159    ///
5160    /// The result is a `u32`; the protobuf specification requires all
5161    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5162    /// compliant message will never overflow this type.
5163    #[allow(clippy::let_and_return)]
5164    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5165        #[allow(unused_imports)]
5166        use ::buffa::Enumeration as _;
5167        let mut size = 0u32;
5168        if self.trigger_id != 0u64 {
5169            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5170        }
5171        if self.subaccount_id.is_some() {
5172            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5173        }
5174        if self.limit != 0u32 {
5175            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
5176        }
5177        if !self.page_token.is_empty() {
5178            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
5179        }
5180        size += self.__buffa_unknown_fields.encoded_len() as u32;
5181        size
5182    }
5183    fn write_to(
5184        &self,
5185        _cache: &mut ::buffa::SizeCache,
5186        buf: &mut impl ::buffa::bytes::BufMut,
5187    ) {
5188        #[allow(unused_imports)]
5189        use ::buffa::Enumeration as _;
5190        if self.trigger_id != 0u64 {
5191            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5192        }
5193        if let Some(v) = self.subaccount_id {
5194            ::buffa::types::put_fixed64_field(2u32, v, buf);
5195        }
5196        if self.limit != 0u32 {
5197            ::buffa::types::put_uint32_field(3u32, self.limit, buf);
5198        }
5199        if !self.page_token.is_empty() {
5200            ::buffa::types::put_string_field(5u32, &self.page_token, buf);
5201        }
5202        self.__buffa_unknown_fields.write_to(buf);
5203    }
5204    fn merge_field(
5205        &mut self,
5206        tag: ::buffa::encoding::Tag,
5207        buf: &mut impl ::buffa::bytes::Buf,
5208        ctx: ::buffa::DecodeContext<'_>,
5209    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5210        #[allow(unused_imports)]
5211        use ::buffa::bytes::Buf as _;
5212        #[allow(unused_imports)]
5213        use ::buffa::Enumeration as _;
5214        match tag.field_number() {
5215            1u32 => {
5216                ::buffa::encoding::check_wire_type(
5217                    tag,
5218                    ::buffa::encoding::WireType::Fixed64,
5219                )?;
5220                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5221            }
5222            2u32 => {
5223                ::buffa::encoding::check_wire_type(
5224                    tag,
5225                    ::buffa::encoding::WireType::Fixed64,
5226                )?;
5227                self.subaccount_id = ::core::option::Option::Some(
5228                    ::buffa::types::decode_fixed64(buf)?,
5229                );
5230            }
5231            3u32 => {
5232                ::buffa::encoding::check_wire_type(
5233                    tag,
5234                    ::buffa::encoding::WireType::Varint,
5235                )?;
5236                self.limit = ::buffa::types::decode_uint32(buf)?;
5237            }
5238            5u32 => {
5239                ::buffa::encoding::check_wire_type(
5240                    tag,
5241                    ::buffa::encoding::WireType::LengthDelimited,
5242                )?;
5243                ::buffa::types::merge_string(&mut self.page_token, buf)?;
5244            }
5245            _ => {
5246                self.__buffa_unknown_fields
5247                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5248            }
5249        }
5250        ::core::result::Result::Ok(())
5251    }
5252    fn clear(&mut self) {
5253        self.trigger_id = 0u64;
5254        self.subaccount_id = ::core::option::Option::None;
5255        self.limit = 0u32;
5256        self.page_token.clear();
5257        self.__buffa_unknown_fields.clear();
5258    }
5259}
5260impl ::buffa::ExtensionSet for ListTriggerEventsRequest {
5261    const PROTO_FQN: &'static str = "triggers.v1.ListTriggerEventsRequest";
5262    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5263        &self.__buffa_unknown_fields
5264    }
5265    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5266        &mut self.__buffa_unknown_fields
5267    }
5268}
5269impl ::buffa::json_helpers::ProtoElemJson for ListTriggerEventsRequest {
5270    fn serialize_proto_json<S: ::serde::Serializer>(
5271        v: &Self,
5272        s: S,
5273    ) -> ::core::result::Result<S::Ok, S::Error> {
5274        ::serde::Serialize::serialize(v, s)
5275    }
5276    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5277        d: D,
5278    ) -> ::core::result::Result<Self, D::Error> {
5279        <Self as ::serde::Deserialize>::deserialize(d)
5280    }
5281}
5282#[doc(hidden)]
5283pub const __LIST_TRIGGER_EVENTS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5284    type_url: "type.googleapis.com/triggers.v1.ListTriggerEventsRequest",
5285    to_json: ::buffa::type_registry::any_to_json::<ListTriggerEventsRequest>,
5286    from_json: ::buffa::type_registry::any_from_json::<ListTriggerEventsRequest>,
5287    is_wkt: false,
5288};
5289/// TriggerEvent describes one historical trigger lifecycle event.
5290#[derive(Clone, PartialEq, Default)]
5291#[derive(::serde::Serialize, ::serde::Deserialize)]
5292#[serde(default)]
5293pub struct TriggerEvent {
5294    /// Trigger ID associated with the event.
5295    ///
5296    /// Field 1: `trigger_id`
5297    #[serde(
5298        rename = "triggerId",
5299        alias = "trigger_id",
5300        with = "::buffa::json_helpers::uint64",
5301        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5302    )]
5303    pub trigger_id: u64,
5304    /// Public account or sub-account ID associated with the trigger.
5305    ///
5306    /// Field 2: `subaccount_id`
5307    #[serde(
5308        rename = "subaccountId",
5309        alias = "subaccount_id",
5310        with = "::buffa::json_helpers::uint64",
5311        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5312    )]
5313    pub subaccount_id: u64,
5314    /// Trading symbol numeric identifier.
5315    ///
5316    /// Field 3: `symbol_id`
5317    #[serde(
5318        rename = "symbolId",
5319        alias = "symbol_id",
5320        with = "::buffa::json_helpers::uint32",
5321        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5322    )]
5323    pub symbol_id: u32,
5324    /// Trigger type at the time of the event.
5325    ///
5326    /// Field 4: `trigger_type`
5327    #[serde(
5328        rename = "triggerType",
5329        alias = "trigger_type",
5330        with = "::buffa::json_helpers::proto_enum",
5331        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5332    )]
5333    pub trigger_type: ::buffa::EnumValue<TriggerType>,
5334    /// Event category.
5335    ///
5336    /// Field 5: `event_type`
5337    #[serde(
5338        rename = "eventType",
5339        alias = "event_type",
5340        with = "::buffa::json_helpers::proto_enum",
5341        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5342    )]
5343    pub event_type: ::buffa::EnumValue<TriggerEventType>,
5344    /// Event timestamp in nanoseconds since epoch (UTC).
5345    ///
5346    /// Field 10: `ts_ns`
5347    #[serde(
5348        rename = "tsNs",
5349        alias = "ts_ns",
5350        with = "::buffa::json_helpers::uint64",
5351        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5352    )]
5353    pub ts_ns: u64,
5354    /// Child sequence number for multi-child trigger strategies.
5355    ///
5356    /// Field 11: `child_seq`
5357    #[serde(
5358        rename = "childSeq",
5359        alias = "child_seq",
5360        with = "::buffa::json_helpers::int32",
5361        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
5362    )]
5363    pub child_seq: i32,
5364    /// Child order ID created by this event, if any.
5365    ///
5366    /// Field 12: `child_order_id`
5367    #[serde(
5368        rename = "childOrderId",
5369        alias = "child_order_id",
5370        with = "::buffa::json_helpers::uint64",
5371        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5372    )]
5373    pub child_order_id: u64,
5374    /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
5375    /// when not applicable.
5376    ///
5377    /// Field 13: `fire_price_ticks`
5378    #[serde(
5379        rename = "firePriceTicks",
5380        alias = "fire_price_ticks",
5381        with = "::buffa::json_helpers::int64",
5382        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5383    )]
5384    pub fire_price_ticks: i64,
5385    /// Optional cancel reason.
5386    ///
5387    /// Field 20: `reason`
5388    #[serde(
5389        rename = "reason",
5390        with = "::buffa::json_helpers::proto_string",
5391        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5392    )]
5393    pub reason: ::buffa::alloc::string::String,
5394    #[serde(skip)]
5395    #[doc(hidden)]
5396    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5397}
5398impl ::core::fmt::Debug for TriggerEvent {
5399    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5400        f.debug_struct("TriggerEvent")
5401            .field("trigger_id", &self.trigger_id)
5402            .field("subaccount_id", &self.subaccount_id)
5403            .field("symbol_id", &self.symbol_id)
5404            .field("trigger_type", &self.trigger_type)
5405            .field("event_type", &self.event_type)
5406            .field("ts_ns", &self.ts_ns)
5407            .field("child_seq", &self.child_seq)
5408            .field("child_order_id", &self.child_order_id)
5409            .field("fire_price_ticks", &self.fire_price_ticks)
5410            .field("reason", &self.reason)
5411            .finish()
5412    }
5413}
5414impl TriggerEvent {
5415    /// Protobuf type URL for this message, for use with `Any::pack` and
5416    /// `Any::unpack_if`.
5417    ///
5418    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5419    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
5420}
5421::buffa::impl_default_instance!(TriggerEvent);
5422impl ::buffa::MessageName for TriggerEvent {
5423    const PACKAGE: &'static str = "triggers.v1";
5424    const NAME: &'static str = "TriggerEvent";
5425    const FULL_NAME: &'static str = "triggers.v1.TriggerEvent";
5426    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
5427}
5428impl ::buffa::Message for TriggerEvent {
5429    /// Returns the total encoded size in bytes.
5430    ///
5431    /// The result is a `u32`; the protobuf specification requires all
5432    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5433    /// compliant message will never overflow this type.
5434    #[allow(clippy::let_and_return)]
5435    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5436        #[allow(unused_imports)]
5437        use ::buffa::Enumeration as _;
5438        let mut size = 0u32;
5439        if self.trigger_id != 0u64 {
5440            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5441        }
5442        if self.subaccount_id != 0u64 {
5443            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5444        }
5445        if self.symbol_id != 0u32 {
5446            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
5447        }
5448        {
5449            let val = self.trigger_type.to_i32();
5450            if val != 0 {
5451                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5452            }
5453        }
5454        {
5455            let val = self.event_type.to_i32();
5456            if val != 0 {
5457                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5458            }
5459        }
5460        if self.ts_ns != 0u64 {
5461            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
5462        }
5463        if self.child_seq != 0i32 {
5464            size += 1u32 + ::buffa::types::int32_encoded_len(self.child_seq) as u32;
5465        }
5466        if self.child_order_id != 0u64 {
5467            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5468        }
5469        if self.fire_price_ticks != 0i64 {
5470            size
5471                += 1u32
5472                    + ::buffa::types::int64_encoded_len(self.fire_price_ticks) as u32;
5473        }
5474        if !self.reason.is_empty() {
5475            size += 2u32 + ::buffa::types::string_encoded_len(&self.reason) as u32;
5476        }
5477        size += self.__buffa_unknown_fields.encoded_len() as u32;
5478        size
5479    }
5480    fn write_to(
5481        &self,
5482        _cache: &mut ::buffa::SizeCache,
5483        buf: &mut impl ::buffa::bytes::BufMut,
5484    ) {
5485        #[allow(unused_imports)]
5486        use ::buffa::Enumeration as _;
5487        if self.trigger_id != 0u64 {
5488            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5489        }
5490        if self.subaccount_id != 0u64 {
5491            ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
5492        }
5493        if self.symbol_id != 0u32 {
5494            ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
5495        }
5496        {
5497            let val = self.trigger_type.to_i32();
5498            if val != 0 {
5499                ::buffa::types::put_int32_field(4u32, val, buf);
5500            }
5501        }
5502        {
5503            let val = self.event_type.to_i32();
5504            if val != 0 {
5505                ::buffa::types::put_int32_field(5u32, val, buf);
5506            }
5507        }
5508        if self.ts_ns != 0u64 {
5509            ::buffa::types::put_uint64_field(10u32, self.ts_ns, buf);
5510        }
5511        if self.child_seq != 0i32 {
5512            ::buffa::types::put_int32_field(11u32, self.child_seq, buf);
5513        }
5514        if self.child_order_id != 0u64 {
5515            ::buffa::types::put_fixed64_field(12u32, self.child_order_id, buf);
5516        }
5517        if self.fire_price_ticks != 0i64 {
5518            ::buffa::types::put_int64_field(13u32, self.fire_price_ticks, buf);
5519        }
5520        if !self.reason.is_empty() {
5521            ::buffa::types::put_string_field(20u32, &self.reason, buf);
5522        }
5523        self.__buffa_unknown_fields.write_to(buf);
5524    }
5525    fn merge_field(
5526        &mut self,
5527        tag: ::buffa::encoding::Tag,
5528        buf: &mut impl ::buffa::bytes::Buf,
5529        ctx: ::buffa::DecodeContext<'_>,
5530    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5531        #[allow(unused_imports)]
5532        use ::buffa::bytes::Buf as _;
5533        #[allow(unused_imports)]
5534        use ::buffa::Enumeration as _;
5535        match tag.field_number() {
5536            1u32 => {
5537                ::buffa::encoding::check_wire_type(
5538                    tag,
5539                    ::buffa::encoding::WireType::Fixed64,
5540                )?;
5541                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5542            }
5543            2u32 => {
5544                ::buffa::encoding::check_wire_type(
5545                    tag,
5546                    ::buffa::encoding::WireType::Fixed64,
5547                )?;
5548                self.subaccount_id = ::buffa::types::decode_fixed64(buf)?;
5549            }
5550            3u32 => {
5551                ::buffa::encoding::check_wire_type(
5552                    tag,
5553                    ::buffa::encoding::WireType::Varint,
5554                )?;
5555                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
5556            }
5557            4u32 => {
5558                ::buffa::encoding::check_wire_type(
5559                    tag,
5560                    ::buffa::encoding::WireType::Varint,
5561                )?;
5562                self.trigger_type = ::buffa::EnumValue::from(
5563                    ::buffa::types::decode_int32(buf)?,
5564                );
5565            }
5566            5u32 => {
5567                ::buffa::encoding::check_wire_type(
5568                    tag,
5569                    ::buffa::encoding::WireType::Varint,
5570                )?;
5571                self.event_type = ::buffa::EnumValue::from(
5572                    ::buffa::types::decode_int32(buf)?,
5573                );
5574            }
5575            10u32 => {
5576                ::buffa::encoding::check_wire_type(
5577                    tag,
5578                    ::buffa::encoding::WireType::Varint,
5579                )?;
5580                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
5581            }
5582            11u32 => {
5583                ::buffa::encoding::check_wire_type(
5584                    tag,
5585                    ::buffa::encoding::WireType::Varint,
5586                )?;
5587                self.child_seq = ::buffa::types::decode_int32(buf)?;
5588            }
5589            12u32 => {
5590                ::buffa::encoding::check_wire_type(
5591                    tag,
5592                    ::buffa::encoding::WireType::Fixed64,
5593                )?;
5594                self.child_order_id = ::buffa::types::decode_fixed64(buf)?;
5595            }
5596            13u32 => {
5597                ::buffa::encoding::check_wire_type(
5598                    tag,
5599                    ::buffa::encoding::WireType::Varint,
5600                )?;
5601                self.fire_price_ticks = ::buffa::types::decode_int64(buf)?;
5602            }
5603            20u32 => {
5604                ::buffa::encoding::check_wire_type(
5605                    tag,
5606                    ::buffa::encoding::WireType::LengthDelimited,
5607                )?;
5608                ::buffa::types::merge_string(&mut self.reason, buf)?;
5609            }
5610            _ => {
5611                self.__buffa_unknown_fields
5612                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5613            }
5614        }
5615        ::core::result::Result::Ok(())
5616    }
5617    fn clear(&mut self) {
5618        self.trigger_id = 0u64;
5619        self.subaccount_id = 0u64;
5620        self.symbol_id = 0u32;
5621        self.trigger_type = ::buffa::EnumValue::from(0);
5622        self.event_type = ::buffa::EnumValue::from(0);
5623        self.ts_ns = 0u64;
5624        self.child_seq = 0i32;
5625        self.child_order_id = 0u64;
5626        self.fire_price_ticks = 0i64;
5627        self.reason.clear();
5628        self.__buffa_unknown_fields.clear();
5629    }
5630}
5631impl ::buffa::ExtensionSet for TriggerEvent {
5632    const PROTO_FQN: &'static str = "triggers.v1.TriggerEvent";
5633    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5634        &self.__buffa_unknown_fields
5635    }
5636    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5637        &mut self.__buffa_unknown_fields
5638    }
5639}
5640impl ::buffa::json_helpers::ProtoElemJson for TriggerEvent {
5641    fn serialize_proto_json<S: ::serde::Serializer>(
5642        v: &Self,
5643        s: S,
5644    ) -> ::core::result::Result<S::Ok, S::Error> {
5645        ::serde::Serialize::serialize(v, s)
5646    }
5647    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5648        d: D,
5649    ) -> ::core::result::Result<Self, D::Error> {
5650        <Self as ::serde::Deserialize>::deserialize(d)
5651    }
5652}
5653#[doc(hidden)]
5654pub const __TRIGGER_EVENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5655    type_url: "type.googleapis.com/triggers.v1.TriggerEvent",
5656    to_json: ::buffa::type_registry::any_to_json::<TriggerEvent>,
5657    from_json: ::buffa::type_registry::any_from_json::<TriggerEvent>,
5658    is_wkt: false,
5659};
5660/// ListTriggerEventsResponse returns historical events ordered newest-first.
5661#[derive(Clone, PartialEq, Default)]
5662#[derive(::serde::Serialize, ::serde::Deserialize)]
5663#[serde(default)]
5664pub struct ListTriggerEventsResponse {
5665    /// Events ordered by event time descending, child sequence descending, and
5666    /// stable event tie-breakers descending.
5667    ///
5668    /// Field 1: `events`
5669    #[serde(
5670        rename = "events",
5671        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5672        deserialize_with = "::buffa::json_helpers::null_as_default"
5673    )]
5674    pub events: ::buffa::alloc::vec::Vec<TriggerEvent>,
5675    /// Opaque cursor for the next page. Empty when no more results exist.
5676    ///
5677    /// Field 3: `next_page_token`
5678    #[serde(
5679        rename = "nextPageToken",
5680        alias = "next_page_token",
5681        with = "::buffa::json_helpers::proto_string",
5682        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5683    )]
5684    pub next_page_token: ::buffa::alloc::string::String,
5685    #[serde(skip)]
5686    #[doc(hidden)]
5687    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5688}
5689impl ::core::fmt::Debug for ListTriggerEventsResponse {
5690    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5691        f.debug_struct("ListTriggerEventsResponse")
5692            .field("events", &self.events)
5693            .field("next_page_token", &self.next_page_token)
5694            .finish()
5695    }
5696}
5697impl ListTriggerEventsResponse {
5698    /// Protobuf type URL for this message, for use with `Any::pack` and
5699    /// `Any::unpack_if`.
5700    ///
5701    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5702    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
5703}
5704::buffa::impl_default_instance!(ListTriggerEventsResponse);
5705impl ::buffa::MessageName for ListTriggerEventsResponse {
5706    const PACKAGE: &'static str = "triggers.v1";
5707    const NAME: &'static str = "ListTriggerEventsResponse";
5708    const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsResponse";
5709    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
5710}
5711impl ::buffa::Message for ListTriggerEventsResponse {
5712    /// Returns the total encoded size in bytes.
5713    ///
5714    /// The result is a `u32`; the protobuf specification requires all
5715    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5716    /// compliant message will never overflow this type.
5717    #[allow(clippy::let_and_return)]
5718    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5719        #[allow(unused_imports)]
5720        use ::buffa::Enumeration as _;
5721        let mut size = 0u32;
5722        for v in &self.events {
5723            let __slot = __cache.reserve();
5724            let inner_size = v.compute_size(__cache);
5725            __cache.set(__slot, inner_size);
5726            size
5727                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5728                    + inner_size;
5729        }
5730        if !self.next_page_token.is_empty() {
5731            size
5732                += 1u32
5733                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5734        }
5735        size += self.__buffa_unknown_fields.encoded_len() as u32;
5736        size
5737    }
5738    fn write_to(
5739        &self,
5740        __cache: &mut ::buffa::SizeCache,
5741        buf: &mut impl ::buffa::bytes::BufMut,
5742    ) {
5743        #[allow(unused_imports)]
5744        use ::buffa::Enumeration as _;
5745        for v in &self.events {
5746            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
5747            v.write_to(__cache, buf);
5748        }
5749        if !self.next_page_token.is_empty() {
5750            ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
5751        }
5752        self.__buffa_unknown_fields.write_to(buf);
5753    }
5754    fn merge_field(
5755        &mut self,
5756        tag: ::buffa::encoding::Tag,
5757        buf: &mut impl ::buffa::bytes::Buf,
5758        ctx: ::buffa::DecodeContext<'_>,
5759    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5760        #[allow(unused_imports)]
5761        use ::buffa::bytes::Buf as _;
5762        #[allow(unused_imports)]
5763        use ::buffa::Enumeration as _;
5764        match tag.field_number() {
5765            1u32 => {
5766                ::buffa::encoding::check_wire_type(
5767                    tag,
5768                    ::buffa::encoding::WireType::LengthDelimited,
5769                )?;
5770                let mut elem = ::core::default::Default::default();
5771                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5772                self.events.push(elem);
5773            }
5774            3u32 => {
5775                ::buffa::encoding::check_wire_type(
5776                    tag,
5777                    ::buffa::encoding::WireType::LengthDelimited,
5778                )?;
5779                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5780            }
5781            _ => {
5782                self.__buffa_unknown_fields
5783                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5784            }
5785        }
5786        ::core::result::Result::Ok(())
5787    }
5788    fn clear(&mut self) {
5789        self.events.clear();
5790        self.next_page_token.clear();
5791        self.__buffa_unknown_fields.clear();
5792    }
5793}
5794impl ::buffa::ExtensionSet for ListTriggerEventsResponse {
5795    const PROTO_FQN: &'static str = "triggers.v1.ListTriggerEventsResponse";
5796    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5797        &self.__buffa_unknown_fields
5798    }
5799    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5800        &mut self.__buffa_unknown_fields
5801    }
5802}
5803impl ::buffa::json_helpers::ProtoElemJson for ListTriggerEventsResponse {
5804    fn serialize_proto_json<S: ::serde::Serializer>(
5805        v: &Self,
5806        s: S,
5807    ) -> ::core::result::Result<S::Ok, S::Error> {
5808        ::serde::Serialize::serialize(v, s)
5809    }
5810    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5811        d: D,
5812    ) -> ::core::result::Result<Self, D::Error> {
5813        <Self as ::serde::Deserialize>::deserialize(d)
5814    }
5815}
5816#[doc(hidden)]
5817pub const __LIST_TRIGGER_EVENTS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5818    type_url: "type.googleapis.com/triggers.v1.ListTriggerEventsResponse",
5819    to_json: ::buffa::type_registry::any_to_json::<ListTriggerEventsResponse>,
5820    from_json: ::buffa::type_registry::any_from_json::<ListTriggerEventsResponse>,
5821    is_wkt: false,
5822};
5823/// =============================================================================
5824/// Cancel Trigger
5825/// =============================================================================
5826///
5827/// CancelTriggerRequest cancels an active trigger by ID.
5828#[derive(Clone, PartialEq, Default)]
5829#[derive(::serde::Serialize, ::serde::Deserialize)]
5830#[serde(default)]
5831pub struct CancelTriggerRequest {
5832    /// Trigger ID to cancel.
5833    ///
5834    /// Field 1: `trigger_id`
5835    #[serde(
5836        rename = "triggerId",
5837        alias = "trigger_id",
5838        with = "::buffa::json_helpers::uint64",
5839        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5840    )]
5841    pub trigger_id: u64,
5842    /// Optional sub-account for authorization.
5843    ///
5844    /// Field 2: `subaccount_id`
5845    #[serde(
5846        rename = "subaccountId",
5847        alias = "subaccount_id",
5848        with = "::buffa::json_helpers::opt_uint64",
5849        skip_serializing_if = "::core::option::Option::is_none"
5850    )]
5851    pub subaccount_id: ::core::option::Option<u64>,
5852    #[serde(skip)]
5853    #[doc(hidden)]
5854    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5855}
5856impl ::core::fmt::Debug for CancelTriggerRequest {
5857    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5858        f.debug_struct("CancelTriggerRequest")
5859            .field("trigger_id", &self.trigger_id)
5860            .field("subaccount_id", &self.subaccount_id)
5861            .finish()
5862    }
5863}
5864impl CancelTriggerRequest {
5865    /// Protobuf type URL for this message, for use with `Any::pack` and
5866    /// `Any::unpack_if`.
5867    ///
5868    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5869    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
5870}
5871impl CancelTriggerRequest {
5872    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5873    #[inline]
5874    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
5875    pub fn with_subaccount_id(mut self, value: u64) -> Self {
5876        self.subaccount_id = Some(value);
5877        self
5878    }
5879}
5880::buffa::impl_default_instance!(CancelTriggerRequest);
5881impl ::buffa::MessageName for CancelTriggerRequest {
5882    const PACKAGE: &'static str = "triggers.v1";
5883    const NAME: &'static str = "CancelTriggerRequest";
5884    const FULL_NAME: &'static str = "triggers.v1.CancelTriggerRequest";
5885    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
5886}
5887impl ::buffa::Message for CancelTriggerRequest {
5888    /// Returns the total encoded size in bytes.
5889    ///
5890    /// The result is a `u32`; the protobuf specification requires all
5891    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5892    /// compliant message will never overflow this type.
5893    #[allow(clippy::let_and_return)]
5894    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5895        #[allow(unused_imports)]
5896        use ::buffa::Enumeration as _;
5897        let mut size = 0u32;
5898        if self.trigger_id != 0u64 {
5899            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5900        }
5901        if self.subaccount_id.is_some() {
5902            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5903        }
5904        size += self.__buffa_unknown_fields.encoded_len() as u32;
5905        size
5906    }
5907    fn write_to(
5908        &self,
5909        _cache: &mut ::buffa::SizeCache,
5910        buf: &mut impl ::buffa::bytes::BufMut,
5911    ) {
5912        #[allow(unused_imports)]
5913        use ::buffa::Enumeration as _;
5914        if self.trigger_id != 0u64 {
5915            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5916        }
5917        if let Some(v) = self.subaccount_id {
5918            ::buffa::types::put_fixed64_field(2u32, v, buf);
5919        }
5920        self.__buffa_unknown_fields.write_to(buf);
5921    }
5922    fn merge_field(
5923        &mut self,
5924        tag: ::buffa::encoding::Tag,
5925        buf: &mut impl ::buffa::bytes::Buf,
5926        ctx: ::buffa::DecodeContext<'_>,
5927    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5928        #[allow(unused_imports)]
5929        use ::buffa::bytes::Buf as _;
5930        #[allow(unused_imports)]
5931        use ::buffa::Enumeration as _;
5932        match tag.field_number() {
5933            1u32 => {
5934                ::buffa::encoding::check_wire_type(
5935                    tag,
5936                    ::buffa::encoding::WireType::Fixed64,
5937                )?;
5938                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5939            }
5940            2u32 => {
5941                ::buffa::encoding::check_wire_type(
5942                    tag,
5943                    ::buffa::encoding::WireType::Fixed64,
5944                )?;
5945                self.subaccount_id = ::core::option::Option::Some(
5946                    ::buffa::types::decode_fixed64(buf)?,
5947                );
5948            }
5949            _ => {
5950                self.__buffa_unknown_fields
5951                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5952            }
5953        }
5954        ::core::result::Result::Ok(())
5955    }
5956    fn clear(&mut self) {
5957        self.trigger_id = 0u64;
5958        self.subaccount_id = ::core::option::Option::None;
5959        self.__buffa_unknown_fields.clear();
5960    }
5961}
5962impl ::buffa::ExtensionSet for CancelTriggerRequest {
5963    const PROTO_FQN: &'static str = "triggers.v1.CancelTriggerRequest";
5964    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5965        &self.__buffa_unknown_fields
5966    }
5967    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5968        &mut self.__buffa_unknown_fields
5969    }
5970}
5971impl ::buffa::json_helpers::ProtoElemJson for CancelTriggerRequest {
5972    fn serialize_proto_json<S: ::serde::Serializer>(
5973        v: &Self,
5974        s: S,
5975    ) -> ::core::result::Result<S::Ok, S::Error> {
5976        ::serde::Serialize::serialize(v, s)
5977    }
5978    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5979        d: D,
5980    ) -> ::core::result::Result<Self, D::Error> {
5981        <Self as ::serde::Deserialize>::deserialize(d)
5982    }
5983}
5984#[doc(hidden)]
5985pub const __CANCEL_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5986    type_url: "type.googleapis.com/triggers.v1.CancelTriggerRequest",
5987    to_json: ::buffa::type_registry::any_to_json::<CancelTriggerRequest>,
5988    from_json: ::buffa::type_registry::any_from_json::<CancelTriggerRequest>,
5989    is_wkt: false,
5990};
5991/// CancelTriggerResponse returns the final status after cancellation.
5992#[derive(Clone, PartialEq, Default)]
5993#[derive(::serde::Serialize, ::serde::Deserialize)]
5994#[serde(default)]
5995pub struct CancelTriggerResponse {
5996    /// Trigger ID that was canceled.
5997    ///
5998    /// Field 1: `trigger_id`
5999    #[serde(
6000        rename = "triggerId",
6001        alias = "trigger_id",
6002        with = "::buffa::json_helpers::uint64",
6003        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6004    )]
6005    pub trigger_id: u64,
6006    /// Final status (should be STATUS_CANCELED).
6007    ///
6008    /// Field 2: `status`
6009    #[serde(
6010        rename = "status",
6011        with = "::buffa::json_helpers::proto_enum",
6012        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6013    )]
6014    pub status: ::buffa::EnumValue<TriggerStatus>,
6015    /// Server timestamp.
6016    ///
6017    /// Field 3: `ts`
6018    #[serde(
6019        rename = "ts",
6020        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6021    )]
6022    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
6023    /// Server timestamp in nanoseconds since epoch (UTC).
6024    ///
6025    /// Field 4: `ts_ns`
6026    #[serde(
6027        rename = "tsNs",
6028        alias = "ts_ns",
6029        with = "::buffa::json_helpers::uint64",
6030        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6031    )]
6032    pub ts_ns: u64,
6033    #[serde(skip)]
6034    #[doc(hidden)]
6035    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6036}
6037impl ::core::fmt::Debug for CancelTriggerResponse {
6038    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6039        f.debug_struct("CancelTriggerResponse")
6040            .field("trigger_id", &self.trigger_id)
6041            .field("status", &self.status)
6042            .field("ts", &self.ts)
6043            .field("ts_ns", &self.ts_ns)
6044            .finish()
6045    }
6046}
6047impl CancelTriggerResponse {
6048    /// Protobuf type URL for this message, for use with `Any::pack` and
6049    /// `Any::unpack_if`.
6050    ///
6051    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6052    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
6053}
6054::buffa::impl_default_instance!(CancelTriggerResponse);
6055impl ::buffa::MessageName for CancelTriggerResponse {
6056    const PACKAGE: &'static str = "triggers.v1";
6057    const NAME: &'static str = "CancelTriggerResponse";
6058    const FULL_NAME: &'static str = "triggers.v1.CancelTriggerResponse";
6059    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
6060}
6061impl ::buffa::Message for CancelTriggerResponse {
6062    /// Returns the total encoded size in bytes.
6063    ///
6064    /// The result is a `u32`; the protobuf specification requires all
6065    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6066    /// compliant message will never overflow this type.
6067    #[allow(clippy::let_and_return)]
6068    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6069        #[allow(unused_imports)]
6070        use ::buffa::Enumeration as _;
6071        let mut size = 0u32;
6072        if self.trigger_id != 0u64 {
6073            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6074        }
6075        {
6076            let val = self.status.to_i32();
6077            if val != 0 {
6078                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
6079            }
6080        }
6081        if self.ts.is_set() {
6082            let __slot = __cache.reserve();
6083            let inner_size = self.ts.compute_size(__cache);
6084            __cache.set(__slot, inner_size);
6085            size
6086                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6087                    + inner_size;
6088        }
6089        if self.ts_ns != 0u64 {
6090            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
6091        }
6092        size += self.__buffa_unknown_fields.encoded_len() as u32;
6093        size
6094    }
6095    fn write_to(
6096        &self,
6097        __cache: &mut ::buffa::SizeCache,
6098        buf: &mut impl ::buffa::bytes::BufMut,
6099    ) {
6100        #[allow(unused_imports)]
6101        use ::buffa::Enumeration as _;
6102        if self.trigger_id != 0u64 {
6103            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6104        }
6105        {
6106            let val = self.status.to_i32();
6107            if val != 0 {
6108                ::buffa::types::put_int32_field(2u32, val, buf);
6109            }
6110        }
6111        if self.ts.is_set() {
6112            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
6113            self.ts.write_to(__cache, buf);
6114        }
6115        if self.ts_ns != 0u64 {
6116            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
6117        }
6118        self.__buffa_unknown_fields.write_to(buf);
6119    }
6120    fn merge_field(
6121        &mut self,
6122        tag: ::buffa::encoding::Tag,
6123        buf: &mut impl ::buffa::bytes::Buf,
6124        ctx: ::buffa::DecodeContext<'_>,
6125    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6126        #[allow(unused_imports)]
6127        use ::buffa::bytes::Buf as _;
6128        #[allow(unused_imports)]
6129        use ::buffa::Enumeration as _;
6130        match tag.field_number() {
6131            1u32 => {
6132                ::buffa::encoding::check_wire_type(
6133                    tag,
6134                    ::buffa::encoding::WireType::Fixed64,
6135                )?;
6136                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6137            }
6138            2u32 => {
6139                ::buffa::encoding::check_wire_type(
6140                    tag,
6141                    ::buffa::encoding::WireType::Varint,
6142                )?;
6143                self.status = ::buffa::EnumValue::from(
6144                    ::buffa::types::decode_int32(buf)?,
6145                );
6146            }
6147            3u32 => {
6148                ::buffa::encoding::check_wire_type(
6149                    tag,
6150                    ::buffa::encoding::WireType::LengthDelimited,
6151                )?;
6152                ::buffa::Message::merge_length_delimited(
6153                    self.ts.get_or_insert_default(),
6154                    buf,
6155                    ctx,
6156                )?;
6157            }
6158            4u32 => {
6159                ::buffa::encoding::check_wire_type(
6160                    tag,
6161                    ::buffa::encoding::WireType::Varint,
6162                )?;
6163                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
6164            }
6165            _ => {
6166                self.__buffa_unknown_fields
6167                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6168            }
6169        }
6170        ::core::result::Result::Ok(())
6171    }
6172    fn clear(&mut self) {
6173        self.trigger_id = 0u64;
6174        self.status = ::buffa::EnumValue::from(0);
6175        self.ts = ::buffa::MessageField::none();
6176        self.ts_ns = 0u64;
6177        self.__buffa_unknown_fields.clear();
6178    }
6179}
6180impl ::buffa::ExtensionSet for CancelTriggerResponse {
6181    const PROTO_FQN: &'static str = "triggers.v1.CancelTriggerResponse";
6182    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6183        &self.__buffa_unknown_fields
6184    }
6185    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6186        &mut self.__buffa_unknown_fields
6187    }
6188}
6189impl ::buffa::json_helpers::ProtoElemJson for CancelTriggerResponse {
6190    fn serialize_proto_json<S: ::serde::Serializer>(
6191        v: &Self,
6192        s: S,
6193    ) -> ::core::result::Result<S::Ok, S::Error> {
6194        ::serde::Serialize::serialize(v, s)
6195    }
6196    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6197        d: D,
6198    ) -> ::core::result::Result<Self, D::Error> {
6199        <Self as ::serde::Deserialize>::deserialize(d)
6200    }
6201}
6202#[doc(hidden)]
6203pub const __CANCEL_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6204    type_url: "type.googleapis.com/triggers.v1.CancelTriggerResponse",
6205    to_json: ::buffa::type_registry::any_to_json::<CancelTriggerResponse>,
6206    from_json: ::buffa::type_registry::any_from_json::<CancelTriggerResponse>,
6207    is_wkt: false,
6208};
6209/// =============================================================================
6210/// Modify / Pause / Resume Trigger
6211/// =============================================================================
6212///
6213/// ModifyTriggerRequest applies a limited patch to an existing trigger.
6214#[derive(Clone, PartialEq, Default)]
6215#[derive(::serde::Serialize)]
6216#[serde(default)]
6217pub struct ModifyTriggerRequest {
6218    /// Trigger ID to modify.
6219    ///
6220    /// Field 1: `trigger_id`
6221    #[serde(
6222        rename = "triggerId",
6223        alias = "trigger_id",
6224        with = "::buffa::json_helpers::uint64",
6225        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6226    )]
6227    pub trigger_id: u64,
6228    /// Optional sub-account for authorization.
6229    ///
6230    /// Field 2: `subaccount_id`
6231    #[serde(
6232        rename = "subaccountId",
6233        alias = "subaccount_id",
6234        with = "::buffa::json_helpers::opt_uint64",
6235        skip_serializing_if = "::core::option::Option::is_none"
6236    )]
6237    pub subaccount_id: ::core::option::Option<u64>,
6238    /// Patch fields for safe price, trailing-distance, and slippage edits.
6239    /// For stop/take-profit:
6240    /// Updated trigger price in quote units scaled by 1e6.
6241    ///
6242    /// Field 10: `trigger_price_ticks`
6243    #[serde(
6244        rename = "triggerPriceTicks",
6245        alias = "trigger_price_ticks",
6246        with = "::buffa::json_helpers::opt_int64",
6247        skip_serializing_if = "::core::option::Option::is_none"
6248    )]
6249    pub trigger_price_ticks: ::core::option::Option<i64>,
6250    /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
6251    ///
6252    /// Field 11: `limit_price_ticks`
6253    #[serde(
6254        rename = "limitPriceTicks",
6255        alias = "limit_price_ticks",
6256        with = "::buffa::json_helpers::opt_int64",
6257        skip_serializing_if = "::core::option::Option::is_none"
6258    )]
6259    pub limit_price_ticks: ::core::option::Option<i64>,
6260    /// Updated activation price in quote units scaled by 1e6.
6261    ///
6262    /// Field 14: `activation_price_ticks`
6263    #[serde(
6264        rename = "activationPriceTicks",
6265        alias = "activation_price_ticks",
6266        with = "::buffa::json_helpers::opt_int64",
6267        skip_serializing_if = "::core::option::Option::is_none"
6268    )]
6269    pub activation_price_ticks: ::core::option::Option<i64>,
6270    #[serde(flatten)]
6271    pub trailing_distance: ::core::option::Option<
6272        __buffa::oneof::modify_trigger_request::TrailingDistance,
6273    >,
6274    #[serde(flatten)]
6275    pub max_slippage: ::core::option::Option<
6276        __buffa::oneof::modify_trigger_request::MaxSlippage,
6277    >,
6278    #[serde(skip)]
6279    #[doc(hidden)]
6280    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6281}
6282impl ::core::fmt::Debug for ModifyTriggerRequest {
6283    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6284        f.debug_struct("ModifyTriggerRequest")
6285            .field("trigger_id", &self.trigger_id)
6286            .field("subaccount_id", &self.subaccount_id)
6287            .field("trigger_price_ticks", &self.trigger_price_ticks)
6288            .field("limit_price_ticks", &self.limit_price_ticks)
6289            .field("activation_price_ticks", &self.activation_price_ticks)
6290            .field("trailing_distance", &self.trailing_distance)
6291            .field("max_slippage", &self.max_slippage)
6292            .finish()
6293    }
6294}
6295impl ModifyTriggerRequest {
6296    /// Protobuf type URL for this message, for use with `Any::pack` and
6297    /// `Any::unpack_if`.
6298    ///
6299    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6300    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
6301}
6302impl ModifyTriggerRequest {
6303    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6304    #[inline]
6305    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
6306    pub fn with_subaccount_id(mut self, value: u64) -> Self {
6307        self.subaccount_id = Some(value);
6308        self
6309    }
6310    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6311    #[inline]
6312    ///Sets [`Self::trigger_price_ticks`] to `Some(value)`, consuming and returning `self`.
6313    pub fn with_trigger_price_ticks(mut self, value: i64) -> Self {
6314        self.trigger_price_ticks = Some(value);
6315        self
6316    }
6317    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6318    #[inline]
6319    ///Sets [`Self::limit_price_ticks`] to `Some(value)`, consuming and returning `self`.
6320    pub fn with_limit_price_ticks(mut self, value: i64) -> Self {
6321        self.limit_price_ticks = Some(value);
6322        self
6323    }
6324    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6325    #[inline]
6326    ///Sets [`Self::activation_price_ticks`] to `Some(value)`, consuming and returning `self`.
6327    pub fn with_activation_price_ticks(mut self, value: i64) -> Self {
6328        self.activation_price_ticks = Some(value);
6329        self
6330    }
6331}
6332::buffa::impl_default_instance!(ModifyTriggerRequest);
6333impl ::buffa::MessageName for ModifyTriggerRequest {
6334    const PACKAGE: &'static str = "triggers.v1";
6335    const NAME: &'static str = "ModifyTriggerRequest";
6336    const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerRequest";
6337    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
6338}
6339impl ::buffa::Message for ModifyTriggerRequest {
6340    /// Returns the total encoded size in bytes.
6341    ///
6342    /// The result is a `u32`; the protobuf specification requires all
6343    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6344    /// compliant message will never overflow this type.
6345    #[allow(clippy::let_and_return)]
6346    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6347        #[allow(unused_imports)]
6348        use ::buffa::Enumeration as _;
6349        let mut size = 0u32;
6350        if self.trigger_id != 0u64 {
6351            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6352        }
6353        if self.subaccount_id.is_some() {
6354            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6355        }
6356        if let Some(v) = self.trigger_price_ticks {
6357            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6358        }
6359        if let Some(v) = self.limit_price_ticks {
6360            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6361        }
6362        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
6363            match v {
6364                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6365                    v,
6366                ) => {
6367                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
6368                }
6369                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6370                    v,
6371                ) => {
6372                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6373                }
6374            }
6375        }
6376        if let Some(v) = self.activation_price_ticks {
6377            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6378        }
6379        if let ::core::option::Option::Some(ref v) = self.max_slippage {
6380            match v {
6381                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6382                    v,
6383                ) => {
6384                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6385                }
6386                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6387                    v,
6388                ) => {
6389                    size += 2u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6390                }
6391            }
6392        }
6393        size += self.__buffa_unknown_fields.encoded_len() as u32;
6394        size
6395    }
6396    fn write_to(
6397        &self,
6398        _cache: &mut ::buffa::SizeCache,
6399        buf: &mut impl ::buffa::bytes::BufMut,
6400    ) {
6401        #[allow(unused_imports)]
6402        use ::buffa::Enumeration as _;
6403        if self.trigger_id != 0u64 {
6404            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6405        }
6406        if let Some(v) = self.subaccount_id {
6407            ::buffa::types::put_fixed64_field(2u32, v, buf);
6408        }
6409        if let Some(v) = self.trigger_price_ticks {
6410            ::buffa::types::put_int64_field(10u32, v, buf);
6411        }
6412        if let Some(v) = self.limit_price_ticks {
6413            ::buffa::types::put_int64_field(11u32, v, buf);
6414        }
6415        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
6416            match v {
6417                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6418                    x,
6419                ) => {
6420                    ::buffa::types::put_int64_field(12u32, *x, buf);
6421                }
6422                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6423                    x,
6424                ) => {
6425                    ::buffa::types::put_int32_field(13u32, *x, buf);
6426                }
6427            }
6428        }
6429        if let Some(v) = self.activation_price_ticks {
6430            ::buffa::types::put_int64_field(14u32, v, buf);
6431        }
6432        if let ::core::option::Option::Some(ref v) = self.max_slippage {
6433            match v {
6434                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6435                    x,
6436                ) => {
6437                    ::buffa::types::put_int32_field(15u32, *x, buf);
6438                }
6439                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6440                    x,
6441                ) => {
6442                    ::buffa::types::put_int32_field(16u32, *x, buf);
6443                }
6444            }
6445        }
6446        self.__buffa_unknown_fields.write_to(buf);
6447    }
6448    fn merge_field(
6449        &mut self,
6450        tag: ::buffa::encoding::Tag,
6451        buf: &mut impl ::buffa::bytes::Buf,
6452        ctx: ::buffa::DecodeContext<'_>,
6453    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6454        #[allow(unused_imports)]
6455        use ::buffa::bytes::Buf as _;
6456        #[allow(unused_imports)]
6457        use ::buffa::Enumeration as _;
6458        match tag.field_number() {
6459            1u32 => {
6460                ::buffa::encoding::check_wire_type(
6461                    tag,
6462                    ::buffa::encoding::WireType::Fixed64,
6463                )?;
6464                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6465            }
6466            2u32 => {
6467                ::buffa::encoding::check_wire_type(
6468                    tag,
6469                    ::buffa::encoding::WireType::Fixed64,
6470                )?;
6471                self.subaccount_id = ::core::option::Option::Some(
6472                    ::buffa::types::decode_fixed64(buf)?,
6473                );
6474            }
6475            10u32 => {
6476                ::buffa::encoding::check_wire_type(
6477                    tag,
6478                    ::buffa::encoding::WireType::Varint,
6479                )?;
6480                self.trigger_price_ticks = ::core::option::Option::Some(
6481                    ::buffa::types::decode_int64(buf)?,
6482                );
6483            }
6484            11u32 => {
6485                ::buffa::encoding::check_wire_type(
6486                    tag,
6487                    ::buffa::encoding::WireType::Varint,
6488                )?;
6489                self.limit_price_ticks = ::core::option::Option::Some(
6490                    ::buffa::types::decode_int64(buf)?,
6491                );
6492            }
6493            12u32 => {
6494                ::buffa::encoding::check_wire_type(
6495                    tag,
6496                    ::buffa::encoding::WireType::Varint,
6497                )?;
6498                self.trailing_distance = ::core::option::Option::Some(
6499                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6500                        ::buffa::types::decode_int64(buf)?,
6501                    ),
6502                );
6503            }
6504            13u32 => {
6505                ::buffa::encoding::check_wire_type(
6506                    tag,
6507                    ::buffa::encoding::WireType::Varint,
6508                )?;
6509                self.trailing_distance = ::core::option::Option::Some(
6510                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6511                        ::buffa::types::decode_int32(buf)?,
6512                    ),
6513                );
6514            }
6515            14u32 => {
6516                ::buffa::encoding::check_wire_type(
6517                    tag,
6518                    ::buffa::encoding::WireType::Varint,
6519                )?;
6520                self.activation_price_ticks = ::core::option::Option::Some(
6521                    ::buffa::types::decode_int64(buf)?,
6522                );
6523            }
6524            15u32 => {
6525                ::buffa::encoding::check_wire_type(
6526                    tag,
6527                    ::buffa::encoding::WireType::Varint,
6528                )?;
6529                self.max_slippage = ::core::option::Option::Some(
6530                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6531                        ::buffa::types::decode_int32(buf)?,
6532                    ),
6533                );
6534            }
6535            16u32 => {
6536                ::buffa::encoding::check_wire_type(
6537                    tag,
6538                    ::buffa::encoding::WireType::Varint,
6539                )?;
6540                self.max_slippage = ::core::option::Option::Some(
6541                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6542                        ::buffa::types::decode_int32(buf)?,
6543                    ),
6544                );
6545            }
6546            _ => {
6547                self.__buffa_unknown_fields
6548                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6549            }
6550        }
6551        ::core::result::Result::Ok(())
6552    }
6553    fn clear(&mut self) {
6554        self.trigger_id = 0u64;
6555        self.subaccount_id = ::core::option::Option::None;
6556        self.trigger_price_ticks = ::core::option::Option::None;
6557        self.limit_price_ticks = ::core::option::Option::None;
6558        self.trailing_distance = ::core::option::Option::None;
6559        self.activation_price_ticks = ::core::option::Option::None;
6560        self.max_slippage = ::core::option::Option::None;
6561        self.__buffa_unknown_fields.clear();
6562    }
6563}
6564impl ::buffa::ExtensionSet for ModifyTriggerRequest {
6565    const PROTO_FQN: &'static str = "triggers.v1.ModifyTriggerRequest";
6566    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6567        &self.__buffa_unknown_fields
6568    }
6569    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6570        &mut self.__buffa_unknown_fields
6571    }
6572}
6573impl<'de> serde::Deserialize<'de> for ModifyTriggerRequest {
6574    fn deserialize<D: serde::Deserializer<'de>>(
6575        d: D,
6576    ) -> ::core::result::Result<Self, D::Error> {
6577        struct _V;
6578        impl<'de> serde::de::Visitor<'de> for _V {
6579            type Value = ModifyTriggerRequest;
6580            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
6581                f.write_str("struct ModifyTriggerRequest")
6582            }
6583            #[allow(clippy::field_reassign_with_default)]
6584            fn visit_map<A: serde::de::MapAccess<'de>>(
6585                self,
6586                mut map: A,
6587            ) -> ::core::result::Result<ModifyTriggerRequest, A::Error> {
6588                let mut __f_trigger_id: ::core::option::Option<u64> = None;
6589                let mut __f_subaccount_id: ::core::option::Option<
6590                    ::core::option::Option<u64>,
6591                > = None;
6592                let mut __f_trigger_price_ticks: ::core::option::Option<
6593                    ::core::option::Option<i64>,
6594                > = None;
6595                let mut __f_limit_price_ticks: ::core::option::Option<
6596                    ::core::option::Option<i64>,
6597                > = None;
6598                let mut __f_activation_price_ticks: ::core::option::Option<
6599                    ::core::option::Option<i64>,
6600                > = None;
6601                let mut __oneof_trailing_distance: ::core::option::Option<
6602                    __buffa::oneof::modify_trigger_request::TrailingDistance,
6603                > = None;
6604                let mut __oneof_max_slippage: ::core::option::Option<
6605                    __buffa::oneof::modify_trigger_request::MaxSlippage,
6606                > = None;
6607                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
6608                    match key.as_str() {
6609                        "triggerId" | "trigger_id" => {
6610                            __f_trigger_id = Some({
6611                                struct _S;
6612                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6613                                    type Value = u64;
6614                                    fn deserialize<D: serde::Deserializer<'de>>(
6615                                        self,
6616                                        d: D,
6617                                    ) -> ::core::result::Result<u64, D::Error> {
6618                                        ::buffa::json_helpers::uint64::deserialize(d)
6619                                    }
6620                                }
6621                                map.next_value_seed(_S)?
6622                            });
6623                        }
6624                        "subaccountId" | "subaccount_id" => {
6625                            __f_subaccount_id = Some({
6626                                struct _S;
6627                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6628                                    type Value = ::core::option::Option<u64>;
6629                                    fn deserialize<D: serde::Deserializer<'de>>(
6630                                        self,
6631                                        d: D,
6632                                    ) -> ::core::result::Result<
6633                                        ::core::option::Option<u64>,
6634                                        D::Error,
6635                                    > {
6636                                        ::buffa::json_helpers::opt_uint64::deserialize(d)
6637                                    }
6638                                }
6639                                map.next_value_seed(_S)?
6640                            });
6641                        }
6642                        "triggerPriceTicks" | "trigger_price_ticks" => {
6643                            __f_trigger_price_ticks = Some({
6644                                struct _S;
6645                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6646                                    type Value = ::core::option::Option<i64>;
6647                                    fn deserialize<D: serde::Deserializer<'de>>(
6648                                        self,
6649                                        d: D,
6650                                    ) -> ::core::result::Result<
6651                                        ::core::option::Option<i64>,
6652                                        D::Error,
6653                                    > {
6654                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6655                                    }
6656                                }
6657                                map.next_value_seed(_S)?
6658                            });
6659                        }
6660                        "limitPriceTicks" | "limit_price_ticks" => {
6661                            __f_limit_price_ticks = Some({
6662                                struct _S;
6663                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6664                                    type Value = ::core::option::Option<i64>;
6665                                    fn deserialize<D: serde::Deserializer<'de>>(
6666                                        self,
6667                                        d: D,
6668                                    ) -> ::core::result::Result<
6669                                        ::core::option::Option<i64>,
6670                                        D::Error,
6671                                    > {
6672                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6673                                    }
6674                                }
6675                                map.next_value_seed(_S)?
6676                            });
6677                        }
6678                        "activationPriceTicks" | "activation_price_ticks" => {
6679                            __f_activation_price_ticks = Some({
6680                                struct _S;
6681                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6682                                    type Value = ::core::option::Option<i64>;
6683                                    fn deserialize<D: serde::Deserializer<'de>>(
6684                                        self,
6685                                        d: D,
6686                                    ) -> ::core::result::Result<
6687                                        ::core::option::Option<i64>,
6688                                        D::Error,
6689                                    > {
6690                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6691                                    }
6692                                }
6693                                map.next_value_seed(_S)?
6694                            });
6695                        }
6696                        "trailingDistanceTicks" | "trailing_distance_ticks" => {
6697                            struct _DeserSeed;
6698                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6699                                type Value = i64;
6700                                fn deserialize<D: serde::Deserializer<'de>>(
6701                                    self,
6702                                    d: D,
6703                                ) -> ::core::result::Result<i64, D::Error> {
6704                                    ::buffa::json_helpers::int64::deserialize(d)
6705                                }
6706                            }
6707                            let v: ::core::option::Option<i64> = map
6708                                .next_value_seed(
6709                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6710                                )?;
6711                            if let Some(v) = v {
6712                                if __oneof_trailing_distance.is_some() {
6713                                    return Err(
6714                                        serde::de::Error::custom(
6715                                            "multiple oneof fields set for 'trailing_distance'",
6716                                        ),
6717                                    );
6718                                }
6719                                __oneof_trailing_distance = Some(
6720                                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6721                                        v,
6722                                    ),
6723                                );
6724                            }
6725                        }
6726                        "trailingDistanceBps" | "trailing_distance_bps" => {
6727                            struct _DeserSeed;
6728                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6729                                type Value = i32;
6730                                fn deserialize<D: serde::Deserializer<'de>>(
6731                                    self,
6732                                    d: D,
6733                                ) -> ::core::result::Result<i32, D::Error> {
6734                                    ::buffa::json_helpers::int32::deserialize(d)
6735                                }
6736                            }
6737                            let v: ::core::option::Option<i32> = map
6738                                .next_value_seed(
6739                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6740                                )?;
6741                            if let Some(v) = v {
6742                                if __oneof_trailing_distance.is_some() {
6743                                    return Err(
6744                                        serde::de::Error::custom(
6745                                            "multiple oneof fields set for 'trailing_distance'",
6746                                        ),
6747                                    );
6748                                }
6749                                __oneof_trailing_distance = Some(
6750                                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6751                                        v,
6752                                    ),
6753                                );
6754                            }
6755                        }
6756                        "maxSlippageTicks" | "max_slippage_ticks" => {
6757                            struct _DeserSeed;
6758                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6759                                type Value = i32;
6760                                fn deserialize<D: serde::Deserializer<'de>>(
6761                                    self,
6762                                    d: D,
6763                                ) -> ::core::result::Result<i32, D::Error> {
6764                                    ::buffa::json_helpers::int32::deserialize(d)
6765                                }
6766                            }
6767                            let v: ::core::option::Option<i32> = map
6768                                .next_value_seed(
6769                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6770                                )?;
6771                            if let Some(v) = v {
6772                                if __oneof_max_slippage.is_some() {
6773                                    return Err(
6774                                        serde::de::Error::custom(
6775                                            "multiple oneof fields set for 'max_slippage'",
6776                                        ),
6777                                    );
6778                                }
6779                                __oneof_max_slippage = Some(
6780                                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6781                                        v,
6782                                    ),
6783                                );
6784                            }
6785                        }
6786                        "maxSlippageBps" | "max_slippage_bps" => {
6787                            struct _DeserSeed;
6788                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6789                                type Value = i32;
6790                                fn deserialize<D: serde::Deserializer<'de>>(
6791                                    self,
6792                                    d: D,
6793                                ) -> ::core::result::Result<i32, D::Error> {
6794                                    ::buffa::json_helpers::int32::deserialize(d)
6795                                }
6796                            }
6797                            let v: ::core::option::Option<i32> = map
6798                                .next_value_seed(
6799                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6800                                )?;
6801                            if let Some(v) = v {
6802                                if __oneof_max_slippage.is_some() {
6803                                    return Err(
6804                                        serde::de::Error::custom(
6805                                            "multiple oneof fields set for 'max_slippage'",
6806                                        ),
6807                                    );
6808                                }
6809                                __oneof_max_slippage = Some(
6810                                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6811                                        v,
6812                                    ),
6813                                );
6814                            }
6815                        }
6816                        _ => {
6817                            map.next_value::<serde::de::IgnoredAny>()?;
6818                        }
6819                    }
6820                }
6821                let mut __r = <ModifyTriggerRequest as ::core::default::Default>::default();
6822                if let ::core::option::Option::Some(v) = __f_trigger_id {
6823                    __r.trigger_id = v;
6824                }
6825                if let ::core::option::Option::Some(v) = __f_subaccount_id {
6826                    __r.subaccount_id = v;
6827                }
6828                if let ::core::option::Option::Some(v) = __f_trigger_price_ticks {
6829                    __r.trigger_price_ticks = v;
6830                }
6831                if let ::core::option::Option::Some(v) = __f_limit_price_ticks {
6832                    __r.limit_price_ticks = v;
6833                }
6834                if let ::core::option::Option::Some(v) = __f_activation_price_ticks {
6835                    __r.activation_price_ticks = v;
6836                }
6837                __r.trailing_distance = __oneof_trailing_distance;
6838                __r.max_slippage = __oneof_max_slippage;
6839                Ok(__r)
6840            }
6841        }
6842        d.deserialize_map(_V)
6843    }
6844}
6845impl ::buffa::json_helpers::ProtoElemJson for ModifyTriggerRequest {
6846    fn serialize_proto_json<S: ::serde::Serializer>(
6847        v: &Self,
6848        s: S,
6849    ) -> ::core::result::Result<S::Ok, S::Error> {
6850        ::serde::Serialize::serialize(v, s)
6851    }
6852    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6853        d: D,
6854    ) -> ::core::result::Result<Self, D::Error> {
6855        <Self as ::serde::Deserialize>::deserialize(d)
6856    }
6857}
6858#[doc(hidden)]
6859pub const __MODIFY_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6860    type_url: "type.googleapis.com/triggers.v1.ModifyTriggerRequest",
6861    to_json: ::buffa::type_registry::any_to_json::<ModifyTriggerRequest>,
6862    from_json: ::buffa::type_registry::any_from_json::<ModifyTriggerRequest>,
6863    is_wkt: false,
6864};
6865pub mod modify_trigger_request {
6866    #[allow(unused_imports)]
6867    use super::*;
6868    #[doc(inline)]
6869    pub use super::__buffa::oneof::modify_trigger_request::TrailingDistance;
6870    #[doc(inline)]
6871    pub use super::__buffa::oneof::modify_trigger_request::MaxSlippage;
6872    #[doc(inline)]
6873    pub use super::__buffa::view::oneof::modify_trigger_request::TrailingDistance as TrailingDistanceView;
6874    #[doc(inline)]
6875    pub use super::__buffa::view::oneof::modify_trigger_request::MaxSlippage as MaxSlippageView;
6876}
6877/// ModifyTriggerResponse returns the trigger status after modification.
6878#[derive(Clone, PartialEq, Default)]
6879#[derive(::serde::Serialize, ::serde::Deserialize)]
6880#[serde(default)]
6881pub struct ModifyTriggerResponse {
6882    /// Modified trigger ID.
6883    ///
6884    /// Field 1: `trigger_id`
6885    #[serde(
6886        rename = "triggerId",
6887        alias = "trigger_id",
6888        with = "::buffa::json_helpers::uint64",
6889        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6890    )]
6891    pub trigger_id: u64,
6892    /// Current trigger status after modification.
6893    ///
6894    /// Field 2: `status`
6895    #[serde(
6896        rename = "status",
6897        with = "::buffa::json_helpers::proto_enum",
6898        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6899    )]
6900    pub status: ::buffa::EnumValue<TriggerStatus>,
6901    /// Server timestamp.
6902    ///
6903    /// Field 3: `ts`
6904    #[serde(
6905        rename = "ts",
6906        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6907    )]
6908    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
6909    /// Server timestamp in nanoseconds since epoch (UTC).
6910    ///
6911    /// Field 4: `ts_ns`
6912    #[serde(
6913        rename = "tsNs",
6914        alias = "ts_ns",
6915        with = "::buffa::json_helpers::uint64",
6916        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6917    )]
6918    pub ts_ns: u64,
6919    #[serde(skip)]
6920    #[doc(hidden)]
6921    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6922}
6923impl ::core::fmt::Debug for ModifyTriggerResponse {
6924    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6925        f.debug_struct("ModifyTriggerResponse")
6926            .field("trigger_id", &self.trigger_id)
6927            .field("status", &self.status)
6928            .field("ts", &self.ts)
6929            .field("ts_ns", &self.ts_ns)
6930            .finish()
6931    }
6932}
6933impl ModifyTriggerResponse {
6934    /// Protobuf type URL for this message, for use with `Any::pack` and
6935    /// `Any::unpack_if`.
6936    ///
6937    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6938    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
6939}
6940::buffa::impl_default_instance!(ModifyTriggerResponse);
6941impl ::buffa::MessageName for ModifyTriggerResponse {
6942    const PACKAGE: &'static str = "triggers.v1";
6943    const NAME: &'static str = "ModifyTriggerResponse";
6944    const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerResponse";
6945    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
6946}
6947impl ::buffa::Message for ModifyTriggerResponse {
6948    /// Returns the total encoded size in bytes.
6949    ///
6950    /// The result is a `u32`; the protobuf specification requires all
6951    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6952    /// compliant message will never overflow this type.
6953    #[allow(clippy::let_and_return)]
6954    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6955        #[allow(unused_imports)]
6956        use ::buffa::Enumeration as _;
6957        let mut size = 0u32;
6958        if self.trigger_id != 0u64 {
6959            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6960        }
6961        {
6962            let val = self.status.to_i32();
6963            if val != 0 {
6964                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
6965            }
6966        }
6967        if self.ts.is_set() {
6968            let __slot = __cache.reserve();
6969            let inner_size = self.ts.compute_size(__cache);
6970            __cache.set(__slot, inner_size);
6971            size
6972                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6973                    + inner_size;
6974        }
6975        if self.ts_ns != 0u64 {
6976            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
6977        }
6978        size += self.__buffa_unknown_fields.encoded_len() as u32;
6979        size
6980    }
6981    fn write_to(
6982        &self,
6983        __cache: &mut ::buffa::SizeCache,
6984        buf: &mut impl ::buffa::bytes::BufMut,
6985    ) {
6986        #[allow(unused_imports)]
6987        use ::buffa::Enumeration as _;
6988        if self.trigger_id != 0u64 {
6989            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6990        }
6991        {
6992            let val = self.status.to_i32();
6993            if val != 0 {
6994                ::buffa::types::put_int32_field(2u32, val, buf);
6995            }
6996        }
6997        if self.ts.is_set() {
6998            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
6999            self.ts.write_to(__cache, buf);
7000        }
7001        if self.ts_ns != 0u64 {
7002            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7003        }
7004        self.__buffa_unknown_fields.write_to(buf);
7005    }
7006    fn merge_field(
7007        &mut self,
7008        tag: ::buffa::encoding::Tag,
7009        buf: &mut impl ::buffa::bytes::Buf,
7010        ctx: ::buffa::DecodeContext<'_>,
7011    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7012        #[allow(unused_imports)]
7013        use ::buffa::bytes::Buf as _;
7014        #[allow(unused_imports)]
7015        use ::buffa::Enumeration as _;
7016        match tag.field_number() {
7017            1u32 => {
7018                ::buffa::encoding::check_wire_type(
7019                    tag,
7020                    ::buffa::encoding::WireType::Fixed64,
7021                )?;
7022                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7023            }
7024            2u32 => {
7025                ::buffa::encoding::check_wire_type(
7026                    tag,
7027                    ::buffa::encoding::WireType::Varint,
7028                )?;
7029                self.status = ::buffa::EnumValue::from(
7030                    ::buffa::types::decode_int32(buf)?,
7031                );
7032            }
7033            3u32 => {
7034                ::buffa::encoding::check_wire_type(
7035                    tag,
7036                    ::buffa::encoding::WireType::LengthDelimited,
7037                )?;
7038                ::buffa::Message::merge_length_delimited(
7039                    self.ts.get_or_insert_default(),
7040                    buf,
7041                    ctx,
7042                )?;
7043            }
7044            4u32 => {
7045                ::buffa::encoding::check_wire_type(
7046                    tag,
7047                    ::buffa::encoding::WireType::Varint,
7048                )?;
7049                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7050            }
7051            _ => {
7052                self.__buffa_unknown_fields
7053                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7054            }
7055        }
7056        ::core::result::Result::Ok(())
7057    }
7058    fn clear(&mut self) {
7059        self.trigger_id = 0u64;
7060        self.status = ::buffa::EnumValue::from(0);
7061        self.ts = ::buffa::MessageField::none();
7062        self.ts_ns = 0u64;
7063        self.__buffa_unknown_fields.clear();
7064    }
7065}
7066impl ::buffa::ExtensionSet for ModifyTriggerResponse {
7067    const PROTO_FQN: &'static str = "triggers.v1.ModifyTriggerResponse";
7068    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7069        &self.__buffa_unknown_fields
7070    }
7071    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7072        &mut self.__buffa_unknown_fields
7073    }
7074}
7075impl ::buffa::json_helpers::ProtoElemJson for ModifyTriggerResponse {
7076    fn serialize_proto_json<S: ::serde::Serializer>(
7077        v: &Self,
7078        s: S,
7079    ) -> ::core::result::Result<S::Ok, S::Error> {
7080        ::serde::Serialize::serialize(v, s)
7081    }
7082    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7083        d: D,
7084    ) -> ::core::result::Result<Self, D::Error> {
7085        <Self as ::serde::Deserialize>::deserialize(d)
7086    }
7087}
7088#[doc(hidden)]
7089pub const __MODIFY_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7090    type_url: "type.googleapis.com/triggers.v1.ModifyTriggerResponse",
7091    to_json: ::buffa::type_registry::any_to_json::<ModifyTriggerResponse>,
7092    from_json: ::buffa::type_registry::any_from_json::<ModifyTriggerResponse>,
7093    is_wkt: false,
7094};
7095/// PauseTriggerRequest pauses an active trigger by ID.
7096#[derive(Clone, PartialEq, Default)]
7097#[derive(::serde::Serialize, ::serde::Deserialize)]
7098#[serde(default)]
7099pub struct PauseTriggerRequest {
7100    /// Trigger ID to pause.
7101    ///
7102    /// Field 1: `trigger_id`
7103    #[serde(
7104        rename = "triggerId",
7105        alias = "trigger_id",
7106        with = "::buffa::json_helpers::uint64",
7107        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7108    )]
7109    pub trigger_id: u64,
7110    /// Optional sub-account for authorization.
7111    ///
7112    /// Field 2: `subaccount_id`
7113    #[serde(
7114        rename = "subaccountId",
7115        alias = "subaccount_id",
7116        with = "::buffa::json_helpers::opt_uint64",
7117        skip_serializing_if = "::core::option::Option::is_none"
7118    )]
7119    pub subaccount_id: ::core::option::Option<u64>,
7120    #[serde(skip)]
7121    #[doc(hidden)]
7122    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7123}
7124impl ::core::fmt::Debug for PauseTriggerRequest {
7125    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7126        f.debug_struct("PauseTriggerRequest")
7127            .field("trigger_id", &self.trigger_id)
7128            .field("subaccount_id", &self.subaccount_id)
7129            .finish()
7130    }
7131}
7132impl PauseTriggerRequest {
7133    /// Protobuf type URL for this message, for use with `Any::pack` and
7134    /// `Any::unpack_if`.
7135    ///
7136    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7137    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
7138}
7139impl PauseTriggerRequest {
7140    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7141    #[inline]
7142    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
7143    pub fn with_subaccount_id(mut self, value: u64) -> Self {
7144        self.subaccount_id = Some(value);
7145        self
7146    }
7147}
7148::buffa::impl_default_instance!(PauseTriggerRequest);
7149impl ::buffa::MessageName for PauseTriggerRequest {
7150    const PACKAGE: &'static str = "triggers.v1";
7151    const NAME: &'static str = "PauseTriggerRequest";
7152    const FULL_NAME: &'static str = "triggers.v1.PauseTriggerRequest";
7153    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
7154}
7155impl ::buffa::Message for PauseTriggerRequest {
7156    /// Returns the total encoded size in bytes.
7157    ///
7158    /// The result is a `u32`; the protobuf specification requires all
7159    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7160    /// compliant message will never overflow this type.
7161    #[allow(clippy::let_and_return)]
7162    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7163        #[allow(unused_imports)]
7164        use ::buffa::Enumeration as _;
7165        let mut size = 0u32;
7166        if self.trigger_id != 0u64 {
7167            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7168        }
7169        if self.subaccount_id.is_some() {
7170            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7171        }
7172        size += self.__buffa_unknown_fields.encoded_len() as u32;
7173        size
7174    }
7175    fn write_to(
7176        &self,
7177        _cache: &mut ::buffa::SizeCache,
7178        buf: &mut impl ::buffa::bytes::BufMut,
7179    ) {
7180        #[allow(unused_imports)]
7181        use ::buffa::Enumeration as _;
7182        if self.trigger_id != 0u64 {
7183            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7184        }
7185        if let Some(v) = self.subaccount_id {
7186            ::buffa::types::put_fixed64_field(2u32, v, buf);
7187        }
7188        self.__buffa_unknown_fields.write_to(buf);
7189    }
7190    fn merge_field(
7191        &mut self,
7192        tag: ::buffa::encoding::Tag,
7193        buf: &mut impl ::buffa::bytes::Buf,
7194        ctx: ::buffa::DecodeContext<'_>,
7195    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7196        #[allow(unused_imports)]
7197        use ::buffa::bytes::Buf as _;
7198        #[allow(unused_imports)]
7199        use ::buffa::Enumeration as _;
7200        match tag.field_number() {
7201            1u32 => {
7202                ::buffa::encoding::check_wire_type(
7203                    tag,
7204                    ::buffa::encoding::WireType::Fixed64,
7205                )?;
7206                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7207            }
7208            2u32 => {
7209                ::buffa::encoding::check_wire_type(
7210                    tag,
7211                    ::buffa::encoding::WireType::Fixed64,
7212                )?;
7213                self.subaccount_id = ::core::option::Option::Some(
7214                    ::buffa::types::decode_fixed64(buf)?,
7215                );
7216            }
7217            _ => {
7218                self.__buffa_unknown_fields
7219                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7220            }
7221        }
7222        ::core::result::Result::Ok(())
7223    }
7224    fn clear(&mut self) {
7225        self.trigger_id = 0u64;
7226        self.subaccount_id = ::core::option::Option::None;
7227        self.__buffa_unknown_fields.clear();
7228    }
7229}
7230impl ::buffa::ExtensionSet for PauseTriggerRequest {
7231    const PROTO_FQN: &'static str = "triggers.v1.PauseTriggerRequest";
7232    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7233        &self.__buffa_unknown_fields
7234    }
7235    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7236        &mut self.__buffa_unknown_fields
7237    }
7238}
7239impl ::buffa::json_helpers::ProtoElemJson for PauseTriggerRequest {
7240    fn serialize_proto_json<S: ::serde::Serializer>(
7241        v: &Self,
7242        s: S,
7243    ) -> ::core::result::Result<S::Ok, S::Error> {
7244        ::serde::Serialize::serialize(v, s)
7245    }
7246    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7247        d: D,
7248    ) -> ::core::result::Result<Self, D::Error> {
7249        <Self as ::serde::Deserialize>::deserialize(d)
7250    }
7251}
7252#[doc(hidden)]
7253pub const __PAUSE_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7254    type_url: "type.googleapis.com/triggers.v1.PauseTriggerRequest",
7255    to_json: ::buffa::type_registry::any_to_json::<PauseTriggerRequest>,
7256    from_json: ::buffa::type_registry::any_from_json::<PauseTriggerRequest>,
7257    is_wkt: false,
7258};
7259/// PauseTriggerResponse returns the trigger status after pausing.
7260#[derive(Clone, PartialEq, Default)]
7261#[derive(::serde::Serialize, ::serde::Deserialize)]
7262#[serde(default)]
7263pub struct PauseTriggerResponse {
7264    /// Paused trigger ID.
7265    ///
7266    /// Field 1: `trigger_id`
7267    #[serde(
7268        rename = "triggerId",
7269        alias = "trigger_id",
7270        with = "::buffa::json_helpers::uint64",
7271        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7272    )]
7273    pub trigger_id: u64,
7274    /// Current trigger status after pausing.
7275    ///
7276    /// Field 2: `status`
7277    #[serde(
7278        rename = "status",
7279        with = "::buffa::json_helpers::proto_enum",
7280        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7281    )]
7282    pub status: ::buffa::EnumValue<TriggerStatus>,
7283    /// Server timestamp.
7284    ///
7285    /// Field 3: `ts`
7286    #[serde(
7287        rename = "ts",
7288        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7289    )]
7290    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7291    /// Server timestamp in nanoseconds since epoch (UTC).
7292    ///
7293    /// Field 4: `ts_ns`
7294    #[serde(
7295        rename = "tsNs",
7296        alias = "ts_ns",
7297        with = "::buffa::json_helpers::uint64",
7298        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7299    )]
7300    pub ts_ns: u64,
7301    #[serde(skip)]
7302    #[doc(hidden)]
7303    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7304}
7305impl ::core::fmt::Debug for PauseTriggerResponse {
7306    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7307        f.debug_struct("PauseTriggerResponse")
7308            .field("trigger_id", &self.trigger_id)
7309            .field("status", &self.status)
7310            .field("ts", &self.ts)
7311            .field("ts_ns", &self.ts_ns)
7312            .finish()
7313    }
7314}
7315impl PauseTriggerResponse {
7316    /// Protobuf type URL for this message, for use with `Any::pack` and
7317    /// `Any::unpack_if`.
7318    ///
7319    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7320    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
7321}
7322::buffa::impl_default_instance!(PauseTriggerResponse);
7323impl ::buffa::MessageName for PauseTriggerResponse {
7324    const PACKAGE: &'static str = "triggers.v1";
7325    const NAME: &'static str = "PauseTriggerResponse";
7326    const FULL_NAME: &'static str = "triggers.v1.PauseTriggerResponse";
7327    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
7328}
7329impl ::buffa::Message for PauseTriggerResponse {
7330    /// Returns the total encoded size in bytes.
7331    ///
7332    /// The result is a `u32`; the protobuf specification requires all
7333    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7334    /// compliant message will never overflow this type.
7335    #[allow(clippy::let_and_return)]
7336    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7337        #[allow(unused_imports)]
7338        use ::buffa::Enumeration as _;
7339        let mut size = 0u32;
7340        if self.trigger_id != 0u64 {
7341            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7342        }
7343        {
7344            let val = self.status.to_i32();
7345            if val != 0 {
7346                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7347            }
7348        }
7349        if self.ts.is_set() {
7350            let __slot = __cache.reserve();
7351            let inner_size = self.ts.compute_size(__cache);
7352            __cache.set(__slot, inner_size);
7353            size
7354                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7355                    + inner_size;
7356        }
7357        if self.ts_ns != 0u64 {
7358            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7359        }
7360        size += self.__buffa_unknown_fields.encoded_len() as u32;
7361        size
7362    }
7363    fn write_to(
7364        &self,
7365        __cache: &mut ::buffa::SizeCache,
7366        buf: &mut impl ::buffa::bytes::BufMut,
7367    ) {
7368        #[allow(unused_imports)]
7369        use ::buffa::Enumeration as _;
7370        if self.trigger_id != 0u64 {
7371            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7372        }
7373        {
7374            let val = self.status.to_i32();
7375            if val != 0 {
7376                ::buffa::types::put_int32_field(2u32, val, buf);
7377            }
7378        }
7379        if self.ts.is_set() {
7380            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7381            self.ts.write_to(__cache, buf);
7382        }
7383        if self.ts_ns != 0u64 {
7384            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7385        }
7386        self.__buffa_unknown_fields.write_to(buf);
7387    }
7388    fn merge_field(
7389        &mut self,
7390        tag: ::buffa::encoding::Tag,
7391        buf: &mut impl ::buffa::bytes::Buf,
7392        ctx: ::buffa::DecodeContext<'_>,
7393    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7394        #[allow(unused_imports)]
7395        use ::buffa::bytes::Buf as _;
7396        #[allow(unused_imports)]
7397        use ::buffa::Enumeration as _;
7398        match tag.field_number() {
7399            1u32 => {
7400                ::buffa::encoding::check_wire_type(
7401                    tag,
7402                    ::buffa::encoding::WireType::Fixed64,
7403                )?;
7404                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7405            }
7406            2u32 => {
7407                ::buffa::encoding::check_wire_type(
7408                    tag,
7409                    ::buffa::encoding::WireType::Varint,
7410                )?;
7411                self.status = ::buffa::EnumValue::from(
7412                    ::buffa::types::decode_int32(buf)?,
7413                );
7414            }
7415            3u32 => {
7416                ::buffa::encoding::check_wire_type(
7417                    tag,
7418                    ::buffa::encoding::WireType::LengthDelimited,
7419                )?;
7420                ::buffa::Message::merge_length_delimited(
7421                    self.ts.get_or_insert_default(),
7422                    buf,
7423                    ctx,
7424                )?;
7425            }
7426            4u32 => {
7427                ::buffa::encoding::check_wire_type(
7428                    tag,
7429                    ::buffa::encoding::WireType::Varint,
7430                )?;
7431                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7432            }
7433            _ => {
7434                self.__buffa_unknown_fields
7435                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7436            }
7437        }
7438        ::core::result::Result::Ok(())
7439    }
7440    fn clear(&mut self) {
7441        self.trigger_id = 0u64;
7442        self.status = ::buffa::EnumValue::from(0);
7443        self.ts = ::buffa::MessageField::none();
7444        self.ts_ns = 0u64;
7445        self.__buffa_unknown_fields.clear();
7446    }
7447}
7448impl ::buffa::ExtensionSet for PauseTriggerResponse {
7449    const PROTO_FQN: &'static str = "triggers.v1.PauseTriggerResponse";
7450    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7451        &self.__buffa_unknown_fields
7452    }
7453    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7454        &mut self.__buffa_unknown_fields
7455    }
7456}
7457impl ::buffa::json_helpers::ProtoElemJson for PauseTriggerResponse {
7458    fn serialize_proto_json<S: ::serde::Serializer>(
7459        v: &Self,
7460        s: S,
7461    ) -> ::core::result::Result<S::Ok, S::Error> {
7462        ::serde::Serialize::serialize(v, s)
7463    }
7464    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7465        d: D,
7466    ) -> ::core::result::Result<Self, D::Error> {
7467        <Self as ::serde::Deserialize>::deserialize(d)
7468    }
7469}
7470#[doc(hidden)]
7471pub const __PAUSE_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7472    type_url: "type.googleapis.com/triggers.v1.PauseTriggerResponse",
7473    to_json: ::buffa::type_registry::any_to_json::<PauseTriggerResponse>,
7474    from_json: ::buffa::type_registry::any_from_json::<PauseTriggerResponse>,
7475    is_wkt: false,
7476};
7477/// ResumeTriggerRequest resumes a paused trigger by ID.
7478#[derive(Clone, PartialEq, Default)]
7479#[derive(::serde::Serialize, ::serde::Deserialize)]
7480#[serde(default)]
7481pub struct ResumeTriggerRequest {
7482    /// Trigger ID to resume.
7483    ///
7484    /// Field 1: `trigger_id`
7485    #[serde(
7486        rename = "triggerId",
7487        alias = "trigger_id",
7488        with = "::buffa::json_helpers::uint64",
7489        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7490    )]
7491    pub trigger_id: u64,
7492    /// Optional sub-account for authorization.
7493    ///
7494    /// Field 2: `subaccount_id`
7495    #[serde(
7496        rename = "subaccountId",
7497        alias = "subaccount_id",
7498        with = "::buffa::json_helpers::opt_uint64",
7499        skip_serializing_if = "::core::option::Option::is_none"
7500    )]
7501    pub subaccount_id: ::core::option::Option<u64>,
7502    #[serde(skip)]
7503    #[doc(hidden)]
7504    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7505}
7506impl ::core::fmt::Debug for ResumeTriggerRequest {
7507    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7508        f.debug_struct("ResumeTriggerRequest")
7509            .field("trigger_id", &self.trigger_id)
7510            .field("subaccount_id", &self.subaccount_id)
7511            .finish()
7512    }
7513}
7514impl ResumeTriggerRequest {
7515    /// Protobuf type URL for this message, for use with `Any::pack` and
7516    /// `Any::unpack_if`.
7517    ///
7518    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7519    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
7520}
7521impl ResumeTriggerRequest {
7522    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7523    #[inline]
7524    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
7525    pub fn with_subaccount_id(mut self, value: u64) -> Self {
7526        self.subaccount_id = Some(value);
7527        self
7528    }
7529}
7530::buffa::impl_default_instance!(ResumeTriggerRequest);
7531impl ::buffa::MessageName for ResumeTriggerRequest {
7532    const PACKAGE: &'static str = "triggers.v1";
7533    const NAME: &'static str = "ResumeTriggerRequest";
7534    const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerRequest";
7535    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
7536}
7537impl ::buffa::Message for ResumeTriggerRequest {
7538    /// Returns the total encoded size in bytes.
7539    ///
7540    /// The result is a `u32`; the protobuf specification requires all
7541    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7542    /// compliant message will never overflow this type.
7543    #[allow(clippy::let_and_return)]
7544    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7545        #[allow(unused_imports)]
7546        use ::buffa::Enumeration as _;
7547        let mut size = 0u32;
7548        if self.trigger_id != 0u64 {
7549            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7550        }
7551        if self.subaccount_id.is_some() {
7552            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7553        }
7554        size += self.__buffa_unknown_fields.encoded_len() as u32;
7555        size
7556    }
7557    fn write_to(
7558        &self,
7559        _cache: &mut ::buffa::SizeCache,
7560        buf: &mut impl ::buffa::bytes::BufMut,
7561    ) {
7562        #[allow(unused_imports)]
7563        use ::buffa::Enumeration as _;
7564        if self.trigger_id != 0u64 {
7565            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7566        }
7567        if let Some(v) = self.subaccount_id {
7568            ::buffa::types::put_fixed64_field(2u32, v, buf);
7569        }
7570        self.__buffa_unknown_fields.write_to(buf);
7571    }
7572    fn merge_field(
7573        &mut self,
7574        tag: ::buffa::encoding::Tag,
7575        buf: &mut impl ::buffa::bytes::Buf,
7576        ctx: ::buffa::DecodeContext<'_>,
7577    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7578        #[allow(unused_imports)]
7579        use ::buffa::bytes::Buf as _;
7580        #[allow(unused_imports)]
7581        use ::buffa::Enumeration as _;
7582        match tag.field_number() {
7583            1u32 => {
7584                ::buffa::encoding::check_wire_type(
7585                    tag,
7586                    ::buffa::encoding::WireType::Fixed64,
7587                )?;
7588                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7589            }
7590            2u32 => {
7591                ::buffa::encoding::check_wire_type(
7592                    tag,
7593                    ::buffa::encoding::WireType::Fixed64,
7594                )?;
7595                self.subaccount_id = ::core::option::Option::Some(
7596                    ::buffa::types::decode_fixed64(buf)?,
7597                );
7598            }
7599            _ => {
7600                self.__buffa_unknown_fields
7601                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7602            }
7603        }
7604        ::core::result::Result::Ok(())
7605    }
7606    fn clear(&mut self) {
7607        self.trigger_id = 0u64;
7608        self.subaccount_id = ::core::option::Option::None;
7609        self.__buffa_unknown_fields.clear();
7610    }
7611}
7612impl ::buffa::ExtensionSet for ResumeTriggerRequest {
7613    const PROTO_FQN: &'static str = "triggers.v1.ResumeTriggerRequest";
7614    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7615        &self.__buffa_unknown_fields
7616    }
7617    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7618        &mut self.__buffa_unknown_fields
7619    }
7620}
7621impl ::buffa::json_helpers::ProtoElemJson for ResumeTriggerRequest {
7622    fn serialize_proto_json<S: ::serde::Serializer>(
7623        v: &Self,
7624        s: S,
7625    ) -> ::core::result::Result<S::Ok, S::Error> {
7626        ::serde::Serialize::serialize(v, s)
7627    }
7628    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7629        d: D,
7630    ) -> ::core::result::Result<Self, D::Error> {
7631        <Self as ::serde::Deserialize>::deserialize(d)
7632    }
7633}
7634#[doc(hidden)]
7635pub const __RESUME_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7636    type_url: "type.googleapis.com/triggers.v1.ResumeTriggerRequest",
7637    to_json: ::buffa::type_registry::any_to_json::<ResumeTriggerRequest>,
7638    from_json: ::buffa::type_registry::any_from_json::<ResumeTriggerRequest>,
7639    is_wkt: false,
7640};
7641/// ResumeTriggerResponse returns the trigger status after resuming.
7642#[derive(Clone, PartialEq, Default)]
7643#[derive(::serde::Serialize, ::serde::Deserialize)]
7644#[serde(default)]
7645pub struct ResumeTriggerResponse {
7646    /// Resumed trigger ID.
7647    ///
7648    /// Field 1: `trigger_id`
7649    #[serde(
7650        rename = "triggerId",
7651        alias = "trigger_id",
7652        with = "::buffa::json_helpers::uint64",
7653        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7654    )]
7655    pub trigger_id: u64,
7656    /// Current trigger status after resuming.
7657    ///
7658    /// Field 2: `status`
7659    #[serde(
7660        rename = "status",
7661        with = "::buffa::json_helpers::proto_enum",
7662        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7663    )]
7664    pub status: ::buffa::EnumValue<TriggerStatus>,
7665    /// Server timestamp.
7666    ///
7667    /// Field 3: `ts`
7668    #[serde(
7669        rename = "ts",
7670        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7671    )]
7672    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7673    /// Server timestamp in nanoseconds since epoch (UTC).
7674    ///
7675    /// Field 4: `ts_ns`
7676    #[serde(
7677        rename = "tsNs",
7678        alias = "ts_ns",
7679        with = "::buffa::json_helpers::uint64",
7680        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7681    )]
7682    pub ts_ns: u64,
7683    #[serde(skip)]
7684    #[doc(hidden)]
7685    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7686}
7687impl ::core::fmt::Debug for ResumeTriggerResponse {
7688    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7689        f.debug_struct("ResumeTriggerResponse")
7690            .field("trigger_id", &self.trigger_id)
7691            .field("status", &self.status)
7692            .field("ts", &self.ts)
7693            .field("ts_ns", &self.ts_ns)
7694            .finish()
7695    }
7696}
7697impl ResumeTriggerResponse {
7698    /// Protobuf type URL for this message, for use with `Any::pack` and
7699    /// `Any::unpack_if`.
7700    ///
7701    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7702    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
7703}
7704::buffa::impl_default_instance!(ResumeTriggerResponse);
7705impl ::buffa::MessageName for ResumeTriggerResponse {
7706    const PACKAGE: &'static str = "triggers.v1";
7707    const NAME: &'static str = "ResumeTriggerResponse";
7708    const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerResponse";
7709    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
7710}
7711impl ::buffa::Message for ResumeTriggerResponse {
7712    /// Returns the total encoded size in bytes.
7713    ///
7714    /// The result is a `u32`; the protobuf specification requires all
7715    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7716    /// compliant message will never overflow this type.
7717    #[allow(clippy::let_and_return)]
7718    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7719        #[allow(unused_imports)]
7720        use ::buffa::Enumeration as _;
7721        let mut size = 0u32;
7722        if self.trigger_id != 0u64 {
7723            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7724        }
7725        {
7726            let val = self.status.to_i32();
7727            if val != 0 {
7728                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7729            }
7730        }
7731        if self.ts.is_set() {
7732            let __slot = __cache.reserve();
7733            let inner_size = self.ts.compute_size(__cache);
7734            __cache.set(__slot, inner_size);
7735            size
7736                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7737                    + inner_size;
7738        }
7739        if self.ts_ns != 0u64 {
7740            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7741        }
7742        size += self.__buffa_unknown_fields.encoded_len() as u32;
7743        size
7744    }
7745    fn write_to(
7746        &self,
7747        __cache: &mut ::buffa::SizeCache,
7748        buf: &mut impl ::buffa::bytes::BufMut,
7749    ) {
7750        #[allow(unused_imports)]
7751        use ::buffa::Enumeration as _;
7752        if self.trigger_id != 0u64 {
7753            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7754        }
7755        {
7756            let val = self.status.to_i32();
7757            if val != 0 {
7758                ::buffa::types::put_int32_field(2u32, val, buf);
7759            }
7760        }
7761        if self.ts.is_set() {
7762            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7763            self.ts.write_to(__cache, buf);
7764        }
7765        if self.ts_ns != 0u64 {
7766            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7767        }
7768        self.__buffa_unknown_fields.write_to(buf);
7769    }
7770    fn merge_field(
7771        &mut self,
7772        tag: ::buffa::encoding::Tag,
7773        buf: &mut impl ::buffa::bytes::Buf,
7774        ctx: ::buffa::DecodeContext<'_>,
7775    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7776        #[allow(unused_imports)]
7777        use ::buffa::bytes::Buf as _;
7778        #[allow(unused_imports)]
7779        use ::buffa::Enumeration as _;
7780        match tag.field_number() {
7781            1u32 => {
7782                ::buffa::encoding::check_wire_type(
7783                    tag,
7784                    ::buffa::encoding::WireType::Fixed64,
7785                )?;
7786                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7787            }
7788            2u32 => {
7789                ::buffa::encoding::check_wire_type(
7790                    tag,
7791                    ::buffa::encoding::WireType::Varint,
7792                )?;
7793                self.status = ::buffa::EnumValue::from(
7794                    ::buffa::types::decode_int32(buf)?,
7795                );
7796            }
7797            3u32 => {
7798                ::buffa::encoding::check_wire_type(
7799                    tag,
7800                    ::buffa::encoding::WireType::LengthDelimited,
7801                )?;
7802                ::buffa::Message::merge_length_delimited(
7803                    self.ts.get_or_insert_default(),
7804                    buf,
7805                    ctx,
7806                )?;
7807            }
7808            4u32 => {
7809                ::buffa::encoding::check_wire_type(
7810                    tag,
7811                    ::buffa::encoding::WireType::Varint,
7812                )?;
7813                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7814            }
7815            _ => {
7816                self.__buffa_unknown_fields
7817                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7818            }
7819        }
7820        ::core::result::Result::Ok(())
7821    }
7822    fn clear(&mut self) {
7823        self.trigger_id = 0u64;
7824        self.status = ::buffa::EnumValue::from(0);
7825        self.ts = ::buffa::MessageField::none();
7826        self.ts_ns = 0u64;
7827        self.__buffa_unknown_fields.clear();
7828    }
7829}
7830impl ::buffa::ExtensionSet for ResumeTriggerResponse {
7831    const PROTO_FQN: &'static str = "triggers.v1.ResumeTriggerResponse";
7832    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7833        &self.__buffa_unknown_fields
7834    }
7835    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7836        &mut self.__buffa_unknown_fields
7837    }
7838}
7839impl ::buffa::json_helpers::ProtoElemJson for ResumeTriggerResponse {
7840    fn serialize_proto_json<S: ::serde::Serializer>(
7841        v: &Self,
7842        s: S,
7843    ) -> ::core::result::Result<S::Ok, S::Error> {
7844        ::serde::Serialize::serialize(v, s)
7845    }
7846    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7847        d: D,
7848    ) -> ::core::result::Result<Self, D::Error> {
7849        <Self as ::serde::Deserialize>::deserialize(d)
7850    }
7851}
7852#[doc(hidden)]
7853pub const __RESUME_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7854    type_url: "type.googleapis.com/triggers.v1.ResumeTriggerResponse",
7855    to_json: ::buffa::type_registry::any_to_json::<ResumeTriggerResponse>,
7856    from_json: ::buffa::type_registry::any_from_json::<ResumeTriggerResponse>,
7857    is_wkt: false,
7858};
7859/// =============================================================================
7860/// Trigger Model
7861/// =============================================================================
7862///
7863/// StopDetails contains configuration for STOP_LOSS and TAKE_PROFIT triggers.
7864#[derive(Clone, PartialEq, Default)]
7865#[derive(::serde::Serialize, ::serde::Deserialize)]
7866#[serde(default)]
7867pub struct StopDetails {
7868    /// Trigger threshold price in quote units scaled by 1e6.
7869    ///
7870    /// Field 1: `trigger_price_ticks`
7871    #[serde(
7872        rename = "triggerPriceTicks",
7873        alias = "trigger_price_ticks",
7874        with = "::buffa::json_helpers::int64",
7875        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
7876    )]
7877    pub trigger_price_ticks: i64,
7878    /// Price source used for trigger evaluation.
7879    ///
7880    /// Field 2: `trigger_price_source`
7881    #[serde(
7882        rename = "triggerPriceSource",
7883        alias = "trigger_price_source",
7884        with = "::buffa::json_helpers::proto_enum",
7885        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7886    )]
7887    pub trigger_price_source: ::buffa::EnumValue<
7888        super::super::orders::v1::TriggerPriceSource,
7889    >,
7890    /// Direction the price must cross to fire the trigger.
7891    ///
7892    /// Field 3: `trigger_direction`
7893    #[serde(
7894        rename = "triggerDirection",
7895        alias = "trigger_direction",
7896        with = "::buffa::json_helpers::proto_enum",
7897        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7898    )]
7899    pub trigger_direction: ::buffa::EnumValue<
7900        super::super::orders::v1::TriggerDirection,
7901    >,
7902    #[serde(skip)]
7903    #[doc(hidden)]
7904    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7905}
7906impl ::core::fmt::Debug for StopDetails {
7907    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7908        f.debug_struct("StopDetails")
7909            .field("trigger_price_ticks", &self.trigger_price_ticks)
7910            .field("trigger_price_source", &self.trigger_price_source)
7911            .field("trigger_direction", &self.trigger_direction)
7912            .finish()
7913    }
7914}
7915impl StopDetails {
7916    /// Protobuf type URL for this message, for use with `Any::pack` and
7917    /// `Any::unpack_if`.
7918    ///
7919    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7920    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
7921}
7922::buffa::impl_default_instance!(StopDetails);
7923impl ::buffa::MessageName for StopDetails {
7924    const PACKAGE: &'static str = "triggers.v1";
7925    const NAME: &'static str = "StopDetails";
7926    const FULL_NAME: &'static str = "triggers.v1.StopDetails";
7927    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
7928}
7929impl ::buffa::Message for StopDetails {
7930    /// Returns the total encoded size in bytes.
7931    ///
7932    /// The result is a `u32`; the protobuf specification requires all
7933    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7934    /// compliant message will never overflow this type.
7935    #[allow(clippy::let_and_return)]
7936    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7937        #[allow(unused_imports)]
7938        use ::buffa::Enumeration as _;
7939        let mut size = 0u32;
7940        if self.trigger_price_ticks != 0i64 {
7941            size
7942                += 1u32
7943                    + ::buffa::types::int64_encoded_len(self.trigger_price_ticks) as u32;
7944        }
7945        {
7946            let val = self.trigger_price_source.to_i32();
7947            if val != 0 {
7948                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7949            }
7950        }
7951        {
7952            let val = self.trigger_direction.to_i32();
7953            if val != 0 {
7954                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7955            }
7956        }
7957        size += self.__buffa_unknown_fields.encoded_len() as u32;
7958        size
7959    }
7960    fn write_to(
7961        &self,
7962        _cache: &mut ::buffa::SizeCache,
7963        buf: &mut impl ::buffa::bytes::BufMut,
7964    ) {
7965        #[allow(unused_imports)]
7966        use ::buffa::Enumeration as _;
7967        if self.trigger_price_ticks != 0i64 {
7968            ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
7969        }
7970        {
7971            let val = self.trigger_price_source.to_i32();
7972            if val != 0 {
7973                ::buffa::types::put_int32_field(2u32, val, buf);
7974            }
7975        }
7976        {
7977            let val = self.trigger_direction.to_i32();
7978            if val != 0 {
7979                ::buffa::types::put_int32_field(3u32, val, buf);
7980            }
7981        }
7982        self.__buffa_unknown_fields.write_to(buf);
7983    }
7984    fn merge_field(
7985        &mut self,
7986        tag: ::buffa::encoding::Tag,
7987        buf: &mut impl ::buffa::bytes::Buf,
7988        ctx: ::buffa::DecodeContext<'_>,
7989    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7990        #[allow(unused_imports)]
7991        use ::buffa::bytes::Buf as _;
7992        #[allow(unused_imports)]
7993        use ::buffa::Enumeration as _;
7994        match tag.field_number() {
7995            1u32 => {
7996                ::buffa::encoding::check_wire_type(
7997                    tag,
7998                    ::buffa::encoding::WireType::Varint,
7999                )?;
8000                self.trigger_price_ticks = ::buffa::types::decode_int64(buf)?;
8001            }
8002            2u32 => {
8003                ::buffa::encoding::check_wire_type(
8004                    tag,
8005                    ::buffa::encoding::WireType::Varint,
8006                )?;
8007                self.trigger_price_source = ::buffa::EnumValue::from(
8008                    ::buffa::types::decode_int32(buf)?,
8009                );
8010            }
8011            3u32 => {
8012                ::buffa::encoding::check_wire_type(
8013                    tag,
8014                    ::buffa::encoding::WireType::Varint,
8015                )?;
8016                self.trigger_direction = ::buffa::EnumValue::from(
8017                    ::buffa::types::decode_int32(buf)?,
8018                );
8019            }
8020            _ => {
8021                self.__buffa_unknown_fields
8022                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8023            }
8024        }
8025        ::core::result::Result::Ok(())
8026    }
8027    fn clear(&mut self) {
8028        self.trigger_price_ticks = 0i64;
8029        self.trigger_price_source = ::buffa::EnumValue::from(0);
8030        self.trigger_direction = ::buffa::EnumValue::from(0);
8031        self.__buffa_unknown_fields.clear();
8032    }
8033}
8034impl ::buffa::ExtensionSet for StopDetails {
8035    const PROTO_FQN: &'static str = "triggers.v1.StopDetails";
8036    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8037        &self.__buffa_unknown_fields
8038    }
8039    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8040        &mut self.__buffa_unknown_fields
8041    }
8042}
8043impl ::buffa::json_helpers::ProtoElemJson for StopDetails {
8044    fn serialize_proto_json<S: ::serde::Serializer>(
8045        v: &Self,
8046        s: S,
8047    ) -> ::core::result::Result<S::Ok, S::Error> {
8048        ::serde::Serialize::serialize(v, s)
8049    }
8050    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8051        d: D,
8052    ) -> ::core::result::Result<Self, D::Error> {
8053        <Self as ::serde::Deserialize>::deserialize(d)
8054    }
8055}
8056#[doc(hidden)]
8057pub const __STOP_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8058    type_url: "type.googleapis.com/triggers.v1.StopDetails",
8059    to_json: ::buffa::type_registry::any_to_json::<StopDetails>,
8060    from_json: ::buffa::type_registry::any_from_json::<StopDetails>,
8061    is_wkt: false,
8062};
8063/// TrailingDetails contains configuration and runtime state for TRAILING_STOP
8064/// triggers.
8065#[derive(Clone, PartialEq, Default)]
8066#[derive(::serde::Serialize, ::serde::Deserialize)]
8067#[serde(default)]
8068pub struct TrailingDetails {
8069    /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
8070    ///
8071    /// Field 1: `trailing_distance_ticks`
8072    #[serde(
8073        rename = "trailingDistanceTicks",
8074        alias = "trailing_distance_ticks",
8075        with = "::buffa::json_helpers::int64",
8076        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8077    )]
8078    pub trailing_distance_ticks: i64,
8079    /// Optional activation price: trailing only starts after this price is
8080    /// reached. Expressed in quote units scaled by 1e6.
8081    ///
8082    /// Field 2: `activation_price_ticks`
8083    #[serde(
8084        rename = "activationPriceTicks",
8085        alias = "activation_price_ticks",
8086        with = "::buffa::json_helpers::int64",
8087        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8088    )]
8089    pub activation_price_ticks: i64,
8090    /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
8091    ///
8092    /// Field 3: `peak_price_ticks`
8093    #[serde(
8094        rename = "peakPriceTicks",
8095        alias = "peak_price_ticks",
8096        with = "::buffa::json_helpers::int64",
8097        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8098    )]
8099    pub peak_price_ticks: i64,
8100    /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
8101    ///
8102    /// Field 4: `trough_price_ticks`
8103    #[serde(
8104        rename = "troughPriceTicks",
8105        alias = "trough_price_ticks",
8106        with = "::buffa::json_helpers::int64",
8107        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8108    )]
8109    pub trough_price_ticks: i64,
8110    /// Trailing distance in basis points (1 bp = 0.01%).
8111    ///
8112    /// Field 5: `trailing_distance_bps`
8113    #[serde(
8114        rename = "trailingDistanceBps",
8115        alias = "trailing_distance_bps",
8116        with = "::buffa::json_helpers::int32",
8117        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8118    )]
8119    pub trailing_distance_bps: i32,
8120    /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
8121    ///
8122    /// Field 6: `max_slippage_ticks`
8123    #[serde(
8124        rename = "maxSlippageTicks",
8125        alias = "max_slippage_ticks",
8126        with = "::buffa::json_helpers::int32",
8127        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8128    )]
8129    pub max_slippage_ticks: i32,
8130    /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
8131    ///
8132    /// Field 7: `max_slippage_bps`
8133    #[serde(
8134        rename = "maxSlippageBps",
8135        alias = "max_slippage_bps",
8136        with = "::buffa::json_helpers::int32",
8137        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8138    )]
8139    pub max_slippage_bps: i32,
8140    /// Price source used for trigger evaluation. Fixed for the lifetime of the
8141    /// trigger and exposed for completeness.
8142    ///
8143    /// Field 8: `trigger_price_source`
8144    #[serde(
8145        rename = "triggerPriceSource",
8146        alias = "trigger_price_source",
8147        with = "::buffa::json_helpers::proto_enum",
8148        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8149    )]
8150    pub trigger_price_source: ::buffa::EnumValue<
8151        super::super::orders::v1::TriggerPriceSource,
8152    >,
8153    /// Direction the price must cross to fire the trigger. Fixed for the lifetime
8154    /// of the trigger and exposed for completeness.
8155    ///
8156    /// Field 9: `trigger_direction`
8157    #[serde(
8158        rename = "triggerDirection",
8159        alias = "trigger_direction",
8160        with = "::buffa::json_helpers::proto_enum",
8161        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8162    )]
8163    pub trigger_direction: ::buffa::EnumValue<
8164        super::super::orders::v1::TriggerDirection,
8165    >,
8166    #[serde(skip)]
8167    #[doc(hidden)]
8168    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8169}
8170impl ::core::fmt::Debug for TrailingDetails {
8171    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8172        f.debug_struct("TrailingDetails")
8173            .field("trailing_distance_ticks", &self.trailing_distance_ticks)
8174            .field("activation_price_ticks", &self.activation_price_ticks)
8175            .field("peak_price_ticks", &self.peak_price_ticks)
8176            .field("trough_price_ticks", &self.trough_price_ticks)
8177            .field("trailing_distance_bps", &self.trailing_distance_bps)
8178            .field("max_slippage_ticks", &self.max_slippage_ticks)
8179            .field("max_slippage_bps", &self.max_slippage_bps)
8180            .field("trigger_price_source", &self.trigger_price_source)
8181            .field("trigger_direction", &self.trigger_direction)
8182            .finish()
8183    }
8184}
8185impl TrailingDetails {
8186    /// Protobuf type URL for this message, for use with `Any::pack` and
8187    /// `Any::unpack_if`.
8188    ///
8189    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8190    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
8191}
8192::buffa::impl_default_instance!(TrailingDetails);
8193impl ::buffa::MessageName for TrailingDetails {
8194    const PACKAGE: &'static str = "triggers.v1";
8195    const NAME: &'static str = "TrailingDetails";
8196    const FULL_NAME: &'static str = "triggers.v1.TrailingDetails";
8197    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
8198}
8199impl ::buffa::Message for TrailingDetails {
8200    /// Returns the total encoded size in bytes.
8201    ///
8202    /// The result is a `u32`; the protobuf specification requires all
8203    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8204    /// compliant message will never overflow this type.
8205    #[allow(clippy::let_and_return)]
8206    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8207        #[allow(unused_imports)]
8208        use ::buffa::Enumeration as _;
8209        let mut size = 0u32;
8210        if self.trailing_distance_ticks != 0i64 {
8211            size
8212                += 1u32
8213                    + ::buffa::types::int64_encoded_len(self.trailing_distance_ticks)
8214                        as u32;
8215        }
8216        if self.activation_price_ticks != 0i64 {
8217            size
8218                += 1u32
8219                    + ::buffa::types::int64_encoded_len(self.activation_price_ticks)
8220                        as u32;
8221        }
8222        if self.peak_price_ticks != 0i64 {
8223            size
8224                += 1u32
8225                    + ::buffa::types::int64_encoded_len(self.peak_price_ticks) as u32;
8226        }
8227        if self.trough_price_ticks != 0i64 {
8228            size
8229                += 1u32
8230                    + ::buffa::types::int64_encoded_len(self.trough_price_ticks) as u32;
8231        }
8232        if self.trailing_distance_bps != 0i32 {
8233            size
8234                += 1u32
8235                    + ::buffa::types::int32_encoded_len(self.trailing_distance_bps)
8236                        as u32;
8237        }
8238        if self.max_slippage_ticks != 0i32 {
8239            size
8240                += 1u32
8241                    + ::buffa::types::int32_encoded_len(self.max_slippage_ticks) as u32;
8242        }
8243        if self.max_slippage_bps != 0i32 {
8244            size
8245                += 1u32
8246                    + ::buffa::types::int32_encoded_len(self.max_slippage_bps) as u32;
8247        }
8248        {
8249            let val = self.trigger_price_source.to_i32();
8250            if val != 0 {
8251                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8252            }
8253        }
8254        {
8255            let val = self.trigger_direction.to_i32();
8256            if val != 0 {
8257                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8258            }
8259        }
8260        size += self.__buffa_unknown_fields.encoded_len() as u32;
8261        size
8262    }
8263    fn write_to(
8264        &self,
8265        _cache: &mut ::buffa::SizeCache,
8266        buf: &mut impl ::buffa::bytes::BufMut,
8267    ) {
8268        #[allow(unused_imports)]
8269        use ::buffa::Enumeration as _;
8270        if self.trailing_distance_ticks != 0i64 {
8271            ::buffa::types::put_int64_field(1u32, self.trailing_distance_ticks, buf);
8272        }
8273        if self.activation_price_ticks != 0i64 {
8274            ::buffa::types::put_int64_field(2u32, self.activation_price_ticks, buf);
8275        }
8276        if self.peak_price_ticks != 0i64 {
8277            ::buffa::types::put_int64_field(3u32, self.peak_price_ticks, buf);
8278        }
8279        if self.trough_price_ticks != 0i64 {
8280            ::buffa::types::put_int64_field(4u32, self.trough_price_ticks, buf);
8281        }
8282        if self.trailing_distance_bps != 0i32 {
8283            ::buffa::types::put_int32_field(5u32, self.trailing_distance_bps, buf);
8284        }
8285        if self.max_slippage_ticks != 0i32 {
8286            ::buffa::types::put_int32_field(6u32, self.max_slippage_ticks, buf);
8287        }
8288        if self.max_slippage_bps != 0i32 {
8289            ::buffa::types::put_int32_field(7u32, self.max_slippage_bps, buf);
8290        }
8291        {
8292            let val = self.trigger_price_source.to_i32();
8293            if val != 0 {
8294                ::buffa::types::put_int32_field(8u32, val, buf);
8295            }
8296        }
8297        {
8298            let val = self.trigger_direction.to_i32();
8299            if val != 0 {
8300                ::buffa::types::put_int32_field(9u32, val, buf);
8301            }
8302        }
8303        self.__buffa_unknown_fields.write_to(buf);
8304    }
8305    fn merge_field(
8306        &mut self,
8307        tag: ::buffa::encoding::Tag,
8308        buf: &mut impl ::buffa::bytes::Buf,
8309        ctx: ::buffa::DecodeContext<'_>,
8310    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8311        #[allow(unused_imports)]
8312        use ::buffa::bytes::Buf as _;
8313        #[allow(unused_imports)]
8314        use ::buffa::Enumeration as _;
8315        match tag.field_number() {
8316            1u32 => {
8317                ::buffa::encoding::check_wire_type(
8318                    tag,
8319                    ::buffa::encoding::WireType::Varint,
8320                )?;
8321                self.trailing_distance_ticks = ::buffa::types::decode_int64(buf)?;
8322            }
8323            2u32 => {
8324                ::buffa::encoding::check_wire_type(
8325                    tag,
8326                    ::buffa::encoding::WireType::Varint,
8327                )?;
8328                self.activation_price_ticks = ::buffa::types::decode_int64(buf)?;
8329            }
8330            3u32 => {
8331                ::buffa::encoding::check_wire_type(
8332                    tag,
8333                    ::buffa::encoding::WireType::Varint,
8334                )?;
8335                self.peak_price_ticks = ::buffa::types::decode_int64(buf)?;
8336            }
8337            4u32 => {
8338                ::buffa::encoding::check_wire_type(
8339                    tag,
8340                    ::buffa::encoding::WireType::Varint,
8341                )?;
8342                self.trough_price_ticks = ::buffa::types::decode_int64(buf)?;
8343            }
8344            5u32 => {
8345                ::buffa::encoding::check_wire_type(
8346                    tag,
8347                    ::buffa::encoding::WireType::Varint,
8348                )?;
8349                self.trailing_distance_bps = ::buffa::types::decode_int32(buf)?;
8350            }
8351            6u32 => {
8352                ::buffa::encoding::check_wire_type(
8353                    tag,
8354                    ::buffa::encoding::WireType::Varint,
8355                )?;
8356                self.max_slippage_ticks = ::buffa::types::decode_int32(buf)?;
8357            }
8358            7u32 => {
8359                ::buffa::encoding::check_wire_type(
8360                    tag,
8361                    ::buffa::encoding::WireType::Varint,
8362                )?;
8363                self.max_slippage_bps = ::buffa::types::decode_int32(buf)?;
8364            }
8365            8u32 => {
8366                ::buffa::encoding::check_wire_type(
8367                    tag,
8368                    ::buffa::encoding::WireType::Varint,
8369                )?;
8370                self.trigger_price_source = ::buffa::EnumValue::from(
8371                    ::buffa::types::decode_int32(buf)?,
8372                );
8373            }
8374            9u32 => {
8375                ::buffa::encoding::check_wire_type(
8376                    tag,
8377                    ::buffa::encoding::WireType::Varint,
8378                )?;
8379                self.trigger_direction = ::buffa::EnumValue::from(
8380                    ::buffa::types::decode_int32(buf)?,
8381                );
8382            }
8383            _ => {
8384                self.__buffa_unknown_fields
8385                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8386            }
8387        }
8388        ::core::result::Result::Ok(())
8389    }
8390    fn clear(&mut self) {
8391        self.trailing_distance_ticks = 0i64;
8392        self.activation_price_ticks = 0i64;
8393        self.peak_price_ticks = 0i64;
8394        self.trough_price_ticks = 0i64;
8395        self.trailing_distance_bps = 0i32;
8396        self.max_slippage_ticks = 0i32;
8397        self.max_slippage_bps = 0i32;
8398        self.trigger_price_source = ::buffa::EnumValue::from(0);
8399        self.trigger_direction = ::buffa::EnumValue::from(0);
8400        self.__buffa_unknown_fields.clear();
8401    }
8402}
8403impl ::buffa::ExtensionSet for TrailingDetails {
8404    const PROTO_FQN: &'static str = "triggers.v1.TrailingDetails";
8405    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8406        &self.__buffa_unknown_fields
8407    }
8408    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8409        &mut self.__buffa_unknown_fields
8410    }
8411}
8412impl ::buffa::json_helpers::ProtoElemJson for TrailingDetails {
8413    fn serialize_proto_json<S: ::serde::Serializer>(
8414        v: &Self,
8415        s: S,
8416    ) -> ::core::result::Result<S::Ok, S::Error> {
8417        ::serde::Serialize::serialize(v, s)
8418    }
8419    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8420        d: D,
8421    ) -> ::core::result::Result<Self, D::Error> {
8422        <Self as ::serde::Deserialize>::deserialize(d)
8423    }
8424}
8425#[doc(hidden)]
8426pub const __TRAILING_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8427    type_url: "type.googleapis.com/triggers.v1.TrailingDetails",
8428    to_json: ::buffa::type_registry::any_to_json::<TrailingDetails>,
8429    from_json: ::buffa::type_registry::any_from_json::<TrailingDetails>,
8430    is_wkt: false,
8431};
8432/// TwapDetails contains configuration and runtime state for TWAP triggers.
8433#[derive(Clone, PartialEq, Default)]
8434#[derive(::serde::Serialize, ::serde::Deserialize)]
8435#[serde(default)]
8436pub struct TwapDetails {
8437    /// Total duration of TWAP execution in milliseconds.
8438    ///
8439    /// Field 1: `twap_duration_ms`
8440    #[serde(
8441        rename = "twapDurationMs",
8442        alias = "twap_duration_ms",
8443        with = "::buffa::json_helpers::int64",
8444        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8445    )]
8446    pub twap_duration_ms: i64,
8447    /// Interval between TWAP slices in milliseconds.
8448    ///
8449    /// Field 2: `twap_slice_interval_ms`
8450    #[serde(
8451        rename = "twapSliceIntervalMs",
8452        alias = "twap_slice_interval_ms",
8453        with = "::buffa::json_helpers::int64",
8454        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8455    )]
8456    pub twap_slice_interval_ms: i64,
8457    /// Current slice index, zero-based.
8458    ///
8459    /// Field 4: `slice_idx`
8460    #[serde(
8461        rename = "sliceIdx",
8462        alias = "slice_idx",
8463        with = "::buffa::json_helpers::int32",
8464        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8465    )]
8466    pub slice_idx: i32,
8467    /// Total number of planned slices.
8468    ///
8469    /// Field 5: `slice_count`
8470    #[serde(
8471        rename = "sliceCount",
8472        alias = "slice_count",
8473        with = "::buffa::json_helpers::int32",
8474        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8475    )]
8476    pub slice_count: i32,
8477    /// Cumulative executed quantity scaled by the pair's base_quantity_scale from
8478    /// GetSpotConfig.
8479    ///
8480    /// Field 6: `executed_qty_scaled`
8481    #[serde(
8482        rename = "executedQtyScaled",
8483        alias = "executed_qty_scaled",
8484        with = "::buffa::json_helpers::int64",
8485        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8486    )]
8487    pub executed_qty_scaled: i64,
8488    #[serde(skip)]
8489    #[doc(hidden)]
8490    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8491}
8492impl ::core::fmt::Debug for TwapDetails {
8493    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8494        f.debug_struct("TwapDetails")
8495            .field("twap_duration_ms", &self.twap_duration_ms)
8496            .field("twap_slice_interval_ms", &self.twap_slice_interval_ms)
8497            .field("slice_idx", &self.slice_idx)
8498            .field("slice_count", &self.slice_count)
8499            .field("executed_qty_scaled", &self.executed_qty_scaled)
8500            .finish()
8501    }
8502}
8503impl TwapDetails {
8504    /// Protobuf type URL for this message, for use with `Any::pack` and
8505    /// `Any::unpack_if`.
8506    ///
8507    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8508    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
8509}
8510::buffa::impl_default_instance!(TwapDetails);
8511impl ::buffa::MessageName for TwapDetails {
8512    const PACKAGE: &'static str = "triggers.v1";
8513    const NAME: &'static str = "TwapDetails";
8514    const FULL_NAME: &'static str = "triggers.v1.TwapDetails";
8515    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
8516}
8517impl ::buffa::Message for TwapDetails {
8518    /// Returns the total encoded size in bytes.
8519    ///
8520    /// The result is a `u32`; the protobuf specification requires all
8521    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8522    /// compliant message will never overflow this type.
8523    #[allow(clippy::let_and_return)]
8524    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8525        #[allow(unused_imports)]
8526        use ::buffa::Enumeration as _;
8527        let mut size = 0u32;
8528        if self.twap_duration_ms != 0i64 {
8529            size
8530                += 1u32
8531                    + ::buffa::types::int64_encoded_len(self.twap_duration_ms) as u32;
8532        }
8533        if self.twap_slice_interval_ms != 0i64 {
8534            size
8535                += 1u32
8536                    + ::buffa::types::int64_encoded_len(self.twap_slice_interval_ms)
8537                        as u32;
8538        }
8539        if self.slice_idx != 0i32 {
8540            size += 1u32 + ::buffa::types::int32_encoded_len(self.slice_idx) as u32;
8541        }
8542        if self.slice_count != 0i32 {
8543            size += 1u32 + ::buffa::types::int32_encoded_len(self.slice_count) as u32;
8544        }
8545        if self.executed_qty_scaled != 0i64 {
8546            size
8547                += 1u32
8548                    + ::buffa::types::int64_encoded_len(self.executed_qty_scaled) as u32;
8549        }
8550        size += self.__buffa_unknown_fields.encoded_len() as u32;
8551        size
8552    }
8553    fn write_to(
8554        &self,
8555        _cache: &mut ::buffa::SizeCache,
8556        buf: &mut impl ::buffa::bytes::BufMut,
8557    ) {
8558        #[allow(unused_imports)]
8559        use ::buffa::Enumeration as _;
8560        if self.twap_duration_ms != 0i64 {
8561            ::buffa::types::put_int64_field(1u32, self.twap_duration_ms, buf);
8562        }
8563        if self.twap_slice_interval_ms != 0i64 {
8564            ::buffa::types::put_int64_field(2u32, self.twap_slice_interval_ms, buf);
8565        }
8566        if self.slice_idx != 0i32 {
8567            ::buffa::types::put_int32_field(4u32, self.slice_idx, buf);
8568        }
8569        if self.slice_count != 0i32 {
8570            ::buffa::types::put_int32_field(5u32, self.slice_count, buf);
8571        }
8572        if self.executed_qty_scaled != 0i64 {
8573            ::buffa::types::put_int64_field(6u32, self.executed_qty_scaled, buf);
8574        }
8575        self.__buffa_unknown_fields.write_to(buf);
8576    }
8577    fn merge_field(
8578        &mut self,
8579        tag: ::buffa::encoding::Tag,
8580        buf: &mut impl ::buffa::bytes::Buf,
8581        ctx: ::buffa::DecodeContext<'_>,
8582    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8583        #[allow(unused_imports)]
8584        use ::buffa::bytes::Buf as _;
8585        #[allow(unused_imports)]
8586        use ::buffa::Enumeration as _;
8587        match tag.field_number() {
8588            1u32 => {
8589                ::buffa::encoding::check_wire_type(
8590                    tag,
8591                    ::buffa::encoding::WireType::Varint,
8592                )?;
8593                self.twap_duration_ms = ::buffa::types::decode_int64(buf)?;
8594            }
8595            2u32 => {
8596                ::buffa::encoding::check_wire_type(
8597                    tag,
8598                    ::buffa::encoding::WireType::Varint,
8599                )?;
8600                self.twap_slice_interval_ms = ::buffa::types::decode_int64(buf)?;
8601            }
8602            4u32 => {
8603                ::buffa::encoding::check_wire_type(
8604                    tag,
8605                    ::buffa::encoding::WireType::Varint,
8606                )?;
8607                self.slice_idx = ::buffa::types::decode_int32(buf)?;
8608            }
8609            5u32 => {
8610                ::buffa::encoding::check_wire_type(
8611                    tag,
8612                    ::buffa::encoding::WireType::Varint,
8613                )?;
8614                self.slice_count = ::buffa::types::decode_int32(buf)?;
8615            }
8616            6u32 => {
8617                ::buffa::encoding::check_wire_type(
8618                    tag,
8619                    ::buffa::encoding::WireType::Varint,
8620                )?;
8621                self.executed_qty_scaled = ::buffa::types::decode_int64(buf)?;
8622            }
8623            _ => {
8624                self.__buffa_unknown_fields
8625                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8626            }
8627        }
8628        ::core::result::Result::Ok(())
8629    }
8630    fn clear(&mut self) {
8631        self.twap_duration_ms = 0i64;
8632        self.twap_slice_interval_ms = 0i64;
8633        self.slice_idx = 0i32;
8634        self.slice_count = 0i32;
8635        self.executed_qty_scaled = 0i64;
8636        self.__buffa_unknown_fields.clear();
8637    }
8638}
8639impl ::buffa::ExtensionSet for TwapDetails {
8640    const PROTO_FQN: &'static str = "triggers.v1.TwapDetails";
8641    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8642        &self.__buffa_unknown_fields
8643    }
8644    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8645        &mut self.__buffa_unknown_fields
8646    }
8647}
8648impl ::buffa::json_helpers::ProtoElemJson for TwapDetails {
8649    fn serialize_proto_json<S: ::serde::Serializer>(
8650        v: &Self,
8651        s: S,
8652    ) -> ::core::result::Result<S::Ok, S::Error> {
8653        ::serde::Serialize::serialize(v, s)
8654    }
8655    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8656        d: D,
8657    ) -> ::core::result::Result<Self, D::Error> {
8658        <Self as ::serde::Deserialize>::deserialize(d)
8659    }
8660}
8661#[doc(hidden)]
8662pub const __TWAP_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8663    type_url: "type.googleapis.com/triggers.v1.TwapDetails",
8664    to_json: ::buffa::type_registry::any_to_json::<TwapDetails>,
8665    from_json: ::buffa::type_registry::any_from_json::<TwapDetails>,
8666    is_wkt: false,
8667};
8668/// LadderDetails contains configuration for LADDER triggers.
8669#[derive(Clone, PartialEq, Default)]
8670#[derive(::serde::Serialize, ::serde::Deserialize)]
8671#[serde(default)]
8672pub struct LadderDetails {
8673    /// Minimum price in quote units scaled by 1e6 for the ladder range.
8674    ///
8675    /// Field 1: `ladder_price_min_ticks`
8676    #[serde(
8677        rename = "ladderPriceMinTicks",
8678        alias = "ladder_price_min_ticks",
8679        with = "::buffa::json_helpers::int64",
8680        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8681    )]
8682    pub ladder_price_min_ticks: i64,
8683    /// Maximum price in quote units scaled by 1e6 for the ladder range.
8684    ///
8685    /// Field 2: `ladder_price_max_ticks`
8686    #[serde(
8687        rename = "ladderPriceMaxTicks",
8688        alias = "ladder_price_max_ticks",
8689        with = "::buffa::json_helpers::int64",
8690        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8691    )]
8692    pub ladder_price_max_ticks: i64,
8693    /// Number of price levels in the ladder.
8694    ///
8695    /// Field 3: `ladder_levels`
8696    #[serde(
8697        rename = "ladderLevels",
8698        alias = "ladder_levels",
8699        with = "::buffa::json_helpers::int32",
8700        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8701    )]
8702    pub ladder_levels: i32,
8703    /// Quantity distribution across ladder levels.
8704    ///
8705    /// Field 4: `ladder_distribution`
8706    #[serde(
8707        rename = "ladderDistribution",
8708        alias = "ladder_distribution",
8709        with = "::buffa::json_helpers::proto_enum",
8710        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8711    )]
8712    pub ladder_distribution: ::buffa::EnumValue<LadderDistribution>,
8713    #[serde(skip)]
8714    #[doc(hidden)]
8715    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8716}
8717impl ::core::fmt::Debug for LadderDetails {
8718    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8719        f.debug_struct("LadderDetails")
8720            .field("ladder_price_min_ticks", &self.ladder_price_min_ticks)
8721            .field("ladder_price_max_ticks", &self.ladder_price_max_ticks)
8722            .field("ladder_levels", &self.ladder_levels)
8723            .field("ladder_distribution", &self.ladder_distribution)
8724            .finish()
8725    }
8726}
8727impl LadderDetails {
8728    /// Protobuf type URL for this message, for use with `Any::pack` and
8729    /// `Any::unpack_if`.
8730    ///
8731    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8732    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
8733}
8734::buffa::impl_default_instance!(LadderDetails);
8735impl ::buffa::MessageName for LadderDetails {
8736    const PACKAGE: &'static str = "triggers.v1";
8737    const NAME: &'static str = "LadderDetails";
8738    const FULL_NAME: &'static str = "triggers.v1.LadderDetails";
8739    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
8740}
8741impl ::buffa::Message for LadderDetails {
8742    /// Returns the total encoded size in bytes.
8743    ///
8744    /// The result is a `u32`; the protobuf specification requires all
8745    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8746    /// compliant message will never overflow this type.
8747    #[allow(clippy::let_and_return)]
8748    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8749        #[allow(unused_imports)]
8750        use ::buffa::Enumeration as _;
8751        let mut size = 0u32;
8752        if self.ladder_price_min_ticks != 0i64 {
8753            size
8754                += 1u32
8755                    + ::buffa::types::int64_encoded_len(self.ladder_price_min_ticks)
8756                        as u32;
8757        }
8758        if self.ladder_price_max_ticks != 0i64 {
8759            size
8760                += 1u32
8761                    + ::buffa::types::int64_encoded_len(self.ladder_price_max_ticks)
8762                        as u32;
8763        }
8764        if self.ladder_levels != 0i32 {
8765            size += 1u32 + ::buffa::types::int32_encoded_len(self.ladder_levels) as u32;
8766        }
8767        {
8768            let val = self.ladder_distribution.to_i32();
8769            if val != 0 {
8770                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8771            }
8772        }
8773        size += self.__buffa_unknown_fields.encoded_len() as u32;
8774        size
8775    }
8776    fn write_to(
8777        &self,
8778        _cache: &mut ::buffa::SizeCache,
8779        buf: &mut impl ::buffa::bytes::BufMut,
8780    ) {
8781        #[allow(unused_imports)]
8782        use ::buffa::Enumeration as _;
8783        if self.ladder_price_min_ticks != 0i64 {
8784            ::buffa::types::put_int64_field(1u32, self.ladder_price_min_ticks, buf);
8785        }
8786        if self.ladder_price_max_ticks != 0i64 {
8787            ::buffa::types::put_int64_field(2u32, self.ladder_price_max_ticks, buf);
8788        }
8789        if self.ladder_levels != 0i32 {
8790            ::buffa::types::put_int32_field(3u32, self.ladder_levels, buf);
8791        }
8792        {
8793            let val = self.ladder_distribution.to_i32();
8794            if val != 0 {
8795                ::buffa::types::put_int32_field(4u32, val, buf);
8796            }
8797        }
8798        self.__buffa_unknown_fields.write_to(buf);
8799    }
8800    fn merge_field(
8801        &mut self,
8802        tag: ::buffa::encoding::Tag,
8803        buf: &mut impl ::buffa::bytes::Buf,
8804        ctx: ::buffa::DecodeContext<'_>,
8805    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8806        #[allow(unused_imports)]
8807        use ::buffa::bytes::Buf as _;
8808        #[allow(unused_imports)]
8809        use ::buffa::Enumeration as _;
8810        match tag.field_number() {
8811            1u32 => {
8812                ::buffa::encoding::check_wire_type(
8813                    tag,
8814                    ::buffa::encoding::WireType::Varint,
8815                )?;
8816                self.ladder_price_min_ticks = ::buffa::types::decode_int64(buf)?;
8817            }
8818            2u32 => {
8819                ::buffa::encoding::check_wire_type(
8820                    tag,
8821                    ::buffa::encoding::WireType::Varint,
8822                )?;
8823                self.ladder_price_max_ticks = ::buffa::types::decode_int64(buf)?;
8824            }
8825            3u32 => {
8826                ::buffa::encoding::check_wire_type(
8827                    tag,
8828                    ::buffa::encoding::WireType::Varint,
8829                )?;
8830                self.ladder_levels = ::buffa::types::decode_int32(buf)?;
8831            }
8832            4u32 => {
8833                ::buffa::encoding::check_wire_type(
8834                    tag,
8835                    ::buffa::encoding::WireType::Varint,
8836                )?;
8837                self.ladder_distribution = ::buffa::EnumValue::from(
8838                    ::buffa::types::decode_int32(buf)?,
8839                );
8840            }
8841            _ => {
8842                self.__buffa_unknown_fields
8843                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8844            }
8845        }
8846        ::core::result::Result::Ok(())
8847    }
8848    fn clear(&mut self) {
8849        self.ladder_price_min_ticks = 0i64;
8850        self.ladder_price_max_ticks = 0i64;
8851        self.ladder_levels = 0i32;
8852        self.ladder_distribution = ::buffa::EnumValue::from(0);
8853        self.__buffa_unknown_fields.clear();
8854    }
8855}
8856impl ::buffa::ExtensionSet for LadderDetails {
8857    const PROTO_FQN: &'static str = "triggers.v1.LadderDetails";
8858    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8859        &self.__buffa_unknown_fields
8860    }
8861    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8862        &mut self.__buffa_unknown_fields
8863    }
8864}
8865impl ::buffa::json_helpers::ProtoElemJson for LadderDetails {
8866    fn serialize_proto_json<S: ::serde::Serializer>(
8867        v: &Self,
8868        s: S,
8869    ) -> ::core::result::Result<S::Ok, S::Error> {
8870        ::serde::Serialize::serialize(v, s)
8871    }
8872    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8873        d: D,
8874    ) -> ::core::result::Result<Self, D::Error> {
8875        <Self as ::serde::Deserialize>::deserialize(d)
8876    }
8877}
8878#[doc(hidden)]
8879pub const __LADDER_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8880    type_url: "type.googleapis.com/triggers.v1.LadderDetails",
8881    to_json: ::buffa::type_registry::any_to_json::<LadderDetails>,
8882    from_json: ::buffa::type_registry::any_from_json::<LadderDetails>,
8883    is_wkt: false,
8884};
8885/// Trigger represents a trigger with its full state.
8886#[derive(Clone, PartialEq, Default)]
8887#[derive(::serde::Serialize)]
8888#[serde(default)]
8889pub struct Trigger {
8890    /// Trigger ID.
8891    ///
8892    /// Field 1: `trigger_id`
8893    #[serde(
8894        rename = "triggerId",
8895        alias = "trigger_id",
8896        with = "::buffa::json_helpers::uint64",
8897        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
8898    )]
8899    pub trigger_id: u64,
8900    /// Public account or sub-account ID associated with the trigger.
8901    ///
8902    /// Field 2: `subaccount_id`
8903    #[serde(
8904        rename = "subaccountId",
8905        alias = "subaccount_id",
8906        with = "::buffa::json_helpers::uint64",
8907        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
8908    )]
8909    pub subaccount_id: u64,
8910    /// Trading symbol numeric identifier.
8911    ///
8912    /// Field 3: `symbol_id`
8913    #[serde(
8914        rename = "symbolId",
8915        alias = "symbol_id",
8916        with = "::buffa::json_helpers::uint32",
8917        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
8918    )]
8919    pub symbol_id: u32,
8920    /// Trading symbol, for example "BTC-USDT".
8921    ///
8922    /// Field 4: `symbol`
8923    #[serde(
8924        rename = "symbol",
8925        with = "::buffa::json_helpers::proto_string",
8926        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
8927    )]
8928    pub symbol: ::buffa::alloc::string::String,
8929    /// Current trigger lifecycle status.
8930    ///
8931    /// Field 5: `status`
8932    #[serde(
8933        rename = "status",
8934        with = "::buffa::json_helpers::proto_enum",
8935        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8936    )]
8937    pub status: ::buffa::EnumValue<TriggerStatus>,
8938    /// Parent order ID for attached-risk triggers; empty for standalone triggers.
8939    ///
8940    /// Field 6: `parent_order_id`
8941    #[serde(
8942        rename = "parentOrderId",
8943        alias = "parent_order_id",
8944        with = "::buffa::json_helpers::opt_uint64",
8945        skip_serializing_if = "::core::option::Option::is_none"
8946    )]
8947    pub parent_order_id: ::core::option::Option<u64>,
8948    /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
8949    ///
8950    /// Field 20: `qty_scaled`
8951    #[serde(
8952        rename = "qtyScaled",
8953        alias = "qty_scaled",
8954        with = "::buffa::json_helpers::int64",
8955        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8956    )]
8957    pub qty_scaled: i64,
8958    /// Fee asset for BUY child orders.
8959    ///
8960    /// Field 21: `fee_asset`
8961    #[serde(
8962        rename = "feeAsset",
8963        alias = "fee_asset",
8964        with = "::buffa::json_helpers::proto_enum",
8965        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8966    )]
8967    pub fee_asset: ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
8968    /// Self-trade prevention mode for child orders.
8969    ///
8970    /// Field 22: `self_trade_prevention_mode`
8971    #[serde(
8972        rename = "selfTradePreventionMode",
8973        alias = "self_trade_prevention_mode",
8974        with = "::buffa::json_helpers::proto_enum",
8975        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8976    )]
8977    pub self_trade_prevention_mode: ::buffa::EnumValue<
8978        super::super::orders::v1::SelfTradePreventionMode,
8979    >,
8980    /// Client-provided trigger ID for idempotency and correlation.
8981    ///
8982    /// Field 60: `client_trigger_id`
8983    #[serde(
8984        rename = "clientTriggerId",
8985        alias = "client_trigger_id",
8986        with = "::buffa::json_helpers::proto_string",
8987        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
8988    )]
8989    pub client_trigger_id: ::buffa::alloc::string::String,
8990    /// Creation timestamp.
8991    ///
8992    /// Field 61: `created_at`
8993    #[serde(
8994        rename = "createdAt",
8995        alias = "created_at",
8996        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
8997    )]
8998    pub created_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
8999    /// Last update timestamp.
9000    ///
9001    /// Field 62: `updated_at`
9002    #[serde(
9003        rename = "updatedAt",
9004        alias = "updated_at",
9005        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9006    )]
9007    pub updated_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9008    /// Timestamp when the trigger became armed.
9009    ///
9010    /// Field 63: `armed_at`
9011    #[serde(
9012        rename = "armedAt",
9013        alias = "armed_at",
9014        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9015    )]
9016    pub armed_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9017    /// Timestamp when the trigger reached a terminal successful state.
9018    ///
9019    /// Field 64: `completed_at`
9020    #[serde(
9021        rename = "completedAt",
9022        alias = "completed_at",
9023        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9024    )]
9025    pub completed_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9026    /// Child orders spawned by this trigger.
9027    ///
9028    /// Field 70: `child_order_ids`
9029    #[serde(
9030        rename = "childOrderIds",
9031        alias = "child_order_ids",
9032        with = "::buffa::json_helpers::proto_seq",
9033        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
9034    )]
9035    pub child_order_ids: ::buffa::alloc::vec::Vec<u64>,
9036    #[serde(flatten)]
9037    pub configuration: ::core::option::Option<__buffa::oneof::trigger::Configuration>,
9038    #[serde(flatten)]
9039    pub runtime_details: ::core::option::Option<__buffa::oneof::trigger::RuntimeDetails>,
9040    #[serde(skip)]
9041    #[doc(hidden)]
9042    pub __buffa_unknown_fields: ::buffa::UnknownFields,
9043}
9044impl ::core::fmt::Debug for Trigger {
9045    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9046        f.debug_struct("Trigger")
9047            .field("trigger_id", &self.trigger_id)
9048            .field("subaccount_id", &self.subaccount_id)
9049            .field("symbol_id", &self.symbol_id)
9050            .field("symbol", &self.symbol)
9051            .field("status", &self.status)
9052            .field("parent_order_id", &self.parent_order_id)
9053            .field("qty_scaled", &self.qty_scaled)
9054            .field("fee_asset", &self.fee_asset)
9055            .field("self_trade_prevention_mode", &self.self_trade_prevention_mode)
9056            .field("client_trigger_id", &self.client_trigger_id)
9057            .field("created_at", &self.created_at)
9058            .field("updated_at", &self.updated_at)
9059            .field("armed_at", &self.armed_at)
9060            .field("completed_at", &self.completed_at)
9061            .field("child_order_ids", &self.child_order_ids)
9062            .field("configuration", &self.configuration)
9063            .field("runtime_details", &self.runtime_details)
9064            .finish()
9065    }
9066}
9067impl Trigger {
9068    /// Protobuf type URL for this message, for use with `Any::pack` and
9069    /// `Any::unpack_if`.
9070    ///
9071    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
9072    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
9073}
9074impl Trigger {
9075    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9076    #[inline]
9077    ///Sets [`Self::parent_order_id`] to `Some(value)`, consuming and returning `self`.
9078    pub fn with_parent_order_id(mut self, value: u64) -> Self {
9079        self.parent_order_id = Some(value);
9080        self
9081    }
9082}
9083::buffa::impl_default_instance!(Trigger);
9084impl ::buffa::MessageName for Trigger {
9085    const PACKAGE: &'static str = "triggers.v1";
9086    const NAME: &'static str = "Trigger";
9087    const FULL_NAME: &'static str = "triggers.v1.Trigger";
9088    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
9089}
9090impl ::buffa::Message for Trigger {
9091    /// Returns the total encoded size in bytes.
9092    ///
9093    /// The result is a `u32`; the protobuf specification requires all
9094    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
9095    /// compliant message will never overflow this type.
9096    #[allow(clippy::let_and_return)]
9097    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
9098        #[allow(unused_imports)]
9099        use ::buffa::Enumeration as _;
9100        let mut size = 0u32;
9101        if self.trigger_id != 0u64 {
9102            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9103        }
9104        if self.subaccount_id != 0u64 {
9105            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9106        }
9107        if self.symbol_id != 0u32 {
9108            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
9109        }
9110        if !self.symbol.is_empty() {
9111            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
9112        }
9113        {
9114            let val = self.status.to_i32();
9115            if val != 0 {
9116                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
9117            }
9118        }
9119        if self.parent_order_id.is_some() {
9120            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9121        }
9122        if self.qty_scaled != 0i64 {
9123            size += 2u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
9124        }
9125        {
9126            let val = self.fee_asset.to_i32();
9127            if val != 0 {
9128                size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
9129            }
9130        }
9131        {
9132            let val = self.self_trade_prevention_mode.to_i32();
9133            if val != 0 {
9134                size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
9135            }
9136        }
9137        if let ::core::option::Option::Some(ref v) = self.configuration {
9138            match v {
9139                __buffa::oneof::trigger::Configuration::StopLoss(x) => {
9140                    let __slot = __cache.reserve();
9141                    let inner = x.compute_size(__cache);
9142                    __cache.set(__slot, inner);
9143                    size
9144                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9145                            + inner;
9146                }
9147                __buffa::oneof::trigger::Configuration::TakeProfit(x) => {
9148                    let __slot = __cache.reserve();
9149                    let inner = x.compute_size(__cache);
9150                    __cache.set(__slot, inner);
9151                    size
9152                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9153                            + inner;
9154                }
9155                __buffa::oneof::trigger::Configuration::TrailingStop(x) => {
9156                    let __slot = __cache.reserve();
9157                    let inner = x.compute_size(__cache);
9158                    __cache.set(__slot, inner);
9159                    size
9160                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9161                            + inner;
9162                }
9163                __buffa::oneof::trigger::Configuration::Twap(x) => {
9164                    let __slot = __cache.reserve();
9165                    let inner = x.compute_size(__cache);
9166                    __cache.set(__slot, inner);
9167                    size
9168                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9169                            + inner;
9170                }
9171                __buffa::oneof::trigger::Configuration::Ladder(x) => {
9172                    let __slot = __cache.reserve();
9173                    let inner = x.compute_size(__cache);
9174                    __cache.set(__slot, inner);
9175                    size
9176                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9177                            + inner;
9178                }
9179            }
9180        }
9181        if !self.client_trigger_id.is_empty() {
9182            size
9183                += 2u32
9184                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
9185        }
9186        if self.created_at.is_set() {
9187            let __slot = __cache.reserve();
9188            let inner_size = self.created_at.compute_size(__cache);
9189            __cache.set(__slot, inner_size);
9190            size
9191                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9192                    + inner_size;
9193        }
9194        if self.updated_at.is_set() {
9195            let __slot = __cache.reserve();
9196            let inner_size = self.updated_at.compute_size(__cache);
9197            __cache.set(__slot, inner_size);
9198            size
9199                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9200                    + inner_size;
9201        }
9202        if self.armed_at.is_set() {
9203            let __slot = __cache.reserve();
9204            let inner_size = self.armed_at.compute_size(__cache);
9205            __cache.set(__slot, inner_size);
9206            size
9207                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9208                    + inner_size;
9209        }
9210        if self.completed_at.is_set() {
9211            let __slot = __cache.reserve();
9212            let inner_size = self.completed_at.compute_size(__cache);
9213            __cache.set(__slot, inner_size);
9214            size
9215                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9216                    + inner_size;
9217        }
9218        if !self.child_order_ids.is_empty() {
9219            let payload: u32 = self.child_order_ids.len() as u32
9220                * ::buffa::types::FIXED64_ENCODED_LEN as u32;
9221            size
9222                += 2u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
9223        }
9224        if let ::core::option::Option::Some(ref v) = self.runtime_details {
9225            match v {
9226                __buffa::oneof::trigger::RuntimeDetails::Stop(x) => {
9227                    let __slot = __cache.reserve();
9228                    let inner = x.compute_size(__cache);
9229                    __cache.set(__slot, inner);
9230                    size
9231                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9232                            + inner;
9233                }
9234                __buffa::oneof::trigger::RuntimeDetails::Trailing(x) => {
9235                    let __slot = __cache.reserve();
9236                    let inner = x.compute_size(__cache);
9237                    __cache.set(__slot, inner);
9238                    size
9239                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9240                            + inner;
9241                }
9242                __buffa::oneof::trigger::RuntimeDetails::TwapState(x) => {
9243                    let __slot = __cache.reserve();
9244                    let inner = x.compute_size(__cache);
9245                    __cache.set(__slot, inner);
9246                    size
9247                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9248                            + inner;
9249                }
9250                __buffa::oneof::trigger::RuntimeDetails::LadderState(x) => {
9251                    let __slot = __cache.reserve();
9252                    let inner = x.compute_size(__cache);
9253                    __cache.set(__slot, inner);
9254                    size
9255                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9256                            + inner;
9257                }
9258            }
9259        }
9260        size += self.__buffa_unknown_fields.encoded_len() as u32;
9261        size
9262    }
9263    fn write_to(
9264        &self,
9265        __cache: &mut ::buffa::SizeCache,
9266        buf: &mut impl ::buffa::bytes::BufMut,
9267    ) {
9268        #[allow(unused_imports)]
9269        use ::buffa::Enumeration as _;
9270        if self.trigger_id != 0u64 {
9271            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
9272        }
9273        if self.subaccount_id != 0u64 {
9274            ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
9275        }
9276        if self.symbol_id != 0u32 {
9277            ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
9278        }
9279        if !self.symbol.is_empty() {
9280            ::buffa::types::put_string_field(4u32, &self.symbol, buf);
9281        }
9282        {
9283            let val = self.status.to_i32();
9284            if val != 0 {
9285                ::buffa::types::put_int32_field(5u32, val, buf);
9286            }
9287        }
9288        if let Some(v) = self.parent_order_id {
9289            ::buffa::types::put_fixed64_field(6u32, v, buf);
9290        }
9291        if self.qty_scaled != 0i64 {
9292            ::buffa::types::put_int64_field(20u32, self.qty_scaled, buf);
9293        }
9294        {
9295            let val = self.fee_asset.to_i32();
9296            if val != 0 {
9297                ::buffa::types::put_int32_field(21u32, val, buf);
9298            }
9299        }
9300        {
9301            let val = self.self_trade_prevention_mode.to_i32();
9302            if val != 0 {
9303                ::buffa::types::put_int32_field(22u32, val, buf);
9304            }
9305        }
9306        if let ::core::option::Option::Some(ref v) = self.configuration {
9307            match v {
9308                __buffa::oneof::trigger::Configuration::StopLoss(x) => {
9309                    ::buffa::types::put_len_delimited_header(
9310                        30u32,
9311                        __cache.consume_next(),
9312                        buf,
9313                    );
9314                    x.write_to(__cache, buf);
9315                }
9316                __buffa::oneof::trigger::Configuration::TakeProfit(x) => {
9317                    ::buffa::types::put_len_delimited_header(
9318                        31u32,
9319                        __cache.consume_next(),
9320                        buf,
9321                    );
9322                    x.write_to(__cache, buf);
9323                }
9324                __buffa::oneof::trigger::Configuration::TrailingStop(x) => {
9325                    ::buffa::types::put_len_delimited_header(
9326                        32u32,
9327                        __cache.consume_next(),
9328                        buf,
9329                    );
9330                    x.write_to(__cache, buf);
9331                }
9332                __buffa::oneof::trigger::Configuration::Twap(x) => {
9333                    ::buffa::types::put_len_delimited_header(
9334                        33u32,
9335                        __cache.consume_next(),
9336                        buf,
9337                    );
9338                    x.write_to(__cache, buf);
9339                }
9340                __buffa::oneof::trigger::Configuration::Ladder(x) => {
9341                    ::buffa::types::put_len_delimited_header(
9342                        34u32,
9343                        __cache.consume_next(),
9344                        buf,
9345                    );
9346                    x.write_to(__cache, buf);
9347                }
9348            }
9349        }
9350        if !self.client_trigger_id.is_empty() {
9351            ::buffa::types::put_string_field(60u32, &self.client_trigger_id, buf);
9352        }
9353        if self.created_at.is_set() {
9354            ::buffa::types::put_len_delimited_header(61u32, __cache.consume_next(), buf);
9355            self.created_at.write_to(__cache, buf);
9356        }
9357        if self.updated_at.is_set() {
9358            ::buffa::types::put_len_delimited_header(62u32, __cache.consume_next(), buf);
9359            self.updated_at.write_to(__cache, buf);
9360        }
9361        if self.armed_at.is_set() {
9362            ::buffa::types::put_len_delimited_header(63u32, __cache.consume_next(), buf);
9363            self.armed_at.write_to(__cache, buf);
9364        }
9365        if self.completed_at.is_set() {
9366            ::buffa::types::put_len_delimited_header(64u32, __cache.consume_next(), buf);
9367            self.completed_at.write_to(__cache, buf);
9368        }
9369        if !self.child_order_ids.is_empty() {
9370            let payload: u32 = self.child_order_ids.len() as u32
9371                * ::buffa::types::FIXED64_ENCODED_LEN as u32;
9372            ::buffa::types::put_len_delimited_header(70u32, payload, buf);
9373            for &v in &self.child_order_ids {
9374                ::buffa::types::encode_fixed64(v, buf);
9375            }
9376        }
9377        if let ::core::option::Option::Some(ref v) = self.runtime_details {
9378            match v {
9379                __buffa::oneof::trigger::RuntimeDetails::Stop(x) => {
9380                    ::buffa::types::put_len_delimited_header(
9381                        100u32,
9382                        __cache.consume_next(),
9383                        buf,
9384                    );
9385                    x.write_to(__cache, buf);
9386                }
9387                __buffa::oneof::trigger::RuntimeDetails::Trailing(x) => {
9388                    ::buffa::types::put_len_delimited_header(
9389                        101u32,
9390                        __cache.consume_next(),
9391                        buf,
9392                    );
9393                    x.write_to(__cache, buf);
9394                }
9395                __buffa::oneof::trigger::RuntimeDetails::TwapState(x) => {
9396                    ::buffa::types::put_len_delimited_header(
9397                        102u32,
9398                        __cache.consume_next(),
9399                        buf,
9400                    );
9401                    x.write_to(__cache, buf);
9402                }
9403                __buffa::oneof::trigger::RuntimeDetails::LadderState(x) => {
9404                    ::buffa::types::put_len_delimited_header(
9405                        103u32,
9406                        __cache.consume_next(),
9407                        buf,
9408                    );
9409                    x.write_to(__cache, buf);
9410                }
9411            }
9412        }
9413        self.__buffa_unknown_fields.write_to(buf);
9414    }
9415    fn merge_field(
9416        &mut self,
9417        tag: ::buffa::encoding::Tag,
9418        buf: &mut impl ::buffa::bytes::Buf,
9419        ctx: ::buffa::DecodeContext<'_>,
9420    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
9421        #[allow(unused_imports)]
9422        use ::buffa::bytes::Buf as _;
9423        #[allow(unused_imports)]
9424        use ::buffa::Enumeration as _;
9425        match tag.field_number() {
9426            1u32 => {
9427                ::buffa::encoding::check_wire_type(
9428                    tag,
9429                    ::buffa::encoding::WireType::Fixed64,
9430                )?;
9431                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
9432            }
9433            2u32 => {
9434                ::buffa::encoding::check_wire_type(
9435                    tag,
9436                    ::buffa::encoding::WireType::Fixed64,
9437                )?;
9438                self.subaccount_id = ::buffa::types::decode_fixed64(buf)?;
9439            }
9440            3u32 => {
9441                ::buffa::encoding::check_wire_type(
9442                    tag,
9443                    ::buffa::encoding::WireType::Varint,
9444                )?;
9445                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
9446            }
9447            4u32 => {
9448                ::buffa::encoding::check_wire_type(
9449                    tag,
9450                    ::buffa::encoding::WireType::LengthDelimited,
9451                )?;
9452                ::buffa::types::merge_string(&mut self.symbol, buf)?;
9453            }
9454            5u32 => {
9455                ::buffa::encoding::check_wire_type(
9456                    tag,
9457                    ::buffa::encoding::WireType::Varint,
9458                )?;
9459                self.status = ::buffa::EnumValue::from(
9460                    ::buffa::types::decode_int32(buf)?,
9461                );
9462            }
9463            6u32 => {
9464                ::buffa::encoding::check_wire_type(
9465                    tag,
9466                    ::buffa::encoding::WireType::Fixed64,
9467                )?;
9468                self.parent_order_id = ::core::option::Option::Some(
9469                    ::buffa::types::decode_fixed64(buf)?,
9470                );
9471            }
9472            20u32 => {
9473                ::buffa::encoding::check_wire_type(
9474                    tag,
9475                    ::buffa::encoding::WireType::Varint,
9476                )?;
9477                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
9478            }
9479            21u32 => {
9480                ::buffa::encoding::check_wire_type(
9481                    tag,
9482                    ::buffa::encoding::WireType::Varint,
9483                )?;
9484                self.fee_asset = ::buffa::EnumValue::from(
9485                    ::buffa::types::decode_int32(buf)?,
9486                );
9487            }
9488            22u32 => {
9489                ::buffa::encoding::check_wire_type(
9490                    tag,
9491                    ::buffa::encoding::WireType::Varint,
9492                )?;
9493                self.self_trade_prevention_mode = ::buffa::EnumValue::from(
9494                    ::buffa::types::decode_int32(buf)?,
9495                );
9496            }
9497            30u32 => {
9498                ::buffa::encoding::check_wire_type(
9499                    tag,
9500                    ::buffa::encoding::WireType::LengthDelimited,
9501                )?;
9502                if let ::core::option::Option::Some(
9503                    __buffa::oneof::trigger::Configuration::StopLoss(ref mut existing),
9504                ) = self.configuration
9505                {
9506                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9507                } else {
9508                    let mut val = ::core::default::Default::default();
9509                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9510                    self.configuration = ::core::option::Option::Some(
9511                        __buffa::oneof::trigger::Configuration::StopLoss(
9512                            ::buffa::alloc::boxed::Box::new(val),
9513                        ),
9514                    );
9515                }
9516            }
9517            31u32 => {
9518                ::buffa::encoding::check_wire_type(
9519                    tag,
9520                    ::buffa::encoding::WireType::LengthDelimited,
9521                )?;
9522                if let ::core::option::Option::Some(
9523                    __buffa::oneof::trigger::Configuration::TakeProfit(ref mut existing),
9524                ) = self.configuration
9525                {
9526                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9527                } else {
9528                    let mut val = ::core::default::Default::default();
9529                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9530                    self.configuration = ::core::option::Option::Some(
9531                        __buffa::oneof::trigger::Configuration::TakeProfit(
9532                            ::buffa::alloc::boxed::Box::new(val),
9533                        ),
9534                    );
9535                }
9536            }
9537            32u32 => {
9538                ::buffa::encoding::check_wire_type(
9539                    tag,
9540                    ::buffa::encoding::WireType::LengthDelimited,
9541                )?;
9542                if let ::core::option::Option::Some(
9543                    __buffa::oneof::trigger::Configuration::TrailingStop(
9544                        ref mut existing,
9545                    ),
9546                ) = self.configuration
9547                {
9548                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9549                } else {
9550                    let mut val = ::core::default::Default::default();
9551                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9552                    self.configuration = ::core::option::Option::Some(
9553                        __buffa::oneof::trigger::Configuration::TrailingStop(
9554                            ::buffa::alloc::boxed::Box::new(val),
9555                        ),
9556                    );
9557                }
9558            }
9559            33u32 => {
9560                ::buffa::encoding::check_wire_type(
9561                    tag,
9562                    ::buffa::encoding::WireType::LengthDelimited,
9563                )?;
9564                if let ::core::option::Option::Some(
9565                    __buffa::oneof::trigger::Configuration::Twap(ref mut existing),
9566                ) = self.configuration
9567                {
9568                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9569                } else {
9570                    let mut val = ::core::default::Default::default();
9571                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9572                    self.configuration = ::core::option::Option::Some(
9573                        __buffa::oneof::trigger::Configuration::Twap(
9574                            ::buffa::alloc::boxed::Box::new(val),
9575                        ),
9576                    );
9577                }
9578            }
9579            34u32 => {
9580                ::buffa::encoding::check_wire_type(
9581                    tag,
9582                    ::buffa::encoding::WireType::LengthDelimited,
9583                )?;
9584                if let ::core::option::Option::Some(
9585                    __buffa::oneof::trigger::Configuration::Ladder(ref mut existing),
9586                ) = self.configuration
9587                {
9588                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9589                } else {
9590                    let mut val = ::core::default::Default::default();
9591                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9592                    self.configuration = ::core::option::Option::Some(
9593                        __buffa::oneof::trigger::Configuration::Ladder(
9594                            ::buffa::alloc::boxed::Box::new(val),
9595                        ),
9596                    );
9597                }
9598            }
9599            60u32 => {
9600                ::buffa::encoding::check_wire_type(
9601                    tag,
9602                    ::buffa::encoding::WireType::LengthDelimited,
9603                )?;
9604                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
9605            }
9606            61u32 => {
9607                ::buffa::encoding::check_wire_type(
9608                    tag,
9609                    ::buffa::encoding::WireType::LengthDelimited,
9610                )?;
9611                ::buffa::Message::merge_length_delimited(
9612                    self.created_at.get_or_insert_default(),
9613                    buf,
9614                    ctx,
9615                )?;
9616            }
9617            62u32 => {
9618                ::buffa::encoding::check_wire_type(
9619                    tag,
9620                    ::buffa::encoding::WireType::LengthDelimited,
9621                )?;
9622                ::buffa::Message::merge_length_delimited(
9623                    self.updated_at.get_or_insert_default(),
9624                    buf,
9625                    ctx,
9626                )?;
9627            }
9628            63u32 => {
9629                ::buffa::encoding::check_wire_type(
9630                    tag,
9631                    ::buffa::encoding::WireType::LengthDelimited,
9632                )?;
9633                ::buffa::Message::merge_length_delimited(
9634                    self.armed_at.get_or_insert_default(),
9635                    buf,
9636                    ctx,
9637                )?;
9638            }
9639            64u32 => {
9640                ::buffa::encoding::check_wire_type(
9641                    tag,
9642                    ::buffa::encoding::WireType::LengthDelimited,
9643                )?;
9644                ::buffa::Message::merge_length_delimited(
9645                    self.completed_at.get_or_insert_default(),
9646                    buf,
9647                    ctx,
9648                )?;
9649            }
9650            70u32 => {
9651                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
9652                    let len = ::buffa::encoding::decode_varint(buf)?;
9653                    let len = usize::try_from(len)
9654                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
9655                    if buf.remaining() < len {
9656                        return ::core::result::Result::Err(
9657                            ::buffa::DecodeError::UnexpectedEof,
9658                        );
9659                    }
9660                    self.child_order_ids.reserve(len / 8usize);
9661                    let mut limited = buf.take(len);
9662                    while limited.has_remaining() {
9663                        self.child_order_ids
9664                            .push(::buffa::types::decode_fixed64(&mut limited)?);
9665                    }
9666                    let leftover = limited.remaining();
9667                    if leftover > 0 {
9668                        limited.advance(leftover);
9669                    }
9670                } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 {
9671                    self.child_order_ids.push(::buffa::types::decode_fixed64(buf)?);
9672                } else {
9673                    return ::core::result::Result::Err(
9674                        ::buffa::encoding::wire_type_mismatch(
9675                            tag,
9676                            ::buffa::encoding::WireType::LengthDelimited,
9677                        ),
9678                    );
9679                }
9680            }
9681            100u32 => {
9682                ::buffa::encoding::check_wire_type(
9683                    tag,
9684                    ::buffa::encoding::WireType::LengthDelimited,
9685                )?;
9686                if let ::core::option::Option::Some(
9687                    __buffa::oneof::trigger::RuntimeDetails::Stop(ref mut existing),
9688                ) = self.runtime_details
9689                {
9690                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9691                } else {
9692                    let mut val = ::core::default::Default::default();
9693                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9694                    self.runtime_details = ::core::option::Option::Some(
9695                        __buffa::oneof::trigger::RuntimeDetails::Stop(
9696                            ::buffa::alloc::boxed::Box::new(val),
9697                        ),
9698                    );
9699                }
9700            }
9701            101u32 => {
9702                ::buffa::encoding::check_wire_type(
9703                    tag,
9704                    ::buffa::encoding::WireType::LengthDelimited,
9705                )?;
9706                if let ::core::option::Option::Some(
9707                    __buffa::oneof::trigger::RuntimeDetails::Trailing(ref mut existing),
9708                ) = self.runtime_details
9709                {
9710                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9711                } else {
9712                    let mut val = ::core::default::Default::default();
9713                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9714                    self.runtime_details = ::core::option::Option::Some(
9715                        __buffa::oneof::trigger::RuntimeDetails::Trailing(
9716                            ::buffa::alloc::boxed::Box::new(val),
9717                        ),
9718                    );
9719                }
9720            }
9721            102u32 => {
9722                ::buffa::encoding::check_wire_type(
9723                    tag,
9724                    ::buffa::encoding::WireType::LengthDelimited,
9725                )?;
9726                if let ::core::option::Option::Some(
9727                    __buffa::oneof::trigger::RuntimeDetails::TwapState(ref mut existing),
9728                ) = self.runtime_details
9729                {
9730                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9731                } else {
9732                    let mut val = ::core::default::Default::default();
9733                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9734                    self.runtime_details = ::core::option::Option::Some(
9735                        __buffa::oneof::trigger::RuntimeDetails::TwapState(
9736                            ::buffa::alloc::boxed::Box::new(val),
9737                        ),
9738                    );
9739                }
9740            }
9741            103u32 => {
9742                ::buffa::encoding::check_wire_type(
9743                    tag,
9744                    ::buffa::encoding::WireType::LengthDelimited,
9745                )?;
9746                if let ::core::option::Option::Some(
9747                    __buffa::oneof::trigger::RuntimeDetails::LadderState(
9748                        ref mut existing,
9749                    ),
9750                ) = self.runtime_details
9751                {
9752                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9753                } else {
9754                    let mut val = ::core::default::Default::default();
9755                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9756                    self.runtime_details = ::core::option::Option::Some(
9757                        __buffa::oneof::trigger::RuntimeDetails::LadderState(
9758                            ::buffa::alloc::boxed::Box::new(val),
9759                        ),
9760                    );
9761                }
9762            }
9763            _ => {
9764                self.__buffa_unknown_fields
9765                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
9766            }
9767        }
9768        ::core::result::Result::Ok(())
9769    }
9770    fn clear(&mut self) {
9771        self.trigger_id = 0u64;
9772        self.subaccount_id = 0u64;
9773        self.symbol_id = 0u32;
9774        self.symbol.clear();
9775        self.status = ::buffa::EnumValue::from(0);
9776        self.parent_order_id = ::core::option::Option::None;
9777        self.qty_scaled = 0i64;
9778        self.fee_asset = ::buffa::EnumValue::from(0);
9779        self.self_trade_prevention_mode = ::buffa::EnumValue::from(0);
9780        self.configuration = ::core::option::Option::None;
9781        self.client_trigger_id.clear();
9782        self.created_at = ::buffa::MessageField::none();
9783        self.updated_at = ::buffa::MessageField::none();
9784        self.armed_at = ::buffa::MessageField::none();
9785        self.completed_at = ::buffa::MessageField::none();
9786        self.child_order_ids.clear();
9787        self.runtime_details = ::core::option::Option::None;
9788        self.__buffa_unknown_fields.clear();
9789    }
9790}
9791impl ::buffa::ExtensionSet for Trigger {
9792    const PROTO_FQN: &'static str = "triggers.v1.Trigger";
9793    fn unknown_fields(&self) -> &::buffa::UnknownFields {
9794        &self.__buffa_unknown_fields
9795    }
9796    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
9797        &mut self.__buffa_unknown_fields
9798    }
9799}
9800impl<'de> serde::Deserialize<'de> for Trigger {
9801    fn deserialize<D: serde::Deserializer<'de>>(
9802        d: D,
9803    ) -> ::core::result::Result<Self, D::Error> {
9804        struct _V;
9805        impl<'de> serde::de::Visitor<'de> for _V {
9806            type Value = Trigger;
9807            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9808                f.write_str("struct Trigger")
9809            }
9810            #[allow(clippy::field_reassign_with_default)]
9811            fn visit_map<A: serde::de::MapAccess<'de>>(
9812                self,
9813                mut map: A,
9814            ) -> ::core::result::Result<Trigger, A::Error> {
9815                let mut __f_trigger_id: ::core::option::Option<u64> = None;
9816                let mut __f_subaccount_id: ::core::option::Option<u64> = None;
9817                let mut __f_symbol_id: ::core::option::Option<u32> = None;
9818                let mut __f_symbol: ::core::option::Option<
9819                    ::buffa::alloc::string::String,
9820                > = None;
9821                let mut __f_status: ::core::option::Option<
9822                    ::buffa::EnumValue<TriggerStatus>,
9823                > = None;
9824                let mut __f_parent_order_id: ::core::option::Option<
9825                    ::core::option::Option<u64>,
9826                > = None;
9827                let mut __f_qty_scaled: ::core::option::Option<i64> = None;
9828                let mut __f_fee_asset: ::core::option::Option<
9829                    ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
9830                > = None;
9831                let mut __f_self_trade_prevention_mode: ::core::option::Option<
9832                    ::buffa::EnumValue<super::super::orders::v1::SelfTradePreventionMode>,
9833                > = None;
9834                let mut __f_client_trigger_id: ::core::option::Option<
9835                    ::buffa::alloc::string::String,
9836                > = None;
9837                let mut __f_created_at: ::core::option::Option<
9838                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9839                > = None;
9840                let mut __f_updated_at: ::core::option::Option<
9841                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9842                > = None;
9843                let mut __f_armed_at: ::core::option::Option<
9844                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9845                > = None;
9846                let mut __f_completed_at: ::core::option::Option<
9847                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9848                > = None;
9849                let mut __f_child_order_ids: ::core::option::Option<
9850                    ::buffa::alloc::vec::Vec<u64>,
9851                > = None;
9852                let mut __oneof_configuration: ::core::option::Option<
9853                    __buffa::oneof::trigger::Configuration,
9854                > = None;
9855                let mut __oneof_runtime_details: ::core::option::Option<
9856                    __buffa::oneof::trigger::RuntimeDetails,
9857                > = None;
9858                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
9859                    match key.as_str() {
9860                        "triggerId" | "trigger_id" => {
9861                            __f_trigger_id = Some({
9862                                struct _S;
9863                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9864                                    type Value = u64;
9865                                    fn deserialize<D: serde::Deserializer<'de>>(
9866                                        self,
9867                                        d: D,
9868                                    ) -> ::core::result::Result<u64, D::Error> {
9869                                        ::buffa::json_helpers::uint64::deserialize(d)
9870                                    }
9871                                }
9872                                map.next_value_seed(_S)?
9873                            });
9874                        }
9875                        "subaccountId" | "subaccount_id" => {
9876                            __f_subaccount_id = Some({
9877                                struct _S;
9878                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9879                                    type Value = u64;
9880                                    fn deserialize<D: serde::Deserializer<'de>>(
9881                                        self,
9882                                        d: D,
9883                                    ) -> ::core::result::Result<u64, D::Error> {
9884                                        ::buffa::json_helpers::uint64::deserialize(d)
9885                                    }
9886                                }
9887                                map.next_value_seed(_S)?
9888                            });
9889                        }
9890                        "symbolId" | "symbol_id" => {
9891                            __f_symbol_id = Some({
9892                                struct _S;
9893                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9894                                    type Value = u32;
9895                                    fn deserialize<D: serde::Deserializer<'de>>(
9896                                        self,
9897                                        d: D,
9898                                    ) -> ::core::result::Result<u32, D::Error> {
9899                                        ::buffa::json_helpers::uint32::deserialize(d)
9900                                    }
9901                                }
9902                                map.next_value_seed(_S)?
9903                            });
9904                        }
9905                        "symbol" => {
9906                            __f_symbol = Some({
9907                                struct _S;
9908                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9909                                    type Value = ::buffa::alloc::string::String;
9910                                    fn deserialize<D: serde::Deserializer<'de>>(
9911                                        self,
9912                                        d: D,
9913                                    ) -> ::core::result::Result<
9914                                        ::buffa::alloc::string::String,
9915                                        D::Error,
9916                                    > {
9917                                        ::buffa::json_helpers::proto_string::deserialize(d)
9918                                    }
9919                                }
9920                                map.next_value_seed(_S)?
9921                            });
9922                        }
9923                        "status" => {
9924                            __f_status = Some({
9925                                struct _S;
9926                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9927                                    type Value = ::buffa::EnumValue<TriggerStatus>;
9928                                    fn deserialize<D: serde::Deserializer<'de>>(
9929                                        self,
9930                                        d: D,
9931                                    ) -> ::core::result::Result<
9932                                        ::buffa::EnumValue<TriggerStatus>,
9933                                        D::Error,
9934                                    > {
9935                                        ::buffa::json_helpers::proto_enum::deserialize(d)
9936                                    }
9937                                }
9938                                map.next_value_seed(_S)?
9939                            });
9940                        }
9941                        "parentOrderId" | "parent_order_id" => {
9942                            __f_parent_order_id = Some({
9943                                struct _S;
9944                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9945                                    type Value = ::core::option::Option<u64>;
9946                                    fn deserialize<D: serde::Deserializer<'de>>(
9947                                        self,
9948                                        d: D,
9949                                    ) -> ::core::result::Result<
9950                                        ::core::option::Option<u64>,
9951                                        D::Error,
9952                                    > {
9953                                        ::buffa::json_helpers::opt_uint64::deserialize(d)
9954                                    }
9955                                }
9956                                map.next_value_seed(_S)?
9957                            });
9958                        }
9959                        "qtyScaled" | "qty_scaled" => {
9960                            __f_qty_scaled = Some({
9961                                struct _S;
9962                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9963                                    type Value = i64;
9964                                    fn deserialize<D: serde::Deserializer<'de>>(
9965                                        self,
9966                                        d: D,
9967                                    ) -> ::core::result::Result<i64, D::Error> {
9968                                        ::buffa::json_helpers::int64::deserialize(d)
9969                                    }
9970                                }
9971                                map.next_value_seed(_S)?
9972                            });
9973                        }
9974                        "feeAsset" | "fee_asset" => {
9975                            __f_fee_asset = Some({
9976                                struct _S;
9977                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9978                                    type Value = ::buffa::EnumValue<
9979                                        super::super::orders::v1::FeeAsset,
9980                                    >;
9981                                    fn deserialize<D: serde::Deserializer<'de>>(
9982                                        self,
9983                                        d: D,
9984                                    ) -> ::core::result::Result<
9985                                        ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
9986                                        D::Error,
9987                                    > {
9988                                        ::buffa::json_helpers::proto_enum::deserialize(d)
9989                                    }
9990                                }
9991                                map.next_value_seed(_S)?
9992                            });
9993                        }
9994                        "selfTradePreventionMode" | "self_trade_prevention_mode" => {
9995                            __f_self_trade_prevention_mode = Some({
9996                                struct _S;
9997                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9998                                    type Value = ::buffa::EnumValue<
9999                                        super::super::orders::v1::SelfTradePreventionMode,
10000                                    >;
10001                                    fn deserialize<D: serde::Deserializer<'de>>(
10002                                        self,
10003                                        d: D,
10004                                    ) -> ::core::result::Result<
10005                                        ::buffa::EnumValue<
10006                                            super::super::orders::v1::SelfTradePreventionMode,
10007                                        >,
10008                                        D::Error,
10009                                    > {
10010                                        ::buffa::json_helpers::proto_enum::deserialize(d)
10011                                    }
10012                                }
10013                                map.next_value_seed(_S)?
10014                            });
10015                        }
10016                        "clientTriggerId" | "client_trigger_id" => {
10017                            __f_client_trigger_id = Some({
10018                                struct _S;
10019                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10020                                    type Value = ::buffa::alloc::string::String;
10021                                    fn deserialize<D: serde::Deserializer<'de>>(
10022                                        self,
10023                                        d: D,
10024                                    ) -> ::core::result::Result<
10025                                        ::buffa::alloc::string::String,
10026                                        D::Error,
10027                                    > {
10028                                        ::buffa::json_helpers::proto_string::deserialize(d)
10029                                    }
10030                                }
10031                                map.next_value_seed(_S)?
10032                            });
10033                        }
10034                        "createdAt" | "created_at" => {
10035                            __f_created_at = Some(
10036                                map
10037                                    .next_value::<
10038                                        ::buffa::MessageField<
10039                                            ::buffa_types::google::protobuf::Timestamp,
10040                                        >,
10041                                    >()?,
10042                            );
10043                        }
10044                        "updatedAt" | "updated_at" => {
10045                            __f_updated_at = Some(
10046                                map
10047                                    .next_value::<
10048                                        ::buffa::MessageField<
10049                                            ::buffa_types::google::protobuf::Timestamp,
10050                                        >,
10051                                    >()?,
10052                            );
10053                        }
10054                        "armedAt" | "armed_at" => {
10055                            __f_armed_at = Some(
10056                                map
10057                                    .next_value::<
10058                                        ::buffa::MessageField<
10059                                            ::buffa_types::google::protobuf::Timestamp,
10060                                        >,
10061                                    >()?,
10062                            );
10063                        }
10064                        "completedAt" | "completed_at" => {
10065                            __f_completed_at = Some(
10066                                map
10067                                    .next_value::<
10068                                        ::buffa::MessageField<
10069                                            ::buffa_types::google::protobuf::Timestamp,
10070                                        >,
10071                                    >()?,
10072                            );
10073                        }
10074                        "childOrderIds" | "child_order_ids" => {
10075                            __f_child_order_ids = Some({
10076                                struct _S;
10077                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10078                                    type Value = ::buffa::alloc::vec::Vec<u64>;
10079                                    fn deserialize<D: serde::Deserializer<'de>>(
10080                                        self,
10081                                        d: D,
10082                                    ) -> ::core::result::Result<
10083                                        ::buffa::alloc::vec::Vec<u64>,
10084                                        D::Error,
10085                                    > {
10086                                        ::buffa::json_helpers::proto_seq::deserialize(d)
10087                                    }
10088                                }
10089                                map.next_value_seed(_S)?
10090                            });
10091                        }
10092                        "stopLoss" | "stop_loss" => {
10093                            let v: ::core::option::Option<ConditionalTrigger> = map
10094                                .next_value_seed(
10095                                    ::buffa::json_helpers::NullableDeserializeSeed(
10096                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10097                                            ConditionalTrigger,
10098                                        >::new(),
10099                                    ),
10100                                )?;
10101                            if let Some(v) = v {
10102                                if __oneof_configuration.is_some() {
10103                                    return Err(
10104                                        serde::de::Error::custom(
10105                                            "multiple oneof fields set for 'configuration'",
10106                                        ),
10107                                    );
10108                                }
10109                                __oneof_configuration = Some(
10110                                    __buffa::oneof::trigger::Configuration::StopLoss(
10111                                        ::buffa::alloc::boxed::Box::new(v),
10112                                    ),
10113                                );
10114                            }
10115                        }
10116                        "takeProfit" | "take_profit" => {
10117                            let v: ::core::option::Option<ConditionalTrigger> = map
10118                                .next_value_seed(
10119                                    ::buffa::json_helpers::NullableDeserializeSeed(
10120                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10121                                            ConditionalTrigger,
10122                                        >::new(),
10123                                    ),
10124                                )?;
10125                            if let Some(v) = v {
10126                                if __oneof_configuration.is_some() {
10127                                    return Err(
10128                                        serde::de::Error::custom(
10129                                            "multiple oneof fields set for 'configuration'",
10130                                        ),
10131                                    );
10132                                }
10133                                __oneof_configuration = Some(
10134                                    __buffa::oneof::trigger::Configuration::TakeProfit(
10135                                        ::buffa::alloc::boxed::Box::new(v),
10136                                    ),
10137                                );
10138                            }
10139                        }
10140                        "trailingStop" | "trailing_stop" => {
10141                            let v: ::core::option::Option<TrailingStopTrigger> = map
10142                                .next_value_seed(
10143                                    ::buffa::json_helpers::NullableDeserializeSeed(
10144                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10145                                            TrailingStopTrigger,
10146                                        >::new(),
10147                                    ),
10148                                )?;
10149                            if let Some(v) = v {
10150                                if __oneof_configuration.is_some() {
10151                                    return Err(
10152                                        serde::de::Error::custom(
10153                                            "multiple oneof fields set for 'configuration'",
10154                                        ),
10155                                    );
10156                                }
10157                                __oneof_configuration = Some(
10158                                    __buffa::oneof::trigger::Configuration::TrailingStop(
10159                                        ::buffa::alloc::boxed::Box::new(v),
10160                                    ),
10161                                );
10162                            }
10163                        }
10164                        "twap" => {
10165                            let v: ::core::option::Option<TwapTrigger> = map
10166                                .next_value_seed(
10167                                    ::buffa::json_helpers::NullableDeserializeSeed(
10168                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10169                                            TwapTrigger,
10170                                        >::new(),
10171                                    ),
10172                                )?;
10173                            if let Some(v) = v {
10174                                if __oneof_configuration.is_some() {
10175                                    return Err(
10176                                        serde::de::Error::custom(
10177                                            "multiple oneof fields set for 'configuration'",
10178                                        ),
10179                                    );
10180                                }
10181                                __oneof_configuration = Some(
10182                                    __buffa::oneof::trigger::Configuration::Twap(
10183                                        ::buffa::alloc::boxed::Box::new(v),
10184                                    ),
10185                                );
10186                            }
10187                        }
10188                        "ladder" => {
10189                            let v: ::core::option::Option<LadderTrigger> = map
10190                                .next_value_seed(
10191                                    ::buffa::json_helpers::NullableDeserializeSeed(
10192                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10193                                            LadderTrigger,
10194                                        >::new(),
10195                                    ),
10196                                )?;
10197                            if let Some(v) = v {
10198                                if __oneof_configuration.is_some() {
10199                                    return Err(
10200                                        serde::de::Error::custom(
10201                                            "multiple oneof fields set for 'configuration'",
10202                                        ),
10203                                    );
10204                                }
10205                                __oneof_configuration = Some(
10206                                    __buffa::oneof::trigger::Configuration::Ladder(
10207                                        ::buffa::alloc::boxed::Box::new(v),
10208                                    ),
10209                                );
10210                            }
10211                        }
10212                        "stop" => {
10213                            let v: ::core::option::Option<StopDetails> = map
10214                                .next_value_seed(
10215                                    ::buffa::json_helpers::NullableDeserializeSeed(
10216                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10217                                            StopDetails,
10218                                        >::new(),
10219                                    ),
10220                                )?;
10221                            if let Some(v) = v {
10222                                if __oneof_runtime_details.is_some() {
10223                                    return Err(
10224                                        serde::de::Error::custom(
10225                                            "multiple oneof fields set for 'runtime_details'",
10226                                        ),
10227                                    );
10228                                }
10229                                __oneof_runtime_details = Some(
10230                                    __buffa::oneof::trigger::RuntimeDetails::Stop(
10231                                        ::buffa::alloc::boxed::Box::new(v),
10232                                    ),
10233                                );
10234                            }
10235                        }
10236                        "trailing" => {
10237                            let v: ::core::option::Option<TrailingDetails> = map
10238                                .next_value_seed(
10239                                    ::buffa::json_helpers::NullableDeserializeSeed(
10240                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10241                                            TrailingDetails,
10242                                        >::new(),
10243                                    ),
10244                                )?;
10245                            if let Some(v) = v {
10246                                if __oneof_runtime_details.is_some() {
10247                                    return Err(
10248                                        serde::de::Error::custom(
10249                                            "multiple oneof fields set for 'runtime_details'",
10250                                        ),
10251                                    );
10252                                }
10253                                __oneof_runtime_details = Some(
10254                                    __buffa::oneof::trigger::RuntimeDetails::Trailing(
10255                                        ::buffa::alloc::boxed::Box::new(v),
10256                                    ),
10257                                );
10258                            }
10259                        }
10260                        "twapState" | "twap_state" => {
10261                            let v: ::core::option::Option<TwapDetails> = map
10262                                .next_value_seed(
10263                                    ::buffa::json_helpers::NullableDeserializeSeed(
10264                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10265                                            TwapDetails,
10266                                        >::new(),
10267                                    ),
10268                                )?;
10269                            if let Some(v) = v {
10270                                if __oneof_runtime_details.is_some() {
10271                                    return Err(
10272                                        serde::de::Error::custom(
10273                                            "multiple oneof fields set for 'runtime_details'",
10274                                        ),
10275                                    );
10276                                }
10277                                __oneof_runtime_details = Some(
10278                                    __buffa::oneof::trigger::RuntimeDetails::TwapState(
10279                                        ::buffa::alloc::boxed::Box::new(v),
10280                                    ),
10281                                );
10282                            }
10283                        }
10284                        "ladderState" | "ladder_state" => {
10285                            let v: ::core::option::Option<LadderDetails> = map
10286                                .next_value_seed(
10287                                    ::buffa::json_helpers::NullableDeserializeSeed(
10288                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10289                                            LadderDetails,
10290                                        >::new(),
10291                                    ),
10292                                )?;
10293                            if let Some(v) = v {
10294                                if __oneof_runtime_details.is_some() {
10295                                    return Err(
10296                                        serde::de::Error::custom(
10297                                            "multiple oneof fields set for 'runtime_details'",
10298                                        ),
10299                                    );
10300                                }
10301                                __oneof_runtime_details = Some(
10302                                    __buffa::oneof::trigger::RuntimeDetails::LadderState(
10303                                        ::buffa::alloc::boxed::Box::new(v),
10304                                    ),
10305                                );
10306                            }
10307                        }
10308                        _ => {
10309                            map.next_value::<serde::de::IgnoredAny>()?;
10310                        }
10311                    }
10312                }
10313                let mut __r = <Trigger as ::core::default::Default>::default();
10314                if let ::core::option::Option::Some(v) = __f_trigger_id {
10315                    __r.trigger_id = v;
10316                }
10317                if let ::core::option::Option::Some(v) = __f_subaccount_id {
10318                    __r.subaccount_id = v;
10319                }
10320                if let ::core::option::Option::Some(v) = __f_symbol_id {
10321                    __r.symbol_id = v;
10322                }
10323                if let ::core::option::Option::Some(v) = __f_symbol {
10324                    __r.symbol = v;
10325                }
10326                if let ::core::option::Option::Some(v) = __f_status {
10327                    __r.status = v;
10328                }
10329                if let ::core::option::Option::Some(v) = __f_parent_order_id {
10330                    __r.parent_order_id = v;
10331                }
10332                if let ::core::option::Option::Some(v) = __f_qty_scaled {
10333                    __r.qty_scaled = v;
10334                }
10335                if let ::core::option::Option::Some(v) = __f_fee_asset {
10336                    __r.fee_asset = v;
10337                }
10338                if let ::core::option::Option::Some(v) = __f_self_trade_prevention_mode {
10339                    __r.self_trade_prevention_mode = v;
10340                }
10341                if let ::core::option::Option::Some(v) = __f_client_trigger_id {
10342                    __r.client_trigger_id = v;
10343                }
10344                if let ::core::option::Option::Some(v) = __f_created_at {
10345                    __r.created_at = v;
10346                }
10347                if let ::core::option::Option::Some(v) = __f_updated_at {
10348                    __r.updated_at = v;
10349                }
10350                if let ::core::option::Option::Some(v) = __f_armed_at {
10351                    __r.armed_at = v;
10352                }
10353                if let ::core::option::Option::Some(v) = __f_completed_at {
10354                    __r.completed_at = v;
10355                }
10356                if let ::core::option::Option::Some(v) = __f_child_order_ids {
10357                    __r.child_order_ids = v;
10358                }
10359                __r.configuration = __oneof_configuration;
10360                __r.runtime_details = __oneof_runtime_details;
10361                Ok(__r)
10362            }
10363        }
10364        d.deserialize_map(_V)
10365    }
10366}
10367impl ::buffa::json_helpers::ProtoElemJson for Trigger {
10368    fn serialize_proto_json<S: ::serde::Serializer>(
10369        v: &Self,
10370        s: S,
10371    ) -> ::core::result::Result<S::Ok, S::Error> {
10372        ::serde::Serialize::serialize(v, s)
10373    }
10374    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
10375        d: D,
10376    ) -> ::core::result::Result<Self, D::Error> {
10377        <Self as ::serde::Deserialize>::deserialize(d)
10378    }
10379}
10380#[doc(hidden)]
10381pub const __TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
10382    type_url: "type.googleapis.com/triggers.v1.Trigger",
10383    to_json: ::buffa::type_registry::any_to_json::<Trigger>,
10384    from_json: ::buffa::type_registry::any_from_json::<Trigger>,
10385    is_wkt: false,
10386};
10387pub mod trigger {
10388    #[allow(unused_imports)]
10389    use super::*;
10390    #[doc(inline)]
10391    pub use super::__buffa::oneof::trigger::Configuration;
10392    #[doc(inline)]
10393    pub use super::__buffa::oneof::trigger::RuntimeDetails;
10394    #[doc(inline)]
10395    pub use super::__buffa::view::oneof::trigger::Configuration as ConfigurationView;
10396    #[doc(inline)]
10397    pub use super::__buffa::view::oneof::trigger::RuntimeDetails as RuntimeDetailsView;
10398}
10399#[allow(
10400    non_camel_case_types,
10401    dead_code,
10402    unused_imports,
10403    unused_qualifications,
10404    clippy::derivable_impls,
10405    clippy::match_single_binding,
10406    clippy::uninlined_format_args,
10407    clippy::doc_lazy_continuation,
10408    clippy::module_inception
10409)]
10410pub mod __buffa {
10411    #[allow(unused_imports)]
10412    use super::*;
10413    pub mod view {
10414        #[allow(unused_imports)]
10415        use super::*;
10416        /// =============================================================================
10417        /// Create Trigger Request/Response
10418        /// =============================================================================
10419        ///
10420        /// TriggerMarketIoc configures an immediate market child.
10421        #[derive(Clone, Debug, Default)]
10422        pub struct TriggerMarketIocView<'a> {
10423            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10424        }
10425        impl<'a> ::buffa::MessageView<'a> for TriggerMarketIocView<'a> {
10426            type Owned = super::super::TriggerMarketIoc;
10427            fn decode_view(
10428                buf: &'a [u8],
10429            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10430                let __limit = ::core::cell::Cell::new(
10431                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10432                );
10433                <Self as ::buffa::MessageView>::decode_view_ctx(
10434                    buf,
10435                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10436                )
10437            }
10438            fn decode_view_with_ctx(
10439                buf: &'a [u8],
10440                ctx: ::buffa::DecodeContext<'_>,
10441            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10442                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10443            }
10444            fn merge_view_field(
10445                &mut self,
10446                tag: ::buffa::encoding::Tag,
10447                cur: &'a [u8],
10448                before_tag: &'a [u8],
10449                ctx: ::buffa::DecodeContext<'_>,
10450            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10451                let _ = ctx;
10452                #[allow(unused_variables)]
10453                let view = self;
10454                let mut cur = cur;
10455                match tag.field_number() {
10456                    _ => {
10457                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10458                        let span_len = before_tag.len() - cur.len();
10459                        view.__buffa_unknown_fields
10460                            .push_record(before_tag, span_len, ctx)?;
10461                    }
10462                }
10463                ::core::result::Result::Ok(cur)
10464            }
10465            fn to_owned_message(
10466                &self,
10467            ) -> ::core::result::Result<
10468                super::super::TriggerMarketIoc,
10469                ::buffa::DecodeError,
10470            > {
10471                self.to_owned_from_source(None)
10472            }
10473            #[allow(clippy::useless_conversion, clippy::needless_update)]
10474            fn to_owned_from_source(
10475                &self,
10476                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10477            ) -> ::core::result::Result<
10478                super::super::TriggerMarketIoc,
10479                ::buffa::DecodeError,
10480            > {
10481                #[allow(unused_imports)]
10482                use ::buffa::alloc::string::ToString as _;
10483                let _ = __buffa_src;
10484                ::core::result::Result::Ok(super::super::TriggerMarketIoc {
10485                    __buffa_unknown_fields: self
10486                        .__buffa_unknown_fields
10487                        .to_owned()?
10488                        .into(),
10489                    ..::core::default::Default::default()
10490                })
10491            }
10492        }
10493        impl<'a> ::buffa::ViewEncode<'a> for TriggerMarketIocView<'a> {
10494            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10495            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10496                #[allow(unused_imports)]
10497                use ::buffa::Enumeration as _;
10498                let mut size = 0u32;
10499                size += self.__buffa_unknown_fields.encoded_len() as u32;
10500                size
10501            }
10502            #[allow(clippy::needless_borrow)]
10503            fn write_to(
10504                &self,
10505                _cache: &mut ::buffa::SizeCache,
10506                buf: &mut impl ::buffa::bytes::BufMut,
10507            ) {
10508                #[allow(unused_imports)]
10509                use ::buffa::Enumeration as _;
10510                self.__buffa_unknown_fields.write_to(buf);
10511            }
10512        }
10513        /// Serializes this view as protobuf JSON.
10514        ///
10515        /// Implicit-presence fields with default values are omitted, `required`
10516        /// fields are always emitted, explicit-presence (`optional`) fields are
10517        /// emitted only when set, bytes fields are base64-encoded, and enum
10518        /// values are their proto name strings.
10519        ///
10520        /// This impl uses `serialize_map(None)` because the number of emitted
10521        /// fields depends on default-omission rules; serializers that require
10522        /// known map lengths (e.g. `bincode`) will return a runtime error.
10523        /// Use the owned message type for those formats.
10524        impl<'__a> ::serde::Serialize for TriggerMarketIocView<'__a> {
10525            fn serialize<__S: ::serde::Serializer>(
10526                &self,
10527                __s: __S,
10528            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10529                use ::serde::ser::SerializeMap as _;
10530                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10531                __map.end()
10532            }
10533        }
10534        impl<'a> ::buffa::MessageName for TriggerMarketIocView<'a> {
10535            const PACKAGE: &'static str = "triggers.v1";
10536            const NAME: &'static str = "TriggerMarketIoc";
10537            const FULL_NAME: &'static str = "triggers.v1.TriggerMarketIoc";
10538            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerMarketIoc";
10539        }
10540        ::buffa::impl_default_view_instance!(TriggerMarketIocView);
10541        ::buffa::impl_view_reborrow!(TriggerMarketIocView);
10542        /** Self-contained, `'static` owned view of a `TriggerMarketIoc` message.
10543
10544 Wraps [`::buffa::OwnedView`]`<`[`TriggerMarketIocView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
10545
10546 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerMarketIocView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
10547        #[derive(Clone, Debug)]
10548        pub struct TriggerMarketIocOwnedView(
10549            ::buffa::OwnedView<TriggerMarketIocView<'static>>,
10550        );
10551        impl TriggerMarketIocOwnedView {
10552            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10553            ///
10554            /// The view borrows directly from the buffer's data; the buffer is
10555            /// retained inside the returned handle.
10556            ///
10557            /// # Errors
10558            ///
10559            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10560            /// protobuf data.
10561            pub fn decode(
10562                bytes: ::buffa::bytes::Bytes,
10563            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10564                ::core::result::Result::Ok(
10565                    TriggerMarketIocOwnedView(::buffa::OwnedView::decode(bytes)?),
10566                )
10567            }
10568            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10569            /// max message size).
10570            ///
10571            /// # Errors
10572            ///
10573            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10574            /// exceeds the configured limits.
10575            pub fn decode_with_options(
10576                bytes: ::buffa::bytes::Bytes,
10577                opts: &::buffa::DecodeOptions,
10578            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10579                ::core::result::Result::Ok(
10580                    TriggerMarketIocOwnedView(
10581                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10582                    ),
10583                )
10584            }
10585            /// Build from an owned message via an encode → decode round-trip.
10586            ///
10587            /// # Errors
10588            ///
10589            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10590            /// somehow invalid (should not happen for well-formed messages).
10591            pub fn from_owned(
10592                msg: &super::super::TriggerMarketIoc,
10593            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10594                ::core::result::Result::Ok(
10595                    TriggerMarketIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
10596                )
10597            }
10598            /// Borrow the full [`TriggerMarketIocView`] with its lifetime tied to `&self`.
10599            #[must_use]
10600            pub fn view(&self) -> &TriggerMarketIocView<'_> {
10601                self.0.reborrow()
10602            }
10603            /// Convert to the owned message type.
10604            ///
10605            /// # Errors
10606            ///
10607            /// Returns an error if re-materializing preserved unknown fields
10608            /// fails (e.g. the unknown-field limit is exceeded).
10609            pub fn to_owned_message(
10610                &self,
10611            ) -> ::core::result::Result<
10612                super::super::TriggerMarketIoc,
10613                ::buffa::DecodeError,
10614            > {
10615                self.0.to_owned_message()
10616            }
10617            /// The underlying bytes buffer.
10618            #[must_use]
10619            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10620                self.0.bytes()
10621            }
10622            /// Consume the handle, returning the underlying bytes buffer.
10623            #[must_use]
10624            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10625                self.0.into_bytes()
10626            }
10627        }
10628        impl ::core::convert::From<::buffa::OwnedView<TriggerMarketIocView<'static>>>
10629        for TriggerMarketIocOwnedView {
10630            fn from(inner: ::buffa::OwnedView<TriggerMarketIocView<'static>>) -> Self {
10631                TriggerMarketIocOwnedView(inner)
10632            }
10633        }
10634        impl ::core::convert::From<TriggerMarketIocOwnedView>
10635        for ::buffa::OwnedView<TriggerMarketIocView<'static>> {
10636            fn from(wrapper: TriggerMarketIocOwnedView) -> Self {
10637                wrapper.0
10638            }
10639        }
10640        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerMarketIocView<'static>>>
10641        for TriggerMarketIocOwnedView {
10642            fn as_ref(&self) -> &::buffa::OwnedView<TriggerMarketIocView<'static>> {
10643                &self.0
10644            }
10645        }
10646        impl ::buffa::HasMessageView for super::super::TriggerMarketIoc {
10647            type View<'a> = TriggerMarketIocView<'a>;
10648            type ViewHandle = TriggerMarketIocOwnedView;
10649        }
10650        impl ::serde::Serialize for TriggerMarketIocOwnedView {
10651            fn serialize<__S: ::serde::Serializer>(
10652                &self,
10653                __s: __S,
10654            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10655                ::serde::Serialize::serialize(&self.0, __s)
10656            }
10657        }
10658        /// TriggerLimitGtc configures a resting limit child.
10659        #[derive(Clone, Debug, Default)]
10660        pub struct TriggerLimitGtcView<'a> {
10661            /// Limit price in quote units scaled by 1e6.
10662            ///
10663            /// Field 1: `price_ticks`
10664            pub price_ticks: i64,
10665            /// Reject instead of taking liquidity.
10666            ///
10667            /// Field 2: `post_only`
10668            pub post_only: bool,
10669            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10670        }
10671        impl<'a> ::buffa::MessageView<'a> for TriggerLimitGtcView<'a> {
10672            type Owned = super::super::TriggerLimitGtc;
10673            fn decode_view(
10674                buf: &'a [u8],
10675            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10676                let __limit = ::core::cell::Cell::new(
10677                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10678                );
10679                <Self as ::buffa::MessageView>::decode_view_ctx(
10680                    buf,
10681                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10682                )
10683            }
10684            fn decode_view_with_ctx(
10685                buf: &'a [u8],
10686                ctx: ::buffa::DecodeContext<'_>,
10687            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10688                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10689            }
10690            fn merge_view_field(
10691                &mut self,
10692                tag: ::buffa::encoding::Tag,
10693                cur: &'a [u8],
10694                before_tag: &'a [u8],
10695                ctx: ::buffa::DecodeContext<'_>,
10696            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10697                let _ = ctx;
10698                #[allow(unused_variables)]
10699                let view = self;
10700                let mut cur = cur;
10701                match tag.field_number() {
10702                    1u32 => {
10703                        ::buffa::encoding::check_wire_type(
10704                            tag,
10705                            ::buffa::encoding::WireType::Varint,
10706                        )?;
10707                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
10708                    }
10709                    2u32 => {
10710                        ::buffa::encoding::check_wire_type(
10711                            tag,
10712                            ::buffa::encoding::WireType::Varint,
10713                        )?;
10714                        view.post_only = ::buffa::types::decode_bool(&mut cur)?;
10715                    }
10716                    _ => {
10717                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10718                        let span_len = before_tag.len() - cur.len();
10719                        view.__buffa_unknown_fields
10720                            .push_record(before_tag, span_len, ctx)?;
10721                    }
10722                }
10723                ::core::result::Result::Ok(cur)
10724            }
10725            fn to_owned_message(
10726                &self,
10727            ) -> ::core::result::Result<
10728                super::super::TriggerLimitGtc,
10729                ::buffa::DecodeError,
10730            > {
10731                self.to_owned_from_source(None)
10732            }
10733            #[allow(clippy::useless_conversion, clippy::needless_update)]
10734            fn to_owned_from_source(
10735                &self,
10736                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10737            ) -> ::core::result::Result<
10738                super::super::TriggerLimitGtc,
10739                ::buffa::DecodeError,
10740            > {
10741                #[allow(unused_imports)]
10742                use ::buffa::alloc::string::ToString as _;
10743                let _ = __buffa_src;
10744                ::core::result::Result::Ok(super::super::TriggerLimitGtc {
10745                    price_ticks: self.price_ticks,
10746                    post_only: self.post_only,
10747                    __buffa_unknown_fields: self
10748                        .__buffa_unknown_fields
10749                        .to_owned()?
10750                        .into(),
10751                    ..::core::default::Default::default()
10752                })
10753            }
10754        }
10755        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitGtcView<'a> {
10756            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10757            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10758                #[allow(unused_imports)]
10759                use ::buffa::Enumeration as _;
10760                let mut size = 0u32;
10761                if self.price_ticks != 0i64 {
10762                    size
10763                        += 1u32
10764                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
10765                }
10766                if self.post_only {
10767                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10768                }
10769                size += self.__buffa_unknown_fields.encoded_len() as u32;
10770                size
10771            }
10772            #[allow(clippy::needless_borrow)]
10773            fn write_to(
10774                &self,
10775                _cache: &mut ::buffa::SizeCache,
10776                buf: &mut impl ::buffa::bytes::BufMut,
10777            ) {
10778                #[allow(unused_imports)]
10779                use ::buffa::Enumeration as _;
10780                if self.price_ticks != 0i64 {
10781                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
10782                }
10783                if self.post_only {
10784                    ::buffa::types::put_bool_field(2u32, self.post_only, buf);
10785                }
10786                self.__buffa_unknown_fields.write_to(buf);
10787            }
10788        }
10789        /// Serializes this view as protobuf JSON.
10790        ///
10791        /// Implicit-presence fields with default values are omitted, `required`
10792        /// fields are always emitted, explicit-presence (`optional`) fields are
10793        /// emitted only when set, bytes fields are base64-encoded, and enum
10794        /// values are their proto name strings.
10795        ///
10796        /// This impl uses `serialize_map(None)` because the number of emitted
10797        /// fields depends on default-omission rules; serializers that require
10798        /// known map lengths (e.g. `bincode`) will return a runtime error.
10799        /// Use the owned message type for those formats.
10800        impl<'__a> ::serde::Serialize for TriggerLimitGtcView<'__a> {
10801            fn serialize<__S: ::serde::Serializer>(
10802                &self,
10803                __s: __S,
10804            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10805                use ::serde::ser::SerializeMap as _;
10806                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10807                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
10808                    __map
10809                        .serialize_entry(
10810                            "priceTicks",
10811                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
10812                        )?;
10813                }
10814                if self.post_only {
10815                    __map.serialize_entry("postOnly", &self.post_only)?;
10816                }
10817                __map.end()
10818            }
10819        }
10820        impl<'a> ::buffa::MessageName for TriggerLimitGtcView<'a> {
10821            const PACKAGE: &'static str = "triggers.v1";
10822            const NAME: &'static str = "TriggerLimitGtc";
10823            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitGtc";
10824            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitGtc";
10825        }
10826        ::buffa::impl_default_view_instance!(TriggerLimitGtcView);
10827        ::buffa::impl_view_reborrow!(TriggerLimitGtcView);
10828        /** Self-contained, `'static` owned view of a `TriggerLimitGtc` message.
10829
10830 Wraps [`::buffa::OwnedView`]`<`[`TriggerLimitGtcView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
10831
10832 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerLimitGtcView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
10833        #[derive(Clone, Debug)]
10834        pub struct TriggerLimitGtcOwnedView(
10835            ::buffa::OwnedView<TriggerLimitGtcView<'static>>,
10836        );
10837        impl TriggerLimitGtcOwnedView {
10838            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10839            ///
10840            /// The view borrows directly from the buffer's data; the buffer is
10841            /// retained inside the returned handle.
10842            ///
10843            /// # Errors
10844            ///
10845            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10846            /// protobuf data.
10847            pub fn decode(
10848                bytes: ::buffa::bytes::Bytes,
10849            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10850                ::core::result::Result::Ok(
10851                    TriggerLimitGtcOwnedView(::buffa::OwnedView::decode(bytes)?),
10852                )
10853            }
10854            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10855            /// max message size).
10856            ///
10857            /// # Errors
10858            ///
10859            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10860            /// exceeds the configured limits.
10861            pub fn decode_with_options(
10862                bytes: ::buffa::bytes::Bytes,
10863                opts: &::buffa::DecodeOptions,
10864            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10865                ::core::result::Result::Ok(
10866                    TriggerLimitGtcOwnedView(
10867                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10868                    ),
10869                )
10870            }
10871            /// Build from an owned message via an encode → decode round-trip.
10872            ///
10873            /// # Errors
10874            ///
10875            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10876            /// somehow invalid (should not happen for well-formed messages).
10877            pub fn from_owned(
10878                msg: &super::super::TriggerLimitGtc,
10879            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10880                ::core::result::Result::Ok(
10881                    TriggerLimitGtcOwnedView(::buffa::OwnedView::from_owned(msg)?),
10882                )
10883            }
10884            /// Borrow the full [`TriggerLimitGtcView`] with its lifetime tied to `&self`.
10885            #[must_use]
10886            pub fn view(&self) -> &TriggerLimitGtcView<'_> {
10887                self.0.reborrow()
10888            }
10889            /// Convert to the owned message type.
10890            ///
10891            /// # Errors
10892            ///
10893            /// Returns an error if re-materializing preserved unknown fields
10894            /// fails (e.g. the unknown-field limit is exceeded).
10895            pub fn to_owned_message(
10896                &self,
10897            ) -> ::core::result::Result<
10898                super::super::TriggerLimitGtc,
10899                ::buffa::DecodeError,
10900            > {
10901                self.0.to_owned_message()
10902            }
10903            /// The underlying bytes buffer.
10904            #[must_use]
10905            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10906                self.0.bytes()
10907            }
10908            /// Consume the handle, returning the underlying bytes buffer.
10909            #[must_use]
10910            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10911                self.0.into_bytes()
10912            }
10913            /// Limit price in quote units scaled by 1e6.
10914            ///
10915            /// Field 1: `price_ticks`
10916            #[must_use]
10917            pub fn price_ticks(&self) -> i64 {
10918                self.0.reborrow().price_ticks
10919            }
10920            /// Reject instead of taking liquidity.
10921            ///
10922            /// Field 2: `post_only`
10923            #[must_use]
10924            pub fn post_only(&self) -> bool {
10925                self.0.reborrow().post_only
10926            }
10927        }
10928        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitGtcView<'static>>>
10929        for TriggerLimitGtcOwnedView {
10930            fn from(inner: ::buffa::OwnedView<TriggerLimitGtcView<'static>>) -> Self {
10931                TriggerLimitGtcOwnedView(inner)
10932            }
10933        }
10934        impl ::core::convert::From<TriggerLimitGtcOwnedView>
10935        for ::buffa::OwnedView<TriggerLimitGtcView<'static>> {
10936            fn from(wrapper: TriggerLimitGtcOwnedView) -> Self {
10937                wrapper.0
10938            }
10939        }
10940        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitGtcView<'static>>>
10941        for TriggerLimitGtcOwnedView {
10942            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitGtcView<'static>> {
10943                &self.0
10944            }
10945        }
10946        impl ::buffa::HasMessageView for super::super::TriggerLimitGtc {
10947            type View<'a> = TriggerLimitGtcView<'a>;
10948            type ViewHandle = TriggerLimitGtcOwnedView;
10949        }
10950        impl ::serde::Serialize for TriggerLimitGtcOwnedView {
10951            fn serialize<__S: ::serde::Serializer>(
10952                &self,
10953                __s: __S,
10954            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10955                ::serde::Serialize::serialize(&self.0, __s)
10956            }
10957        }
10958        /// TriggerLimitIoc configures an immediate-or-cancel limit child.
10959        #[derive(Clone, Debug, Default)]
10960        pub struct TriggerLimitIocView<'a> {
10961            /// Limit price in quote units scaled by 1e6.
10962            ///
10963            /// Field 1: `price_ticks`
10964            pub price_ticks: i64,
10965            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10966        }
10967        impl<'a> ::buffa::MessageView<'a> for TriggerLimitIocView<'a> {
10968            type Owned = super::super::TriggerLimitIoc;
10969            fn decode_view(
10970                buf: &'a [u8],
10971            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10972                let __limit = ::core::cell::Cell::new(
10973                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10974                );
10975                <Self as ::buffa::MessageView>::decode_view_ctx(
10976                    buf,
10977                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10978                )
10979            }
10980            fn decode_view_with_ctx(
10981                buf: &'a [u8],
10982                ctx: ::buffa::DecodeContext<'_>,
10983            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10984                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10985            }
10986            fn merge_view_field(
10987                &mut self,
10988                tag: ::buffa::encoding::Tag,
10989                cur: &'a [u8],
10990                before_tag: &'a [u8],
10991                ctx: ::buffa::DecodeContext<'_>,
10992            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10993                let _ = ctx;
10994                #[allow(unused_variables)]
10995                let view = self;
10996                let mut cur = cur;
10997                match tag.field_number() {
10998                    1u32 => {
10999                        ::buffa::encoding::check_wire_type(
11000                            tag,
11001                            ::buffa::encoding::WireType::Varint,
11002                        )?;
11003                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
11004                    }
11005                    _ => {
11006                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11007                        let span_len = before_tag.len() - cur.len();
11008                        view.__buffa_unknown_fields
11009                            .push_record(before_tag, span_len, ctx)?;
11010                    }
11011                }
11012                ::core::result::Result::Ok(cur)
11013            }
11014            fn to_owned_message(
11015                &self,
11016            ) -> ::core::result::Result<
11017                super::super::TriggerLimitIoc,
11018                ::buffa::DecodeError,
11019            > {
11020                self.to_owned_from_source(None)
11021            }
11022            #[allow(clippy::useless_conversion, clippy::needless_update)]
11023            fn to_owned_from_source(
11024                &self,
11025                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11026            ) -> ::core::result::Result<
11027                super::super::TriggerLimitIoc,
11028                ::buffa::DecodeError,
11029            > {
11030                #[allow(unused_imports)]
11031                use ::buffa::alloc::string::ToString as _;
11032                let _ = __buffa_src;
11033                ::core::result::Result::Ok(super::super::TriggerLimitIoc {
11034                    price_ticks: self.price_ticks,
11035                    __buffa_unknown_fields: self
11036                        .__buffa_unknown_fields
11037                        .to_owned()?
11038                        .into(),
11039                    ..::core::default::Default::default()
11040                })
11041            }
11042        }
11043        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitIocView<'a> {
11044            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11045            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11046                #[allow(unused_imports)]
11047                use ::buffa::Enumeration as _;
11048                let mut size = 0u32;
11049                if self.price_ticks != 0i64 {
11050                    size
11051                        += 1u32
11052                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
11053                }
11054                size += self.__buffa_unknown_fields.encoded_len() as u32;
11055                size
11056            }
11057            #[allow(clippy::needless_borrow)]
11058            fn write_to(
11059                &self,
11060                _cache: &mut ::buffa::SizeCache,
11061                buf: &mut impl ::buffa::bytes::BufMut,
11062            ) {
11063                #[allow(unused_imports)]
11064                use ::buffa::Enumeration as _;
11065                if self.price_ticks != 0i64 {
11066                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
11067                }
11068                self.__buffa_unknown_fields.write_to(buf);
11069            }
11070        }
11071        /// Serializes this view as protobuf JSON.
11072        ///
11073        /// Implicit-presence fields with default values are omitted, `required`
11074        /// fields are always emitted, explicit-presence (`optional`) fields are
11075        /// emitted only when set, bytes fields are base64-encoded, and enum
11076        /// values are their proto name strings.
11077        ///
11078        /// This impl uses `serialize_map(None)` because the number of emitted
11079        /// fields depends on default-omission rules; serializers that require
11080        /// known map lengths (e.g. `bincode`) will return a runtime error.
11081        /// Use the owned message type for those formats.
11082        impl<'__a> ::serde::Serialize for TriggerLimitIocView<'__a> {
11083            fn serialize<__S: ::serde::Serializer>(
11084                &self,
11085                __s: __S,
11086            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11087                use ::serde::ser::SerializeMap as _;
11088                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11089                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
11090                    __map
11091                        .serialize_entry(
11092                            "priceTicks",
11093                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
11094                        )?;
11095                }
11096                __map.end()
11097            }
11098        }
11099        impl<'a> ::buffa::MessageName for TriggerLimitIocView<'a> {
11100            const PACKAGE: &'static str = "triggers.v1";
11101            const NAME: &'static str = "TriggerLimitIoc";
11102            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitIoc";
11103            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitIoc";
11104        }
11105        ::buffa::impl_default_view_instance!(TriggerLimitIocView);
11106        ::buffa::impl_view_reborrow!(TriggerLimitIocView);
11107        /** Self-contained, `'static` owned view of a `TriggerLimitIoc` message.
11108
11109 Wraps [`::buffa::OwnedView`]`<`[`TriggerLimitIocView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11110
11111 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerLimitIocView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11112        #[derive(Clone, Debug)]
11113        pub struct TriggerLimitIocOwnedView(
11114            ::buffa::OwnedView<TriggerLimitIocView<'static>>,
11115        );
11116        impl TriggerLimitIocOwnedView {
11117            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11118            ///
11119            /// The view borrows directly from the buffer's data; the buffer is
11120            /// retained inside the returned handle.
11121            ///
11122            /// # Errors
11123            ///
11124            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11125            /// protobuf data.
11126            pub fn decode(
11127                bytes: ::buffa::bytes::Bytes,
11128            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11129                ::core::result::Result::Ok(
11130                    TriggerLimitIocOwnedView(::buffa::OwnedView::decode(bytes)?),
11131                )
11132            }
11133            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11134            /// max message size).
11135            ///
11136            /// # Errors
11137            ///
11138            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11139            /// exceeds the configured limits.
11140            pub fn decode_with_options(
11141                bytes: ::buffa::bytes::Bytes,
11142                opts: &::buffa::DecodeOptions,
11143            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11144                ::core::result::Result::Ok(
11145                    TriggerLimitIocOwnedView(
11146                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11147                    ),
11148                )
11149            }
11150            /// Build from an owned message via an encode → decode round-trip.
11151            ///
11152            /// # Errors
11153            ///
11154            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11155            /// somehow invalid (should not happen for well-formed messages).
11156            pub fn from_owned(
11157                msg: &super::super::TriggerLimitIoc,
11158            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11159                ::core::result::Result::Ok(
11160                    TriggerLimitIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
11161                )
11162            }
11163            /// Borrow the full [`TriggerLimitIocView`] with its lifetime tied to `&self`.
11164            #[must_use]
11165            pub fn view(&self) -> &TriggerLimitIocView<'_> {
11166                self.0.reborrow()
11167            }
11168            /// Convert to the owned message type.
11169            ///
11170            /// # Errors
11171            ///
11172            /// Returns an error if re-materializing preserved unknown fields
11173            /// fails (e.g. the unknown-field limit is exceeded).
11174            pub fn to_owned_message(
11175                &self,
11176            ) -> ::core::result::Result<
11177                super::super::TriggerLimitIoc,
11178                ::buffa::DecodeError,
11179            > {
11180                self.0.to_owned_message()
11181            }
11182            /// The underlying bytes buffer.
11183            #[must_use]
11184            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11185                self.0.bytes()
11186            }
11187            /// Consume the handle, returning the underlying bytes buffer.
11188            #[must_use]
11189            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11190                self.0.into_bytes()
11191            }
11192            /// Limit price in quote units scaled by 1e6.
11193            ///
11194            /// Field 1: `price_ticks`
11195            #[must_use]
11196            pub fn price_ticks(&self) -> i64 {
11197                self.0.reborrow().price_ticks
11198            }
11199        }
11200        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitIocView<'static>>>
11201        for TriggerLimitIocOwnedView {
11202            fn from(inner: ::buffa::OwnedView<TriggerLimitIocView<'static>>) -> Self {
11203                TriggerLimitIocOwnedView(inner)
11204            }
11205        }
11206        impl ::core::convert::From<TriggerLimitIocOwnedView>
11207        for ::buffa::OwnedView<TriggerLimitIocView<'static>> {
11208            fn from(wrapper: TriggerLimitIocOwnedView) -> Self {
11209                wrapper.0
11210            }
11211        }
11212        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitIocView<'static>>>
11213        for TriggerLimitIocOwnedView {
11214            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitIocView<'static>> {
11215                &self.0
11216            }
11217        }
11218        impl ::buffa::HasMessageView for super::super::TriggerLimitIoc {
11219            type View<'a> = TriggerLimitIocView<'a>;
11220            type ViewHandle = TriggerLimitIocOwnedView;
11221        }
11222        impl ::serde::Serialize for TriggerLimitIocOwnedView {
11223            fn serialize<__S: ::serde::Serializer>(
11224                &self,
11225                __s: __S,
11226            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11227                ::serde::Serialize::serialize(&self.0, __s)
11228            }
11229        }
11230        /// TriggerLimitFok configures a fill-or-kill limit child.
11231        #[derive(Clone, Debug, Default)]
11232        pub struct TriggerLimitFokView<'a> {
11233            /// Limit price in quote units scaled by 1e6.
11234            ///
11235            /// Field 1: `price_ticks`
11236            pub price_ticks: i64,
11237            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11238        }
11239        impl<'a> ::buffa::MessageView<'a> for TriggerLimitFokView<'a> {
11240            type Owned = super::super::TriggerLimitFok;
11241            fn decode_view(
11242                buf: &'a [u8],
11243            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11244                let __limit = ::core::cell::Cell::new(
11245                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11246                );
11247                <Self as ::buffa::MessageView>::decode_view_ctx(
11248                    buf,
11249                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11250                )
11251            }
11252            fn decode_view_with_ctx(
11253                buf: &'a [u8],
11254                ctx: ::buffa::DecodeContext<'_>,
11255            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11256                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11257            }
11258            fn merge_view_field(
11259                &mut self,
11260                tag: ::buffa::encoding::Tag,
11261                cur: &'a [u8],
11262                before_tag: &'a [u8],
11263                ctx: ::buffa::DecodeContext<'_>,
11264            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11265                let _ = ctx;
11266                #[allow(unused_variables)]
11267                let view = self;
11268                let mut cur = cur;
11269                match tag.field_number() {
11270                    1u32 => {
11271                        ::buffa::encoding::check_wire_type(
11272                            tag,
11273                            ::buffa::encoding::WireType::Varint,
11274                        )?;
11275                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
11276                    }
11277                    _ => {
11278                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11279                        let span_len = before_tag.len() - cur.len();
11280                        view.__buffa_unknown_fields
11281                            .push_record(before_tag, span_len, ctx)?;
11282                    }
11283                }
11284                ::core::result::Result::Ok(cur)
11285            }
11286            fn to_owned_message(
11287                &self,
11288            ) -> ::core::result::Result<
11289                super::super::TriggerLimitFok,
11290                ::buffa::DecodeError,
11291            > {
11292                self.to_owned_from_source(None)
11293            }
11294            #[allow(clippy::useless_conversion, clippy::needless_update)]
11295            fn to_owned_from_source(
11296                &self,
11297                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11298            ) -> ::core::result::Result<
11299                super::super::TriggerLimitFok,
11300                ::buffa::DecodeError,
11301            > {
11302                #[allow(unused_imports)]
11303                use ::buffa::alloc::string::ToString as _;
11304                let _ = __buffa_src;
11305                ::core::result::Result::Ok(super::super::TriggerLimitFok {
11306                    price_ticks: self.price_ticks,
11307                    __buffa_unknown_fields: self
11308                        .__buffa_unknown_fields
11309                        .to_owned()?
11310                        .into(),
11311                    ..::core::default::Default::default()
11312                })
11313            }
11314        }
11315        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitFokView<'a> {
11316            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11317            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11318                #[allow(unused_imports)]
11319                use ::buffa::Enumeration as _;
11320                let mut size = 0u32;
11321                if self.price_ticks != 0i64 {
11322                    size
11323                        += 1u32
11324                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
11325                }
11326                size += self.__buffa_unknown_fields.encoded_len() as u32;
11327                size
11328            }
11329            #[allow(clippy::needless_borrow)]
11330            fn write_to(
11331                &self,
11332                _cache: &mut ::buffa::SizeCache,
11333                buf: &mut impl ::buffa::bytes::BufMut,
11334            ) {
11335                #[allow(unused_imports)]
11336                use ::buffa::Enumeration as _;
11337                if self.price_ticks != 0i64 {
11338                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
11339                }
11340                self.__buffa_unknown_fields.write_to(buf);
11341            }
11342        }
11343        /// Serializes this view as protobuf JSON.
11344        ///
11345        /// Implicit-presence fields with default values are omitted, `required`
11346        /// fields are always emitted, explicit-presence (`optional`) fields are
11347        /// emitted only when set, bytes fields are base64-encoded, and enum
11348        /// values are their proto name strings.
11349        ///
11350        /// This impl uses `serialize_map(None)` because the number of emitted
11351        /// fields depends on default-omission rules; serializers that require
11352        /// known map lengths (e.g. `bincode`) will return a runtime error.
11353        /// Use the owned message type for those formats.
11354        impl<'__a> ::serde::Serialize for TriggerLimitFokView<'__a> {
11355            fn serialize<__S: ::serde::Serializer>(
11356                &self,
11357                __s: __S,
11358            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11359                use ::serde::ser::SerializeMap as _;
11360                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11361                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
11362                    __map
11363                        .serialize_entry(
11364                            "priceTicks",
11365                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
11366                        )?;
11367                }
11368                __map.end()
11369            }
11370        }
11371        impl<'a> ::buffa::MessageName for TriggerLimitFokView<'a> {
11372            const PACKAGE: &'static str = "triggers.v1";
11373            const NAME: &'static str = "TriggerLimitFok";
11374            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitFok";
11375            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitFok";
11376        }
11377        ::buffa::impl_default_view_instance!(TriggerLimitFokView);
11378        ::buffa::impl_view_reborrow!(TriggerLimitFokView);
11379        /** Self-contained, `'static` owned view of a `TriggerLimitFok` message.
11380
11381 Wraps [`::buffa::OwnedView`]`<`[`TriggerLimitFokView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11382
11383 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerLimitFokView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11384        #[derive(Clone, Debug)]
11385        pub struct TriggerLimitFokOwnedView(
11386            ::buffa::OwnedView<TriggerLimitFokView<'static>>,
11387        );
11388        impl TriggerLimitFokOwnedView {
11389            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11390            ///
11391            /// The view borrows directly from the buffer's data; the buffer is
11392            /// retained inside the returned handle.
11393            ///
11394            /// # Errors
11395            ///
11396            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11397            /// protobuf data.
11398            pub fn decode(
11399                bytes: ::buffa::bytes::Bytes,
11400            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11401                ::core::result::Result::Ok(
11402                    TriggerLimitFokOwnedView(::buffa::OwnedView::decode(bytes)?),
11403                )
11404            }
11405            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11406            /// max message size).
11407            ///
11408            /// # Errors
11409            ///
11410            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11411            /// exceeds the configured limits.
11412            pub fn decode_with_options(
11413                bytes: ::buffa::bytes::Bytes,
11414                opts: &::buffa::DecodeOptions,
11415            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11416                ::core::result::Result::Ok(
11417                    TriggerLimitFokOwnedView(
11418                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11419                    ),
11420                )
11421            }
11422            /// Build from an owned message via an encode → decode round-trip.
11423            ///
11424            /// # Errors
11425            ///
11426            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11427            /// somehow invalid (should not happen for well-formed messages).
11428            pub fn from_owned(
11429                msg: &super::super::TriggerLimitFok,
11430            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11431                ::core::result::Result::Ok(
11432                    TriggerLimitFokOwnedView(::buffa::OwnedView::from_owned(msg)?),
11433                )
11434            }
11435            /// Borrow the full [`TriggerLimitFokView`] with its lifetime tied to `&self`.
11436            #[must_use]
11437            pub fn view(&self) -> &TriggerLimitFokView<'_> {
11438                self.0.reborrow()
11439            }
11440            /// Convert to the owned message type.
11441            ///
11442            /// # Errors
11443            ///
11444            /// Returns an error if re-materializing preserved unknown fields
11445            /// fails (e.g. the unknown-field limit is exceeded).
11446            pub fn to_owned_message(
11447                &self,
11448            ) -> ::core::result::Result<
11449                super::super::TriggerLimitFok,
11450                ::buffa::DecodeError,
11451            > {
11452                self.0.to_owned_message()
11453            }
11454            /// The underlying bytes buffer.
11455            #[must_use]
11456            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11457                self.0.bytes()
11458            }
11459            /// Consume the handle, returning the underlying bytes buffer.
11460            #[must_use]
11461            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11462                self.0.into_bytes()
11463            }
11464            /// Limit price in quote units scaled by 1e6.
11465            ///
11466            /// Field 1: `price_ticks`
11467            #[must_use]
11468            pub fn price_ticks(&self) -> i64 {
11469                self.0.reborrow().price_ticks
11470            }
11471        }
11472        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitFokView<'static>>>
11473        for TriggerLimitFokOwnedView {
11474            fn from(inner: ::buffa::OwnedView<TriggerLimitFokView<'static>>) -> Self {
11475                TriggerLimitFokOwnedView(inner)
11476            }
11477        }
11478        impl ::core::convert::From<TriggerLimitFokOwnedView>
11479        for ::buffa::OwnedView<TriggerLimitFokView<'static>> {
11480            fn from(wrapper: TriggerLimitFokOwnedView) -> Self {
11481                wrapper.0
11482            }
11483        }
11484        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitFokView<'static>>>
11485        for TriggerLimitFokOwnedView {
11486            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitFokView<'static>> {
11487                &self.0
11488            }
11489        }
11490        impl ::buffa::HasMessageView for super::super::TriggerLimitFok {
11491            type View<'a> = TriggerLimitFokView<'a>;
11492            type ViewHandle = TriggerLimitFokOwnedView;
11493        }
11494        impl ::serde::Serialize for TriggerLimitFokOwnedView {
11495            fn serialize<__S: ::serde::Serializer>(
11496                &self,
11497                __s: __S,
11498            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11499                ::serde::Serialize::serialize(&self.0, __s)
11500            }
11501        }
11502        /// ConditionalChildExecution selects the child submitted by a stop-loss or
11503        /// take-profit trigger. BUY market children are not supported in spot.
11504        #[derive(Clone, Debug, Default)]
11505        pub struct ConditionalChildExecutionView<'a> {
11506            pub execution: ::core::option::Option<
11507                super::super::__buffa::view::oneof::conditional_child_execution::Execution<
11508                    'a,
11509                >,
11510            >,
11511            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11512        }
11513        impl<'a> ::buffa::MessageView<'a> for ConditionalChildExecutionView<'a> {
11514            type Owned = super::super::ConditionalChildExecution;
11515            fn decode_view(
11516                buf: &'a [u8],
11517            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11518                let __limit = ::core::cell::Cell::new(
11519                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11520                );
11521                <Self as ::buffa::MessageView>::decode_view_ctx(
11522                    buf,
11523                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11524                )
11525            }
11526            fn decode_view_with_ctx(
11527                buf: &'a [u8],
11528                ctx: ::buffa::DecodeContext<'_>,
11529            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11530                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11531            }
11532            fn merge_view_field(
11533                &mut self,
11534                tag: ::buffa::encoding::Tag,
11535                cur: &'a [u8],
11536                before_tag: &'a [u8],
11537                ctx: ::buffa::DecodeContext<'_>,
11538            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11539                let _ = ctx;
11540                #[allow(unused_variables)]
11541                let view = self;
11542                let mut cur = cur;
11543                match tag.field_number() {
11544                    1u32 => {
11545                        ::buffa::encoding::check_wire_type(
11546                            tag,
11547                            ::buffa::encoding::WireType::LengthDelimited,
11548                        )?;
11549                        let __sub_ctx = ctx.descend()?;
11550                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11551                        if let Some(
11552                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11553                                ref mut existing,
11554                            ),
11555                        ) = view.execution
11556                        {
11557                            ::buffa::MessageView::merge_into_view(
11558                                &mut **existing,
11559                                sub,
11560                                __sub_ctx,
11561                            )?;
11562                        } else {
11563                            view.execution = Some(
11564                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11565                                    ::buffa::alloc::boxed::Box::new(
11566                                        <super::super::__buffa::view::TriggerMarketIocView as ::buffa::MessageView>::decode_view_ctx(
11567                                            sub,
11568                                            __sub_ctx,
11569                                        )?,
11570                                    ),
11571                                ),
11572                            );
11573                        }
11574                    }
11575                    2u32 => {
11576                        ::buffa::encoding::check_wire_type(
11577                            tag,
11578                            ::buffa::encoding::WireType::LengthDelimited,
11579                        )?;
11580                        let __sub_ctx = ctx.descend()?;
11581                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11582                        if let Some(
11583                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11584                                ref mut existing,
11585                            ),
11586                        ) = view.execution
11587                        {
11588                            ::buffa::MessageView::merge_into_view(
11589                                &mut **existing,
11590                                sub,
11591                                __sub_ctx,
11592                            )?;
11593                        } else {
11594                            view.execution = Some(
11595                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11596                                    ::buffa::alloc::boxed::Box::new(
11597                                        <super::super::__buffa::view::TriggerLimitGtcView as ::buffa::MessageView>::decode_view_ctx(
11598                                            sub,
11599                                            __sub_ctx,
11600                                        )?,
11601                                    ),
11602                                ),
11603                            );
11604                        }
11605                    }
11606                    3u32 => {
11607                        ::buffa::encoding::check_wire_type(
11608                            tag,
11609                            ::buffa::encoding::WireType::LengthDelimited,
11610                        )?;
11611                        let __sub_ctx = ctx.descend()?;
11612                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11613                        if let Some(
11614                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11615                                ref mut existing,
11616                            ),
11617                        ) = view.execution
11618                        {
11619                            ::buffa::MessageView::merge_into_view(
11620                                &mut **existing,
11621                                sub,
11622                                __sub_ctx,
11623                            )?;
11624                        } else {
11625                            view.execution = Some(
11626                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11627                                    ::buffa::alloc::boxed::Box::new(
11628                                        <super::super::__buffa::view::TriggerLimitIocView as ::buffa::MessageView>::decode_view_ctx(
11629                                            sub,
11630                                            __sub_ctx,
11631                                        )?,
11632                                    ),
11633                                ),
11634                            );
11635                        }
11636                    }
11637                    4u32 => {
11638                        ::buffa::encoding::check_wire_type(
11639                            tag,
11640                            ::buffa::encoding::WireType::LengthDelimited,
11641                        )?;
11642                        let __sub_ctx = ctx.descend()?;
11643                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11644                        if let Some(
11645                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11646                                ref mut existing,
11647                            ),
11648                        ) = view.execution
11649                        {
11650                            ::buffa::MessageView::merge_into_view(
11651                                &mut **existing,
11652                                sub,
11653                                __sub_ctx,
11654                            )?;
11655                        } else {
11656                            view.execution = Some(
11657                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11658                                    ::buffa::alloc::boxed::Box::new(
11659                                        <super::super::__buffa::view::TriggerLimitFokView as ::buffa::MessageView>::decode_view_ctx(
11660                                            sub,
11661                                            __sub_ctx,
11662                                        )?,
11663                                    ),
11664                                ),
11665                            );
11666                        }
11667                    }
11668                    _ => {
11669                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11670                        let span_len = before_tag.len() - cur.len();
11671                        view.__buffa_unknown_fields
11672                            .push_record(before_tag, span_len, ctx)?;
11673                    }
11674                }
11675                ::core::result::Result::Ok(cur)
11676            }
11677            fn to_owned_message(
11678                &self,
11679            ) -> ::core::result::Result<
11680                super::super::ConditionalChildExecution,
11681                ::buffa::DecodeError,
11682            > {
11683                self.to_owned_from_source(None)
11684            }
11685            #[allow(clippy::useless_conversion, clippy::needless_update)]
11686            fn to_owned_from_source(
11687                &self,
11688                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11689            ) -> ::core::result::Result<
11690                super::super::ConditionalChildExecution,
11691                ::buffa::DecodeError,
11692            > {
11693                #[allow(unused_imports)]
11694                use ::buffa::alloc::string::ToString as _;
11695                let _ = __buffa_src;
11696                ::core::result::Result::Ok(super::super::ConditionalChildExecution {
11697                    execution: match self.execution.as_ref() {
11698                        ::core::option::Option::Some(v) => {
11699                            ::core::option::Option::Some(
11700                                match v {
11701                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11702                                        v,
11703                                    ) => {
11704                                        super::super::__buffa::oneof::conditional_child_execution::Execution::MarketIoc(
11705                                            ::buffa::alloc::boxed::Box::new(
11706                                                v.to_owned_from_source(__buffa_src)?,
11707                                            ),
11708                                        )
11709                                    }
11710                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11711                                        v,
11712                                    ) => {
11713                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitGtc(
11714                                            ::buffa::alloc::boxed::Box::new(
11715                                                v.to_owned_from_source(__buffa_src)?,
11716                                            ),
11717                                        )
11718                                    }
11719                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11720                                        v,
11721                                    ) => {
11722                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitIoc(
11723                                            ::buffa::alloc::boxed::Box::new(
11724                                                v.to_owned_from_source(__buffa_src)?,
11725                                            ),
11726                                        )
11727                                    }
11728                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11729                                        v,
11730                                    ) => {
11731                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitFok(
11732                                            ::buffa::alloc::boxed::Box::new(
11733                                                v.to_owned_from_source(__buffa_src)?,
11734                                            ),
11735                                        )
11736                                    }
11737                                },
11738                            )
11739                        }
11740                        ::core::option::Option::None => ::core::option::Option::None,
11741                    },
11742                    __buffa_unknown_fields: self
11743                        .__buffa_unknown_fields
11744                        .to_owned()?
11745                        .into(),
11746                    ..::core::default::Default::default()
11747                })
11748            }
11749        }
11750        impl<'a> ::buffa::ViewEncode<'a> for ConditionalChildExecutionView<'a> {
11751            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11752            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11753                #[allow(unused_imports)]
11754                use ::buffa::Enumeration as _;
11755                let mut size = 0u32;
11756                if let ::core::option::Option::Some(ref v) = self.execution {
11757                    match v {
11758                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11759                            x,
11760                        ) => {
11761                            let __slot = __cache.reserve();
11762                            let inner = x.compute_size(__cache);
11763                            __cache.set(__slot, inner);
11764                            size
11765                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11766                                    + inner;
11767                        }
11768                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11769                            x,
11770                        ) => {
11771                            let __slot = __cache.reserve();
11772                            let inner = x.compute_size(__cache);
11773                            __cache.set(__slot, inner);
11774                            size
11775                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11776                                    + inner;
11777                        }
11778                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11779                            x,
11780                        ) => {
11781                            let __slot = __cache.reserve();
11782                            let inner = x.compute_size(__cache);
11783                            __cache.set(__slot, inner);
11784                            size
11785                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11786                                    + inner;
11787                        }
11788                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11789                            x,
11790                        ) => {
11791                            let __slot = __cache.reserve();
11792                            let inner = x.compute_size(__cache);
11793                            __cache.set(__slot, inner);
11794                            size
11795                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11796                                    + inner;
11797                        }
11798                    }
11799                }
11800                size += self.__buffa_unknown_fields.encoded_len() as u32;
11801                size
11802            }
11803            #[allow(clippy::needless_borrow)]
11804            fn write_to(
11805                &self,
11806                __cache: &mut ::buffa::SizeCache,
11807                buf: &mut impl ::buffa::bytes::BufMut,
11808            ) {
11809                #[allow(unused_imports)]
11810                use ::buffa::Enumeration as _;
11811                if let ::core::option::Option::Some(ref v) = self.execution {
11812                    match v {
11813                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11814                            x,
11815                        ) => {
11816                            ::buffa::types::put_len_delimited_header(
11817                                1u32,
11818                                __cache.consume_next(),
11819                                buf,
11820                            );
11821                            x.write_to(__cache, buf);
11822                        }
11823                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11824                            x,
11825                        ) => {
11826                            ::buffa::types::put_len_delimited_header(
11827                                2u32,
11828                                __cache.consume_next(),
11829                                buf,
11830                            );
11831                            x.write_to(__cache, buf);
11832                        }
11833                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11834                            x,
11835                        ) => {
11836                            ::buffa::types::put_len_delimited_header(
11837                                3u32,
11838                                __cache.consume_next(),
11839                                buf,
11840                            );
11841                            x.write_to(__cache, buf);
11842                        }
11843                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11844                            x,
11845                        ) => {
11846                            ::buffa::types::put_len_delimited_header(
11847                                4u32,
11848                                __cache.consume_next(),
11849                                buf,
11850                            );
11851                            x.write_to(__cache, buf);
11852                        }
11853                    }
11854                }
11855                self.__buffa_unknown_fields.write_to(buf);
11856            }
11857        }
11858        /// Serializes this view as protobuf JSON.
11859        ///
11860        /// Implicit-presence fields with default values are omitted, `required`
11861        /// fields are always emitted, explicit-presence (`optional`) fields are
11862        /// emitted only when set, bytes fields are base64-encoded, and enum
11863        /// values are their proto name strings.
11864        ///
11865        /// This impl uses `serialize_map(None)` because the number of emitted
11866        /// fields depends on default-omission rules; serializers that require
11867        /// known map lengths (e.g. `bincode`) will return a runtime error.
11868        /// Use the owned message type for those formats.
11869        impl<'__a> ::serde::Serialize for ConditionalChildExecutionView<'__a> {
11870            fn serialize<__S: ::serde::Serializer>(
11871                &self,
11872                __s: __S,
11873            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11874                use ::serde::ser::SerializeMap as _;
11875                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11876                if let ::core::option::Option::Some(ref __ov) = self.execution {
11877                    match __ov {
11878                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11879                            v,
11880                        ) => {
11881                            __map.serialize_entry("marketIoc", v)?;
11882                        }
11883                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11884                            v,
11885                        ) => {
11886                            __map.serialize_entry("limitGtc", v)?;
11887                        }
11888                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11889                            v,
11890                        ) => {
11891                            __map.serialize_entry("limitIoc", v)?;
11892                        }
11893                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11894                            v,
11895                        ) => {
11896                            __map.serialize_entry("limitFok", v)?;
11897                        }
11898                    }
11899                }
11900                __map.end()
11901            }
11902        }
11903        impl<'a> ::buffa::MessageName for ConditionalChildExecutionView<'a> {
11904            const PACKAGE: &'static str = "triggers.v1";
11905            const NAME: &'static str = "ConditionalChildExecution";
11906            const FULL_NAME: &'static str = "triggers.v1.ConditionalChildExecution";
11907            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalChildExecution";
11908        }
11909        ::buffa::impl_default_view_instance!(ConditionalChildExecutionView);
11910        ::buffa::impl_view_reborrow!(ConditionalChildExecutionView);
11911        /** Self-contained, `'static` owned view of a `ConditionalChildExecution` message.
11912
11913 Wraps [`::buffa::OwnedView`]`<`[`ConditionalChildExecutionView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11914
11915 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ConditionalChildExecutionView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11916        #[derive(Clone, Debug)]
11917        pub struct ConditionalChildExecutionOwnedView(
11918            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
11919        );
11920        impl ConditionalChildExecutionOwnedView {
11921            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11922            ///
11923            /// The view borrows directly from the buffer's data; the buffer is
11924            /// retained inside the returned handle.
11925            ///
11926            /// # Errors
11927            ///
11928            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11929            /// protobuf data.
11930            pub fn decode(
11931                bytes: ::buffa::bytes::Bytes,
11932            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11933                ::core::result::Result::Ok(
11934                    ConditionalChildExecutionOwnedView(
11935                        ::buffa::OwnedView::decode(bytes)?,
11936                    ),
11937                )
11938            }
11939            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11940            /// max message size).
11941            ///
11942            /// # Errors
11943            ///
11944            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11945            /// exceeds the configured limits.
11946            pub fn decode_with_options(
11947                bytes: ::buffa::bytes::Bytes,
11948                opts: &::buffa::DecodeOptions,
11949            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11950                ::core::result::Result::Ok(
11951                    ConditionalChildExecutionOwnedView(
11952                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11953                    ),
11954                )
11955            }
11956            /// Build from an owned message via an encode → decode round-trip.
11957            ///
11958            /// # Errors
11959            ///
11960            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11961            /// somehow invalid (should not happen for well-formed messages).
11962            pub fn from_owned(
11963                msg: &super::super::ConditionalChildExecution,
11964            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11965                ::core::result::Result::Ok(
11966                    ConditionalChildExecutionOwnedView(
11967                        ::buffa::OwnedView::from_owned(msg)?,
11968                    ),
11969                )
11970            }
11971            /// Borrow the full [`ConditionalChildExecutionView`] with its lifetime tied to `&self`.
11972            #[must_use]
11973            pub fn view(&self) -> &ConditionalChildExecutionView<'_> {
11974                self.0.reborrow()
11975            }
11976            /// Convert to the owned message type.
11977            ///
11978            /// # Errors
11979            ///
11980            /// Returns an error if re-materializing preserved unknown fields
11981            /// fails (e.g. the unknown-field limit is exceeded).
11982            pub fn to_owned_message(
11983                &self,
11984            ) -> ::core::result::Result<
11985                super::super::ConditionalChildExecution,
11986                ::buffa::DecodeError,
11987            > {
11988                self.0.to_owned_message()
11989            }
11990            /// The underlying bytes buffer.
11991            #[must_use]
11992            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11993                self.0.bytes()
11994            }
11995            /// Consume the handle, returning the underlying bytes buffer.
11996            #[must_use]
11997            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11998                self.0.into_bytes()
11999            }
12000            /// Oneof `execution`.
12001            #[must_use]
12002            pub fn execution(
12003                &self,
12004            ) -> ::core::option::Option<
12005                &super::super::__buffa::view::oneof::conditional_child_execution::Execution<
12006                    '_,
12007                >,
12008            > {
12009                self.0.reborrow().execution.as_ref()
12010            }
12011        }
12012        impl ::core::convert::From<
12013            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12014        > for ConditionalChildExecutionOwnedView {
12015            fn from(
12016                inner: ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12017            ) -> Self {
12018                ConditionalChildExecutionOwnedView(inner)
12019            }
12020        }
12021        impl ::core::convert::From<ConditionalChildExecutionOwnedView>
12022        for ::buffa::OwnedView<ConditionalChildExecutionView<'static>> {
12023            fn from(wrapper: ConditionalChildExecutionOwnedView) -> Self {
12024                wrapper.0
12025            }
12026        }
12027        impl ::core::convert::AsRef<
12028            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12029        > for ConditionalChildExecutionOwnedView {
12030            fn as_ref(
12031                &self,
12032            ) -> &::buffa::OwnedView<ConditionalChildExecutionView<'static>> {
12033                &self.0
12034            }
12035        }
12036        impl ::buffa::HasMessageView for super::super::ConditionalChildExecution {
12037            type View<'a> = ConditionalChildExecutionView<'a>;
12038            type ViewHandle = ConditionalChildExecutionOwnedView;
12039        }
12040        impl ::serde::Serialize for ConditionalChildExecutionOwnedView {
12041            fn serialize<__S: ::serde::Serializer>(
12042                &self,
12043                __s: __S,
12044            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12045                ::serde::Serialize::serialize(&self.0, __s)
12046            }
12047        }
12048        /// ConditionalTrigger configures a standalone stop-loss or take-profit.
12049        #[derive(Clone, Debug, Default)]
12050        pub struct ConditionalTriggerView<'a> {
12051            /// Trigger threshold in quote units scaled by 1e6.
12052            ///
12053            /// Field 1: `trigger_price_ticks`
12054            pub trigger_price_ticks: i64,
12055            /// Child order side.
12056            ///
12057            /// Field 2: `side`
12058            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
12059            /// Child execution.
12060            ///
12061            /// Field 3: `child`
12062            pub child: ::buffa::MessageFieldView<
12063                super::super::__buffa::view::ConditionalChildExecutionView<'a>,
12064            >,
12065            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12066        }
12067        impl<'a> ::buffa::MessageView<'a> for ConditionalTriggerView<'a> {
12068            type Owned = super::super::ConditionalTrigger;
12069            fn decode_view(
12070                buf: &'a [u8],
12071            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12072                let __limit = ::core::cell::Cell::new(
12073                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12074                );
12075                <Self as ::buffa::MessageView>::decode_view_ctx(
12076                    buf,
12077                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12078                )
12079            }
12080            fn decode_view_with_ctx(
12081                buf: &'a [u8],
12082                ctx: ::buffa::DecodeContext<'_>,
12083            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12084                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12085            }
12086            fn merge_view_field(
12087                &mut self,
12088                tag: ::buffa::encoding::Tag,
12089                cur: &'a [u8],
12090                before_tag: &'a [u8],
12091                ctx: ::buffa::DecodeContext<'_>,
12092            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12093                let _ = ctx;
12094                #[allow(unused_variables)]
12095                let view = self;
12096                let mut cur = cur;
12097                match tag.field_number() {
12098                    1u32 => {
12099                        ::buffa::encoding::check_wire_type(
12100                            tag,
12101                            ::buffa::encoding::WireType::Varint,
12102                        )?;
12103                        view.trigger_price_ticks = ::buffa::types::decode_int64(
12104                            &mut cur,
12105                        )?;
12106                    }
12107                    2u32 => {
12108                        ::buffa::encoding::check_wire_type(
12109                            tag,
12110                            ::buffa::encoding::WireType::Varint,
12111                        )?;
12112                        view.side = ::buffa::EnumValue::from(
12113                            ::buffa::types::decode_int32(&mut cur)?,
12114                        );
12115                    }
12116                    3u32 => {
12117                        ::buffa::encoding::check_wire_type(
12118                            tag,
12119                            ::buffa::encoding::WireType::LengthDelimited,
12120                        )?;
12121                        let __sub_ctx = ctx.descend()?;
12122                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12123                        match view.child.as_mut() {
12124                            Some(existing) => {
12125                                ::buffa::MessageView::merge_into_view(
12126                                    existing,
12127                                    sub,
12128                                    __sub_ctx,
12129                                )?
12130                            }
12131                            None => {
12132                                view.child = ::buffa::MessageFieldView::set(
12133                                    <super::super::__buffa::view::ConditionalChildExecutionView as ::buffa::MessageView>::decode_view_ctx(
12134                                        sub,
12135                                        __sub_ctx,
12136                                    )?,
12137                                );
12138                            }
12139                        }
12140                    }
12141                    _ => {
12142                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12143                        let span_len = before_tag.len() - cur.len();
12144                        view.__buffa_unknown_fields
12145                            .push_record(before_tag, span_len, ctx)?;
12146                    }
12147                }
12148                ::core::result::Result::Ok(cur)
12149            }
12150            fn to_owned_message(
12151                &self,
12152            ) -> ::core::result::Result<
12153                super::super::ConditionalTrigger,
12154                ::buffa::DecodeError,
12155            > {
12156                self.to_owned_from_source(None)
12157            }
12158            #[allow(clippy::useless_conversion, clippy::needless_update)]
12159            fn to_owned_from_source(
12160                &self,
12161                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12162            ) -> ::core::result::Result<
12163                super::super::ConditionalTrigger,
12164                ::buffa::DecodeError,
12165            > {
12166                #[allow(unused_imports)]
12167                use ::buffa::alloc::string::ToString as _;
12168                let _ = __buffa_src;
12169                ::core::result::Result::Ok(super::super::ConditionalTrigger {
12170                    trigger_price_ticks: self.trigger_price_ticks,
12171                    side: self.side,
12172                    child: match self.child.as_option() {
12173                        Some(v) => {
12174                            ::buffa::MessageField::<
12175                                super::super::ConditionalChildExecution,
12176                            >::some(v.to_owned_from_source(__buffa_src)?)
12177                        }
12178                        None => ::buffa::MessageField::none(),
12179                    },
12180                    __buffa_unknown_fields: self
12181                        .__buffa_unknown_fields
12182                        .to_owned()?
12183                        .into(),
12184                    ..::core::default::Default::default()
12185                })
12186            }
12187        }
12188        impl<'a> ::buffa::ViewEncode<'a> for ConditionalTriggerView<'a> {
12189            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12190            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12191                #[allow(unused_imports)]
12192                use ::buffa::Enumeration as _;
12193                let mut size = 0u32;
12194                if self.trigger_price_ticks != 0i64 {
12195                    size
12196                        += 1u32
12197                            + ::buffa::types::int64_encoded_len(self.trigger_price_ticks)
12198                                as u32;
12199                }
12200                {
12201                    let val = self.side.to_i32();
12202                    if val != 0 {
12203                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12204                    }
12205                }
12206                if self.child.is_set() {
12207                    let __slot = __cache.reserve();
12208                    let inner_size = self.child.compute_size(__cache);
12209                    __cache.set(__slot, inner_size);
12210                    size
12211                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12212                            + inner_size;
12213                }
12214                size += self.__buffa_unknown_fields.encoded_len() as u32;
12215                size
12216            }
12217            #[allow(clippy::needless_borrow)]
12218            fn write_to(
12219                &self,
12220                __cache: &mut ::buffa::SizeCache,
12221                buf: &mut impl ::buffa::bytes::BufMut,
12222            ) {
12223                #[allow(unused_imports)]
12224                use ::buffa::Enumeration as _;
12225                if self.trigger_price_ticks != 0i64 {
12226                    ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
12227                }
12228                {
12229                    let val = self.side.to_i32();
12230                    if val != 0 {
12231                        ::buffa::types::put_int32_field(2u32, val, buf);
12232                    }
12233                }
12234                if self.child.is_set() {
12235                    ::buffa::types::put_len_delimited_header(
12236                        3u32,
12237                        __cache.consume_next(),
12238                        buf,
12239                    );
12240                    self.child.write_to(__cache, buf);
12241                }
12242                self.__buffa_unknown_fields.write_to(buf);
12243            }
12244        }
12245        /// Serializes this view as protobuf JSON.
12246        ///
12247        /// Implicit-presence fields with default values are omitted, `required`
12248        /// fields are always emitted, explicit-presence (`optional`) fields are
12249        /// emitted only when set, bytes fields are base64-encoded, and enum
12250        /// values are their proto name strings.
12251        ///
12252        /// This impl uses `serialize_map(None)` because the number of emitted
12253        /// fields depends on default-omission rules; serializers that require
12254        /// known map lengths (e.g. `bincode`) will return a runtime error.
12255        /// Use the owned message type for those formats.
12256        impl<'__a> ::serde::Serialize for ConditionalTriggerView<'__a> {
12257            fn serialize<__S: ::serde::Serializer>(
12258                &self,
12259                __s: __S,
12260            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12261                use ::serde::ser::SerializeMap as _;
12262                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12263                if !::buffa::json_helpers::skip_if::is_zero_i64(
12264                    &self.trigger_price_ticks,
12265                ) {
12266                    __map
12267                        .serialize_entry(
12268                            "triggerPriceTicks",
12269                            &::buffa::json_helpers::ProtoJson(&self.trigger_price_ticks),
12270                        )?;
12271                }
12272                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
12273                    __map.serialize_entry("side", &self.side)?;
12274                }
12275                {
12276                    if let ::core::option::Option::Some(__v) = self.child.as_option() {
12277                        __map.serialize_entry("child", __v)?;
12278                    }
12279                }
12280                __map.end()
12281            }
12282        }
12283        impl<'a> ::buffa::MessageName for ConditionalTriggerView<'a> {
12284            const PACKAGE: &'static str = "triggers.v1";
12285            const NAME: &'static str = "ConditionalTrigger";
12286            const FULL_NAME: &'static str = "triggers.v1.ConditionalTrigger";
12287            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalTrigger";
12288        }
12289        ::buffa::impl_default_view_instance!(ConditionalTriggerView);
12290        ::buffa::impl_view_reborrow!(ConditionalTriggerView);
12291        /** Self-contained, `'static` owned view of a `ConditionalTrigger` message.
12292
12293 Wraps [`::buffa::OwnedView`]`<`[`ConditionalTriggerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
12294
12295 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ConditionalTriggerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
12296        #[derive(Clone, Debug)]
12297        pub struct ConditionalTriggerOwnedView(
12298            ::buffa::OwnedView<ConditionalTriggerView<'static>>,
12299        );
12300        impl ConditionalTriggerOwnedView {
12301            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12302            ///
12303            /// The view borrows directly from the buffer's data; the buffer is
12304            /// retained inside the returned handle.
12305            ///
12306            /// # Errors
12307            ///
12308            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12309            /// protobuf data.
12310            pub fn decode(
12311                bytes: ::buffa::bytes::Bytes,
12312            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12313                ::core::result::Result::Ok(
12314                    ConditionalTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
12315                )
12316            }
12317            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12318            /// max message size).
12319            ///
12320            /// # Errors
12321            ///
12322            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12323            /// exceeds the configured limits.
12324            pub fn decode_with_options(
12325                bytes: ::buffa::bytes::Bytes,
12326                opts: &::buffa::DecodeOptions,
12327            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12328                ::core::result::Result::Ok(
12329                    ConditionalTriggerOwnedView(
12330                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12331                    ),
12332                )
12333            }
12334            /// Build from an owned message via an encode → decode round-trip.
12335            ///
12336            /// # Errors
12337            ///
12338            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12339            /// somehow invalid (should not happen for well-formed messages).
12340            pub fn from_owned(
12341                msg: &super::super::ConditionalTrigger,
12342            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12343                ::core::result::Result::Ok(
12344                    ConditionalTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
12345                )
12346            }
12347            /// Borrow the full [`ConditionalTriggerView`] with its lifetime tied to `&self`.
12348            #[must_use]
12349            pub fn view(&self) -> &ConditionalTriggerView<'_> {
12350                self.0.reborrow()
12351            }
12352            /// Convert to the owned message type.
12353            ///
12354            /// # Errors
12355            ///
12356            /// Returns an error if re-materializing preserved unknown fields
12357            /// fails (e.g. the unknown-field limit is exceeded).
12358            pub fn to_owned_message(
12359                &self,
12360            ) -> ::core::result::Result<
12361                super::super::ConditionalTrigger,
12362                ::buffa::DecodeError,
12363            > {
12364                self.0.to_owned_message()
12365            }
12366            /// The underlying bytes buffer.
12367            #[must_use]
12368            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12369                self.0.bytes()
12370            }
12371            /// Consume the handle, returning the underlying bytes buffer.
12372            #[must_use]
12373            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12374                self.0.into_bytes()
12375            }
12376            /// Trigger threshold in quote units scaled by 1e6.
12377            ///
12378            /// Field 1: `trigger_price_ticks`
12379            #[must_use]
12380            pub fn trigger_price_ticks(&self) -> i64 {
12381                self.0.reborrow().trigger_price_ticks
12382            }
12383            /// Child order side.
12384            ///
12385            /// Field 2: `side`
12386            #[must_use]
12387            pub fn side(
12388                &self,
12389            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
12390                self.0.reborrow().side
12391            }
12392            /// Child execution.
12393            ///
12394            /// Field 3: `child`
12395            #[must_use]
12396            pub fn child(
12397                &self,
12398            ) -> &::buffa::MessageFieldView<
12399                super::super::__buffa::view::ConditionalChildExecutionView<'_>,
12400            > {
12401                &self.0.reborrow().child
12402            }
12403        }
12404        impl ::core::convert::From<::buffa::OwnedView<ConditionalTriggerView<'static>>>
12405        for ConditionalTriggerOwnedView {
12406            fn from(inner: ::buffa::OwnedView<ConditionalTriggerView<'static>>) -> Self {
12407                ConditionalTriggerOwnedView(inner)
12408            }
12409        }
12410        impl ::core::convert::From<ConditionalTriggerOwnedView>
12411        for ::buffa::OwnedView<ConditionalTriggerView<'static>> {
12412            fn from(wrapper: ConditionalTriggerOwnedView) -> Self {
12413                wrapper.0
12414            }
12415        }
12416        impl ::core::convert::AsRef<::buffa::OwnedView<ConditionalTriggerView<'static>>>
12417        for ConditionalTriggerOwnedView {
12418            fn as_ref(&self) -> &::buffa::OwnedView<ConditionalTriggerView<'static>> {
12419                &self.0
12420            }
12421        }
12422        impl ::buffa::HasMessageView for super::super::ConditionalTrigger {
12423            type View<'a> = ConditionalTriggerView<'a>;
12424            type ViewHandle = ConditionalTriggerOwnedView;
12425        }
12426        impl ::serde::Serialize for ConditionalTriggerOwnedView {
12427            fn serialize<__S: ::serde::Serializer>(
12428                &self,
12429                __s: __S,
12430            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12431                ::serde::Serialize::serialize(&self.0, __s)
12432            }
12433        }
12434        /// TrailingStopTrigger configures the supported spot trailing-stop strategy.
12435        /// It tracks last trade price and submits a SELL market-IOC child when fired.
12436        #[derive(Clone, Debug, Default)]
12437        pub struct TrailingStopTriggerView<'a> {
12438            /// Optional activation price in quote units scaled by 1e6.
12439            ///
12440            /// Field 3: `activation_price_ticks`
12441            pub activation_price_ticks: i64,
12442            pub trailing_distance: ::core::option::Option<
12443                super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance,
12444            >,
12445            pub max_slippage: ::core::option::Option<
12446                super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage,
12447            >,
12448            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12449        }
12450        impl<'a> ::buffa::MessageView<'a> for TrailingStopTriggerView<'a> {
12451            type Owned = super::super::TrailingStopTrigger;
12452            fn decode_view(
12453                buf: &'a [u8],
12454            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12455                let __limit = ::core::cell::Cell::new(
12456                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12457                );
12458                <Self as ::buffa::MessageView>::decode_view_ctx(
12459                    buf,
12460                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12461                )
12462            }
12463            fn decode_view_with_ctx(
12464                buf: &'a [u8],
12465                ctx: ::buffa::DecodeContext<'_>,
12466            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12467                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12468            }
12469            fn merge_view_field(
12470                &mut self,
12471                tag: ::buffa::encoding::Tag,
12472                cur: &'a [u8],
12473                before_tag: &'a [u8],
12474                ctx: ::buffa::DecodeContext<'_>,
12475            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12476                let _ = ctx;
12477                #[allow(unused_variables)]
12478                let view = self;
12479                let mut cur = cur;
12480                match tag.field_number() {
12481                    3u32 => {
12482                        ::buffa::encoding::check_wire_type(
12483                            tag,
12484                            ::buffa::encoding::WireType::Varint,
12485                        )?;
12486                        view.activation_price_ticks = ::buffa::types::decode_int64(
12487                            &mut cur,
12488                        )?;
12489                    }
12490                    1u32 => {
12491                        ::buffa::encoding::check_wire_type(
12492                            tag,
12493                            ::buffa::encoding::WireType::Varint,
12494                        )?;
12495                        view.trailing_distance = Some(
12496                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12497                                ::buffa::types::decode_int64(&mut cur)?,
12498                            ),
12499                        );
12500                    }
12501                    2u32 => {
12502                        ::buffa::encoding::check_wire_type(
12503                            tag,
12504                            ::buffa::encoding::WireType::Varint,
12505                        )?;
12506                        view.trailing_distance = Some(
12507                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12508                                ::buffa::types::decode_int32(&mut cur)?,
12509                            ),
12510                        );
12511                    }
12512                    4u32 => {
12513                        ::buffa::encoding::check_wire_type(
12514                            tag,
12515                            ::buffa::encoding::WireType::Varint,
12516                        )?;
12517                        view.max_slippage = Some(
12518                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12519                                ::buffa::types::decode_int32(&mut cur)?,
12520                            ),
12521                        );
12522                    }
12523                    5u32 => {
12524                        ::buffa::encoding::check_wire_type(
12525                            tag,
12526                            ::buffa::encoding::WireType::Varint,
12527                        )?;
12528                        view.max_slippage = Some(
12529                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12530                                ::buffa::types::decode_int32(&mut cur)?,
12531                            ),
12532                        );
12533                    }
12534                    _ => {
12535                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12536                        let span_len = before_tag.len() - cur.len();
12537                        view.__buffa_unknown_fields
12538                            .push_record(before_tag, span_len, ctx)?;
12539                    }
12540                }
12541                ::core::result::Result::Ok(cur)
12542            }
12543            fn to_owned_message(
12544                &self,
12545            ) -> ::core::result::Result<
12546                super::super::TrailingStopTrigger,
12547                ::buffa::DecodeError,
12548            > {
12549                self.to_owned_from_source(None)
12550            }
12551            #[allow(clippy::useless_conversion, clippy::needless_update)]
12552            fn to_owned_from_source(
12553                &self,
12554                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12555            ) -> ::core::result::Result<
12556                super::super::TrailingStopTrigger,
12557                ::buffa::DecodeError,
12558            > {
12559                #[allow(unused_imports)]
12560                use ::buffa::alloc::string::ToString as _;
12561                let _ = __buffa_src;
12562                ::core::result::Result::Ok(super::super::TrailingStopTrigger {
12563                    activation_price_ticks: self.activation_price_ticks,
12564                    trailing_distance: self
12565                        .trailing_distance
12566                        .as_ref()
12567                        .map(|v| match v {
12568                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12569                                v,
12570                            ) => {
12571                                super::super::__buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12572                                    *v,
12573                                )
12574                            }
12575                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12576                                v,
12577                            ) => {
12578                                super::super::__buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12579                                    *v,
12580                                )
12581                            }
12582                        }),
12583                    max_slippage: self
12584                        .max_slippage
12585                        .as_ref()
12586                        .map(|v| match v {
12587                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12588                                v,
12589                            ) => {
12590                                super::super::__buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12591                                    *v,
12592                                )
12593                            }
12594                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12595                                v,
12596                            ) => {
12597                                super::super::__buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12598                                    *v,
12599                                )
12600                            }
12601                        }),
12602                    __buffa_unknown_fields: self
12603                        .__buffa_unknown_fields
12604                        .to_owned()?
12605                        .into(),
12606                    ..::core::default::Default::default()
12607                })
12608            }
12609        }
12610        impl<'a> ::buffa::ViewEncode<'a> for TrailingStopTriggerView<'a> {
12611            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12612            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
12613                #[allow(unused_imports)]
12614                use ::buffa::Enumeration as _;
12615                let mut size = 0u32;
12616                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
12617                    match v {
12618                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12619                            v,
12620                        ) => {
12621                            size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
12622                        }
12623                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12624                            v,
12625                        ) => {
12626                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12627                        }
12628                    }
12629                }
12630                if self.activation_price_ticks != 0i64 {
12631                    size
12632                        += 1u32
12633                            + ::buffa::types::int64_encoded_len(
12634                                self.activation_price_ticks,
12635                            ) as u32;
12636                }
12637                if let ::core::option::Option::Some(ref v) = self.max_slippage {
12638                    match v {
12639                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12640                            v,
12641                        ) => {
12642                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12643                        }
12644                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12645                            v,
12646                        ) => {
12647                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12648                        }
12649                    }
12650                }
12651                size += self.__buffa_unknown_fields.encoded_len() as u32;
12652                size
12653            }
12654            #[allow(clippy::needless_borrow)]
12655            fn write_to(
12656                &self,
12657                _cache: &mut ::buffa::SizeCache,
12658                buf: &mut impl ::buffa::bytes::BufMut,
12659            ) {
12660                #[allow(unused_imports)]
12661                use ::buffa::Enumeration as _;
12662                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
12663                    match v {
12664                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12665                            x,
12666                        ) => {
12667                            ::buffa::types::put_int64_field(1u32, *x, buf);
12668                        }
12669                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12670                            x,
12671                        ) => {
12672                            ::buffa::types::put_int32_field(2u32, *x, buf);
12673                        }
12674                    }
12675                }
12676                if self.activation_price_ticks != 0i64 {
12677                    ::buffa::types::put_int64_field(
12678                        3u32,
12679                        self.activation_price_ticks,
12680                        buf,
12681                    );
12682                }
12683                if let ::core::option::Option::Some(ref v) = self.max_slippage {
12684                    match v {
12685                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12686                            x,
12687                        ) => {
12688                            ::buffa::types::put_int32_field(4u32, *x, buf);
12689                        }
12690                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12691                            x,
12692                        ) => {
12693                            ::buffa::types::put_int32_field(5u32, *x, buf);
12694                        }
12695                    }
12696                }
12697                self.__buffa_unknown_fields.write_to(buf);
12698            }
12699        }
12700        /// Serializes this view as protobuf JSON.
12701        ///
12702        /// Implicit-presence fields with default values are omitted, `required`
12703        /// fields are always emitted, explicit-presence (`optional`) fields are
12704        /// emitted only when set, bytes fields are base64-encoded, and enum
12705        /// values are their proto name strings.
12706        ///
12707        /// This impl uses `serialize_map(None)` because the number of emitted
12708        /// fields depends on default-omission rules; serializers that require
12709        /// known map lengths (e.g. `bincode`) will return a runtime error.
12710        /// Use the owned message type for those formats.
12711        impl<'__a> ::serde::Serialize for TrailingStopTriggerView<'__a> {
12712            fn serialize<__S: ::serde::Serializer>(
12713                &self,
12714                __s: __S,
12715            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12716                use ::serde::ser::SerializeMap as _;
12717                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12718                if !::buffa::json_helpers::skip_if::is_zero_i64(
12719                    &self.activation_price_ticks,
12720                ) {
12721                    __map
12722                        .serialize_entry(
12723                            "activationPriceTicks",
12724                            &::buffa::json_helpers::ProtoJson(
12725                                &self.activation_price_ticks,
12726                            ),
12727                        )?;
12728                }
12729                if let ::core::option::Option::Some(ref __ov) = self.trailing_distance {
12730                    match __ov {
12731                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12732                            v,
12733                        ) => {
12734                            __map
12735                                .serialize_entry(
12736                                    "trailingDistanceTicks",
12737                                    &::buffa::json_helpers::ProtoJson(v),
12738                                )?;
12739                        }
12740                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12741                            v,
12742                        ) => {
12743                            __map
12744                                .serialize_entry(
12745                                    "trailingDistanceBps",
12746                                    &::buffa::json_helpers::ProtoJson(v),
12747                                )?;
12748                        }
12749                    }
12750                }
12751                if let ::core::option::Option::Some(ref __ov) = self.max_slippage {
12752                    match __ov {
12753                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12754                            v,
12755                        ) => {
12756                            __map
12757                                .serialize_entry(
12758                                    "maxSlippageTicks",
12759                                    &::buffa::json_helpers::ProtoJson(v),
12760                                )?;
12761                        }
12762                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12763                            v,
12764                        ) => {
12765                            __map
12766                                .serialize_entry(
12767                                    "maxSlippageBps",
12768                                    &::buffa::json_helpers::ProtoJson(v),
12769                                )?;
12770                        }
12771                    }
12772                }
12773                __map.end()
12774            }
12775        }
12776        impl<'a> ::buffa::MessageName for TrailingStopTriggerView<'a> {
12777            const PACKAGE: &'static str = "triggers.v1";
12778            const NAME: &'static str = "TrailingStopTrigger";
12779            const FULL_NAME: &'static str = "triggers.v1.TrailingStopTrigger";
12780            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
12781        }
12782        ::buffa::impl_default_view_instance!(TrailingStopTriggerView);
12783        ::buffa::impl_view_reborrow!(TrailingStopTriggerView);
12784        /** Self-contained, `'static` owned view of a `TrailingStopTrigger` message.
12785
12786 Wraps [`::buffa::OwnedView`]`<`[`TrailingStopTriggerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
12787
12788 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TrailingStopTriggerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
12789        #[derive(Clone, Debug)]
12790        pub struct TrailingStopTriggerOwnedView(
12791            ::buffa::OwnedView<TrailingStopTriggerView<'static>>,
12792        );
12793        impl TrailingStopTriggerOwnedView {
12794            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12795            ///
12796            /// The view borrows directly from the buffer's data; the buffer is
12797            /// retained inside the returned handle.
12798            ///
12799            /// # Errors
12800            ///
12801            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12802            /// protobuf data.
12803            pub fn decode(
12804                bytes: ::buffa::bytes::Bytes,
12805            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12806                ::core::result::Result::Ok(
12807                    TrailingStopTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
12808                )
12809            }
12810            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12811            /// max message size).
12812            ///
12813            /// # Errors
12814            ///
12815            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12816            /// exceeds the configured limits.
12817            pub fn decode_with_options(
12818                bytes: ::buffa::bytes::Bytes,
12819                opts: &::buffa::DecodeOptions,
12820            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12821                ::core::result::Result::Ok(
12822                    TrailingStopTriggerOwnedView(
12823                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12824                    ),
12825                )
12826            }
12827            /// Build from an owned message via an encode → decode round-trip.
12828            ///
12829            /// # Errors
12830            ///
12831            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12832            /// somehow invalid (should not happen for well-formed messages).
12833            pub fn from_owned(
12834                msg: &super::super::TrailingStopTrigger,
12835            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12836                ::core::result::Result::Ok(
12837                    TrailingStopTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
12838                )
12839            }
12840            /// Borrow the full [`TrailingStopTriggerView`] with its lifetime tied to `&self`.
12841            #[must_use]
12842            pub fn view(&self) -> &TrailingStopTriggerView<'_> {
12843                self.0.reborrow()
12844            }
12845            /// Convert to the owned message type.
12846            ///
12847            /// # Errors
12848            ///
12849            /// Returns an error if re-materializing preserved unknown fields
12850            /// fails (e.g. the unknown-field limit is exceeded).
12851            pub fn to_owned_message(
12852                &self,
12853            ) -> ::core::result::Result<
12854                super::super::TrailingStopTrigger,
12855                ::buffa::DecodeError,
12856            > {
12857                self.0.to_owned_message()
12858            }
12859            /// The underlying bytes buffer.
12860            #[must_use]
12861            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12862                self.0.bytes()
12863            }
12864            /// Consume the handle, returning the underlying bytes buffer.
12865            #[must_use]
12866            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12867                self.0.into_bytes()
12868            }
12869            /// Optional activation price in quote units scaled by 1e6.
12870            ///
12871            /// Field 3: `activation_price_ticks`
12872            #[must_use]
12873            pub fn activation_price_ticks(&self) -> i64 {
12874                self.0.reborrow().activation_price_ticks
12875            }
12876            /// Oneof `trailing_distance`.
12877            #[must_use]
12878            pub fn trailing_distance(
12879                &self,
12880            ) -> ::core::option::Option<
12881                &super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance,
12882            > {
12883                self.0.reborrow().trailing_distance.as_ref()
12884            }
12885            /// Oneof `max_slippage`.
12886            #[must_use]
12887            pub fn max_slippage(
12888                &self,
12889            ) -> ::core::option::Option<
12890                &super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage,
12891            > {
12892                self.0.reborrow().max_slippage.as_ref()
12893            }
12894        }
12895        impl ::core::convert::From<::buffa::OwnedView<TrailingStopTriggerView<'static>>>
12896        for TrailingStopTriggerOwnedView {
12897            fn from(
12898                inner: ::buffa::OwnedView<TrailingStopTriggerView<'static>>,
12899            ) -> Self {
12900                TrailingStopTriggerOwnedView(inner)
12901            }
12902        }
12903        impl ::core::convert::From<TrailingStopTriggerOwnedView>
12904        for ::buffa::OwnedView<TrailingStopTriggerView<'static>> {
12905            fn from(wrapper: TrailingStopTriggerOwnedView) -> Self {
12906                wrapper.0
12907            }
12908        }
12909        impl ::core::convert::AsRef<::buffa::OwnedView<TrailingStopTriggerView<'static>>>
12910        for TrailingStopTriggerOwnedView {
12911            fn as_ref(&self) -> &::buffa::OwnedView<TrailingStopTriggerView<'static>> {
12912                &self.0
12913            }
12914        }
12915        impl ::buffa::HasMessageView for super::super::TrailingStopTrigger {
12916            type View<'a> = TrailingStopTriggerView<'a>;
12917            type ViewHandle = TrailingStopTriggerOwnedView;
12918        }
12919        impl ::serde::Serialize for TrailingStopTriggerOwnedView {
12920            fn serialize<__S: ::serde::Serializer>(
12921                &self,
12922                __s: __S,
12923            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12924                ::serde::Serialize::serialize(&self.0, __s)
12925            }
12926        }
12927        /// TwapMarketIoc configures server-priced market-IOC slices.
12928        #[derive(Clone, Debug, Default)]
12929        pub struct TwapMarketIocView<'a> {
12930            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12931        }
12932        impl<'a> ::buffa::MessageView<'a> for TwapMarketIocView<'a> {
12933            type Owned = super::super::TwapMarketIoc;
12934            fn decode_view(
12935                buf: &'a [u8],
12936            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12937                let __limit = ::core::cell::Cell::new(
12938                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12939                );
12940                <Self as ::buffa::MessageView>::decode_view_ctx(
12941                    buf,
12942                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12943                )
12944            }
12945            fn decode_view_with_ctx(
12946                buf: &'a [u8],
12947                ctx: ::buffa::DecodeContext<'_>,
12948            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12949                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12950            }
12951            fn merge_view_field(
12952                &mut self,
12953                tag: ::buffa::encoding::Tag,
12954                cur: &'a [u8],
12955                before_tag: &'a [u8],
12956                ctx: ::buffa::DecodeContext<'_>,
12957            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12958                let _ = ctx;
12959                #[allow(unused_variables)]
12960                let view = self;
12961                let mut cur = cur;
12962                match tag.field_number() {
12963                    _ => {
12964                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12965                        let span_len = before_tag.len() - cur.len();
12966                        view.__buffa_unknown_fields
12967                            .push_record(before_tag, span_len, ctx)?;
12968                    }
12969                }
12970                ::core::result::Result::Ok(cur)
12971            }
12972            fn to_owned_message(
12973                &self,
12974            ) -> ::core::result::Result<
12975                super::super::TwapMarketIoc,
12976                ::buffa::DecodeError,
12977            > {
12978                self.to_owned_from_source(None)
12979            }
12980            #[allow(clippy::useless_conversion, clippy::needless_update)]
12981            fn to_owned_from_source(
12982                &self,
12983                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12984            ) -> ::core::result::Result<
12985                super::super::TwapMarketIoc,
12986                ::buffa::DecodeError,
12987            > {
12988                #[allow(unused_imports)]
12989                use ::buffa::alloc::string::ToString as _;
12990                let _ = __buffa_src;
12991                ::core::result::Result::Ok(super::super::TwapMarketIoc {
12992                    __buffa_unknown_fields: self
12993                        .__buffa_unknown_fields
12994                        .to_owned()?
12995                        .into(),
12996                    ..::core::default::Default::default()
12997                })
12998            }
12999        }
13000        impl<'a> ::buffa::ViewEncode<'a> for TwapMarketIocView<'a> {
13001            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13002            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13003                #[allow(unused_imports)]
13004                use ::buffa::Enumeration as _;
13005                let mut size = 0u32;
13006                size += self.__buffa_unknown_fields.encoded_len() as u32;
13007                size
13008            }
13009            #[allow(clippy::needless_borrow)]
13010            fn write_to(
13011                &self,
13012                _cache: &mut ::buffa::SizeCache,
13013                buf: &mut impl ::buffa::bytes::BufMut,
13014            ) {
13015                #[allow(unused_imports)]
13016                use ::buffa::Enumeration as _;
13017                self.__buffa_unknown_fields.write_to(buf);
13018            }
13019        }
13020        /// Serializes this view as protobuf JSON.
13021        ///
13022        /// Implicit-presence fields with default values are omitted, `required`
13023        /// fields are always emitted, explicit-presence (`optional`) fields are
13024        /// emitted only when set, bytes fields are base64-encoded, and enum
13025        /// values are their proto name strings.
13026        ///
13027        /// This impl uses `serialize_map(None)` because the number of emitted
13028        /// fields depends on default-omission rules; serializers that require
13029        /// known map lengths (e.g. `bincode`) will return a runtime error.
13030        /// Use the owned message type for those formats.
13031        impl<'__a> ::serde::Serialize for TwapMarketIocView<'__a> {
13032            fn serialize<__S: ::serde::Serializer>(
13033                &self,
13034                __s: __S,
13035            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13036                use ::serde::ser::SerializeMap as _;
13037                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13038                __map.end()
13039            }
13040        }
13041        impl<'a> ::buffa::MessageName for TwapMarketIocView<'a> {
13042            const PACKAGE: &'static str = "triggers.v1";
13043            const NAME: &'static str = "TwapMarketIoc";
13044            const FULL_NAME: &'static str = "triggers.v1.TwapMarketIoc";
13045            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
13046        }
13047        ::buffa::impl_default_view_instance!(TwapMarketIocView);
13048        ::buffa::impl_view_reborrow!(TwapMarketIocView);
13049        /** Self-contained, `'static` owned view of a `TwapMarketIoc` message.
13050
13051 Wraps [`::buffa::OwnedView`]`<`[`TwapMarketIocView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13052
13053 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TwapMarketIocView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13054        #[derive(Clone, Debug)]
13055        pub struct TwapMarketIocOwnedView(
13056            ::buffa::OwnedView<TwapMarketIocView<'static>>,
13057        );
13058        impl TwapMarketIocOwnedView {
13059            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13060            ///
13061            /// The view borrows directly from the buffer's data; the buffer is
13062            /// retained inside the returned handle.
13063            ///
13064            /// # Errors
13065            ///
13066            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13067            /// protobuf data.
13068            pub fn decode(
13069                bytes: ::buffa::bytes::Bytes,
13070            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13071                ::core::result::Result::Ok(
13072                    TwapMarketIocOwnedView(::buffa::OwnedView::decode(bytes)?),
13073                )
13074            }
13075            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13076            /// max message size).
13077            ///
13078            /// # Errors
13079            ///
13080            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13081            /// exceeds the configured limits.
13082            pub fn decode_with_options(
13083                bytes: ::buffa::bytes::Bytes,
13084                opts: &::buffa::DecodeOptions,
13085            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13086                ::core::result::Result::Ok(
13087                    TwapMarketIocOwnedView(
13088                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13089                    ),
13090                )
13091            }
13092            /// Build from an owned message via an encode → decode round-trip.
13093            ///
13094            /// # Errors
13095            ///
13096            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13097            /// somehow invalid (should not happen for well-formed messages).
13098            pub fn from_owned(
13099                msg: &super::super::TwapMarketIoc,
13100            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13101                ::core::result::Result::Ok(
13102                    TwapMarketIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
13103                )
13104            }
13105            /// Borrow the full [`TwapMarketIocView`] with its lifetime tied to `&self`.
13106            #[must_use]
13107            pub fn view(&self) -> &TwapMarketIocView<'_> {
13108                self.0.reborrow()
13109            }
13110            /// Convert to the owned message type.
13111            ///
13112            /// # Errors
13113            ///
13114            /// Returns an error if re-materializing preserved unknown fields
13115            /// fails (e.g. the unknown-field limit is exceeded).
13116            pub fn to_owned_message(
13117                &self,
13118            ) -> ::core::result::Result<
13119                super::super::TwapMarketIoc,
13120                ::buffa::DecodeError,
13121            > {
13122                self.0.to_owned_message()
13123            }
13124            /// The underlying bytes buffer.
13125            #[must_use]
13126            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13127                self.0.bytes()
13128            }
13129            /// Consume the handle, returning the underlying bytes buffer.
13130            #[must_use]
13131            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13132                self.0.into_bytes()
13133            }
13134        }
13135        impl ::core::convert::From<::buffa::OwnedView<TwapMarketIocView<'static>>>
13136        for TwapMarketIocOwnedView {
13137            fn from(inner: ::buffa::OwnedView<TwapMarketIocView<'static>>) -> Self {
13138                TwapMarketIocOwnedView(inner)
13139            }
13140        }
13141        impl ::core::convert::From<TwapMarketIocOwnedView>
13142        for ::buffa::OwnedView<TwapMarketIocView<'static>> {
13143            fn from(wrapper: TwapMarketIocOwnedView) -> Self {
13144                wrapper.0
13145            }
13146        }
13147        impl ::core::convert::AsRef<::buffa::OwnedView<TwapMarketIocView<'static>>>
13148        for TwapMarketIocOwnedView {
13149            fn as_ref(&self) -> &::buffa::OwnedView<TwapMarketIocView<'static>> {
13150                &self.0
13151            }
13152        }
13153        impl ::buffa::HasMessageView for super::super::TwapMarketIoc {
13154            type View<'a> = TwapMarketIocView<'a>;
13155            type ViewHandle = TwapMarketIocOwnedView;
13156        }
13157        impl ::serde::Serialize for TwapMarketIocOwnedView {
13158            fn serialize<__S: ::serde::Serializer>(
13159                &self,
13160                __s: __S,
13161            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13162                ::serde::Serialize::serialize(&self.0, __s)
13163            }
13164        }
13165        /// TwapLimitGtc configures one resting limit slice at a time. A previous open
13166        /// slice is canceled before the next interval.
13167        #[derive(Clone, Debug, Default)]
13168        pub struct TwapLimitGtcView<'a> {
13169            /// Slice limit price in quote units scaled by 1e6.
13170            ///
13171            /// Field 1: `price_ticks`
13172            pub price_ticks: i64,
13173            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13174        }
13175        impl<'a> ::buffa::MessageView<'a> for TwapLimitGtcView<'a> {
13176            type Owned = super::super::TwapLimitGtc;
13177            fn decode_view(
13178                buf: &'a [u8],
13179            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13180                let __limit = ::core::cell::Cell::new(
13181                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13182                );
13183                <Self as ::buffa::MessageView>::decode_view_ctx(
13184                    buf,
13185                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13186                )
13187            }
13188            fn decode_view_with_ctx(
13189                buf: &'a [u8],
13190                ctx: ::buffa::DecodeContext<'_>,
13191            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13192                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13193            }
13194            fn merge_view_field(
13195                &mut self,
13196                tag: ::buffa::encoding::Tag,
13197                cur: &'a [u8],
13198                before_tag: &'a [u8],
13199                ctx: ::buffa::DecodeContext<'_>,
13200            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13201                let _ = ctx;
13202                #[allow(unused_variables)]
13203                let view = self;
13204                let mut cur = cur;
13205                match tag.field_number() {
13206                    1u32 => {
13207                        ::buffa::encoding::check_wire_type(
13208                            tag,
13209                            ::buffa::encoding::WireType::Varint,
13210                        )?;
13211                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
13212                    }
13213                    _ => {
13214                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13215                        let span_len = before_tag.len() - cur.len();
13216                        view.__buffa_unknown_fields
13217                            .push_record(before_tag, span_len, ctx)?;
13218                    }
13219                }
13220                ::core::result::Result::Ok(cur)
13221            }
13222            fn to_owned_message(
13223                &self,
13224            ) -> ::core::result::Result<
13225                super::super::TwapLimitGtc,
13226                ::buffa::DecodeError,
13227            > {
13228                self.to_owned_from_source(None)
13229            }
13230            #[allow(clippy::useless_conversion, clippy::needless_update)]
13231            fn to_owned_from_source(
13232                &self,
13233                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13234            ) -> ::core::result::Result<
13235                super::super::TwapLimitGtc,
13236                ::buffa::DecodeError,
13237            > {
13238                #[allow(unused_imports)]
13239                use ::buffa::alloc::string::ToString as _;
13240                let _ = __buffa_src;
13241                ::core::result::Result::Ok(super::super::TwapLimitGtc {
13242                    price_ticks: self.price_ticks,
13243                    __buffa_unknown_fields: self
13244                        .__buffa_unknown_fields
13245                        .to_owned()?
13246                        .into(),
13247                    ..::core::default::Default::default()
13248                })
13249            }
13250        }
13251        impl<'a> ::buffa::ViewEncode<'a> for TwapLimitGtcView<'a> {
13252            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13253            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13254                #[allow(unused_imports)]
13255                use ::buffa::Enumeration as _;
13256                let mut size = 0u32;
13257                if self.price_ticks != 0i64 {
13258                    size
13259                        += 1u32
13260                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
13261                }
13262                size += self.__buffa_unknown_fields.encoded_len() as u32;
13263                size
13264            }
13265            #[allow(clippy::needless_borrow)]
13266            fn write_to(
13267                &self,
13268                _cache: &mut ::buffa::SizeCache,
13269                buf: &mut impl ::buffa::bytes::BufMut,
13270            ) {
13271                #[allow(unused_imports)]
13272                use ::buffa::Enumeration as _;
13273                if self.price_ticks != 0i64 {
13274                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
13275                }
13276                self.__buffa_unknown_fields.write_to(buf);
13277            }
13278        }
13279        /// Serializes this view as protobuf JSON.
13280        ///
13281        /// Implicit-presence fields with default values are omitted, `required`
13282        /// fields are always emitted, explicit-presence (`optional`) fields are
13283        /// emitted only when set, bytes fields are base64-encoded, and enum
13284        /// values are their proto name strings.
13285        ///
13286        /// This impl uses `serialize_map(None)` because the number of emitted
13287        /// fields depends on default-omission rules; serializers that require
13288        /// known map lengths (e.g. `bincode`) will return a runtime error.
13289        /// Use the owned message type for those formats.
13290        impl<'__a> ::serde::Serialize for TwapLimitGtcView<'__a> {
13291            fn serialize<__S: ::serde::Serializer>(
13292                &self,
13293                __s: __S,
13294            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13295                use ::serde::ser::SerializeMap as _;
13296                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13297                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
13298                    __map
13299                        .serialize_entry(
13300                            "priceTicks",
13301                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
13302                        )?;
13303                }
13304                __map.end()
13305            }
13306        }
13307        impl<'a> ::buffa::MessageName for TwapLimitGtcView<'a> {
13308            const PACKAGE: &'static str = "triggers.v1";
13309            const NAME: &'static str = "TwapLimitGtc";
13310            const FULL_NAME: &'static str = "triggers.v1.TwapLimitGtc";
13311            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
13312        }
13313        ::buffa::impl_default_view_instance!(TwapLimitGtcView);
13314        ::buffa::impl_view_reborrow!(TwapLimitGtcView);
13315        /** Self-contained, `'static` owned view of a `TwapLimitGtc` message.
13316
13317 Wraps [`::buffa::OwnedView`]`<`[`TwapLimitGtcView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13318
13319 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TwapLimitGtcView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13320        #[derive(Clone, Debug)]
13321        pub struct TwapLimitGtcOwnedView(::buffa::OwnedView<TwapLimitGtcView<'static>>);
13322        impl TwapLimitGtcOwnedView {
13323            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13324            ///
13325            /// The view borrows directly from the buffer's data; the buffer is
13326            /// retained inside the returned handle.
13327            ///
13328            /// # Errors
13329            ///
13330            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13331            /// protobuf data.
13332            pub fn decode(
13333                bytes: ::buffa::bytes::Bytes,
13334            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13335                ::core::result::Result::Ok(
13336                    TwapLimitGtcOwnedView(::buffa::OwnedView::decode(bytes)?),
13337                )
13338            }
13339            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13340            /// max message size).
13341            ///
13342            /// # Errors
13343            ///
13344            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13345            /// exceeds the configured limits.
13346            pub fn decode_with_options(
13347                bytes: ::buffa::bytes::Bytes,
13348                opts: &::buffa::DecodeOptions,
13349            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13350                ::core::result::Result::Ok(
13351                    TwapLimitGtcOwnedView(
13352                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13353                    ),
13354                )
13355            }
13356            /// Build from an owned message via an encode → decode round-trip.
13357            ///
13358            /// # Errors
13359            ///
13360            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13361            /// somehow invalid (should not happen for well-formed messages).
13362            pub fn from_owned(
13363                msg: &super::super::TwapLimitGtc,
13364            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13365                ::core::result::Result::Ok(
13366                    TwapLimitGtcOwnedView(::buffa::OwnedView::from_owned(msg)?),
13367                )
13368            }
13369            /// Borrow the full [`TwapLimitGtcView`] with its lifetime tied to `&self`.
13370            #[must_use]
13371            pub fn view(&self) -> &TwapLimitGtcView<'_> {
13372                self.0.reborrow()
13373            }
13374            /// Convert to the owned message type.
13375            ///
13376            /// # Errors
13377            ///
13378            /// Returns an error if re-materializing preserved unknown fields
13379            /// fails (e.g. the unknown-field limit is exceeded).
13380            pub fn to_owned_message(
13381                &self,
13382            ) -> ::core::result::Result<
13383                super::super::TwapLimitGtc,
13384                ::buffa::DecodeError,
13385            > {
13386                self.0.to_owned_message()
13387            }
13388            /// The underlying bytes buffer.
13389            #[must_use]
13390            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13391                self.0.bytes()
13392            }
13393            /// Consume the handle, returning the underlying bytes buffer.
13394            #[must_use]
13395            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13396                self.0.into_bytes()
13397            }
13398            /// Slice limit price in quote units scaled by 1e6.
13399            ///
13400            /// Field 1: `price_ticks`
13401            #[must_use]
13402            pub fn price_ticks(&self) -> i64 {
13403                self.0.reborrow().price_ticks
13404            }
13405        }
13406        impl ::core::convert::From<::buffa::OwnedView<TwapLimitGtcView<'static>>>
13407        for TwapLimitGtcOwnedView {
13408            fn from(inner: ::buffa::OwnedView<TwapLimitGtcView<'static>>) -> Self {
13409                TwapLimitGtcOwnedView(inner)
13410            }
13411        }
13412        impl ::core::convert::From<TwapLimitGtcOwnedView>
13413        for ::buffa::OwnedView<TwapLimitGtcView<'static>> {
13414            fn from(wrapper: TwapLimitGtcOwnedView) -> Self {
13415                wrapper.0
13416            }
13417        }
13418        impl ::core::convert::AsRef<::buffa::OwnedView<TwapLimitGtcView<'static>>>
13419        for TwapLimitGtcOwnedView {
13420            fn as_ref(&self) -> &::buffa::OwnedView<TwapLimitGtcView<'static>> {
13421                &self.0
13422            }
13423        }
13424        impl ::buffa::HasMessageView for super::super::TwapLimitGtc {
13425            type View<'a> = TwapLimitGtcView<'a>;
13426            type ViewHandle = TwapLimitGtcOwnedView;
13427        }
13428        impl ::serde::Serialize for TwapLimitGtcOwnedView {
13429            fn serialize<__S: ::serde::Serializer>(
13430                &self,
13431                __s: __S,
13432            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13433                ::serde::Serialize::serialize(&self.0, __s)
13434            }
13435        }
13436        /// TwapTrigger configures a proven TWAP execution mode.
13437        #[derive(Clone, Debug, Default)]
13438        pub struct TwapTriggerView<'a> {
13439            /// Child side.
13440            ///
13441            /// Field 1: `side`
13442            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
13443            /// Total execution duration in milliseconds.
13444            ///
13445            /// Field 2: `duration_ms`
13446            pub duration_ms: i64,
13447            /// Interval between slices in milliseconds.
13448            ///
13449            /// Field 3: `slice_interval_ms`
13450            pub slice_interval_ms: i64,
13451            pub execution: ::core::option::Option<
13452                super::super::__buffa::view::oneof::twap_trigger::Execution<'a>,
13453            >,
13454            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13455        }
13456        impl<'a> ::buffa::MessageView<'a> for TwapTriggerView<'a> {
13457            type Owned = super::super::TwapTrigger;
13458            fn decode_view(
13459                buf: &'a [u8],
13460            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13461                let __limit = ::core::cell::Cell::new(
13462                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13463                );
13464                <Self as ::buffa::MessageView>::decode_view_ctx(
13465                    buf,
13466                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13467                )
13468            }
13469            fn decode_view_with_ctx(
13470                buf: &'a [u8],
13471                ctx: ::buffa::DecodeContext<'_>,
13472            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13473                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13474            }
13475            fn merge_view_field(
13476                &mut self,
13477                tag: ::buffa::encoding::Tag,
13478                cur: &'a [u8],
13479                before_tag: &'a [u8],
13480                ctx: ::buffa::DecodeContext<'_>,
13481            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13482                let _ = ctx;
13483                #[allow(unused_variables)]
13484                let view = self;
13485                let mut cur = cur;
13486                match tag.field_number() {
13487                    1u32 => {
13488                        ::buffa::encoding::check_wire_type(
13489                            tag,
13490                            ::buffa::encoding::WireType::Varint,
13491                        )?;
13492                        view.side = ::buffa::EnumValue::from(
13493                            ::buffa::types::decode_int32(&mut cur)?,
13494                        );
13495                    }
13496                    2u32 => {
13497                        ::buffa::encoding::check_wire_type(
13498                            tag,
13499                            ::buffa::encoding::WireType::Varint,
13500                        )?;
13501                        view.duration_ms = ::buffa::types::decode_int64(&mut cur)?;
13502                    }
13503                    3u32 => {
13504                        ::buffa::encoding::check_wire_type(
13505                            tag,
13506                            ::buffa::encoding::WireType::Varint,
13507                        )?;
13508                        view.slice_interval_ms = ::buffa::types::decode_int64(&mut cur)?;
13509                    }
13510                    4u32 => {
13511                        ::buffa::encoding::check_wire_type(
13512                            tag,
13513                            ::buffa::encoding::WireType::LengthDelimited,
13514                        )?;
13515                        let __sub_ctx = ctx.descend()?;
13516                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13517                        if let Some(
13518                            super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13519                                ref mut existing,
13520                            ),
13521                        ) = view.execution
13522                        {
13523                            ::buffa::MessageView::merge_into_view(
13524                                &mut **existing,
13525                                sub,
13526                                __sub_ctx,
13527                            )?;
13528                        } else {
13529                            view.execution = Some(
13530                                super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13531                                    ::buffa::alloc::boxed::Box::new(
13532                                        <super::super::__buffa::view::TwapMarketIocView as ::buffa::MessageView>::decode_view_ctx(
13533                                            sub,
13534                                            __sub_ctx,
13535                                        )?,
13536                                    ),
13537                                ),
13538                            );
13539                        }
13540                    }
13541                    5u32 => {
13542                        ::buffa::encoding::check_wire_type(
13543                            tag,
13544                            ::buffa::encoding::WireType::LengthDelimited,
13545                        )?;
13546                        let __sub_ctx = ctx.descend()?;
13547                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13548                        if let Some(
13549                            super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13550                                ref mut existing,
13551                            ),
13552                        ) = view.execution
13553                        {
13554                            ::buffa::MessageView::merge_into_view(
13555                                &mut **existing,
13556                                sub,
13557                                __sub_ctx,
13558                            )?;
13559                        } else {
13560                            view.execution = Some(
13561                                super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13562                                    ::buffa::alloc::boxed::Box::new(
13563                                        <super::super::__buffa::view::TwapLimitGtcView as ::buffa::MessageView>::decode_view_ctx(
13564                                            sub,
13565                                            __sub_ctx,
13566                                        )?,
13567                                    ),
13568                                ),
13569                            );
13570                        }
13571                    }
13572                    _ => {
13573                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13574                        let span_len = before_tag.len() - cur.len();
13575                        view.__buffa_unknown_fields
13576                            .push_record(before_tag, span_len, ctx)?;
13577                    }
13578                }
13579                ::core::result::Result::Ok(cur)
13580            }
13581            fn to_owned_message(
13582                &self,
13583            ) -> ::core::result::Result<
13584                super::super::TwapTrigger,
13585                ::buffa::DecodeError,
13586            > {
13587                self.to_owned_from_source(None)
13588            }
13589            #[allow(clippy::useless_conversion, clippy::needless_update)]
13590            fn to_owned_from_source(
13591                &self,
13592                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13593            ) -> ::core::result::Result<
13594                super::super::TwapTrigger,
13595                ::buffa::DecodeError,
13596            > {
13597                #[allow(unused_imports)]
13598                use ::buffa::alloc::string::ToString as _;
13599                let _ = __buffa_src;
13600                ::core::result::Result::Ok(super::super::TwapTrigger {
13601                    side: self.side,
13602                    duration_ms: self.duration_ms,
13603                    slice_interval_ms: self.slice_interval_ms,
13604                    execution: match self.execution.as_ref() {
13605                        ::core::option::Option::Some(v) => {
13606                            ::core::option::Option::Some(
13607                                match v {
13608                                    super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13609                                        v,
13610                                    ) => {
13611                                        super::super::__buffa::oneof::twap_trigger::Execution::MarketIoc(
13612                                            ::buffa::alloc::boxed::Box::new(
13613                                                v.to_owned_from_source(__buffa_src)?,
13614                                            ),
13615                                        )
13616                                    }
13617                                    super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13618                                        v,
13619                                    ) => {
13620                                        super::super::__buffa::oneof::twap_trigger::Execution::LimitGtc(
13621                                            ::buffa::alloc::boxed::Box::new(
13622                                                v.to_owned_from_source(__buffa_src)?,
13623                                            ),
13624                                        )
13625                                    }
13626                                },
13627                            )
13628                        }
13629                        ::core::option::Option::None => ::core::option::Option::None,
13630                    },
13631                    __buffa_unknown_fields: self
13632                        .__buffa_unknown_fields
13633                        .to_owned()?
13634                        .into(),
13635                    ..::core::default::Default::default()
13636                })
13637            }
13638        }
13639        impl<'a> ::buffa::ViewEncode<'a> for TwapTriggerView<'a> {
13640            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13641            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
13642                #[allow(unused_imports)]
13643                use ::buffa::Enumeration as _;
13644                let mut size = 0u32;
13645                {
13646                    let val = self.side.to_i32();
13647                    if val != 0 {
13648                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
13649                    }
13650                }
13651                if self.duration_ms != 0i64 {
13652                    size
13653                        += 1u32
13654                            + ::buffa::types::int64_encoded_len(self.duration_ms) as u32;
13655                }
13656                if self.slice_interval_ms != 0i64 {
13657                    size
13658                        += 1u32
13659                            + ::buffa::types::int64_encoded_len(self.slice_interval_ms)
13660                                as u32;
13661                }
13662                if let ::core::option::Option::Some(ref v) = self.execution {
13663                    match v {
13664                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13665                            x,
13666                        ) => {
13667                            let __slot = __cache.reserve();
13668                            let inner = x.compute_size(__cache);
13669                            __cache.set(__slot, inner);
13670                            size
13671                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
13672                                    + inner;
13673                        }
13674                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13675                            x,
13676                        ) => {
13677                            let __slot = __cache.reserve();
13678                            let inner = x.compute_size(__cache);
13679                            __cache.set(__slot, inner);
13680                            size
13681                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
13682                                    + inner;
13683                        }
13684                    }
13685                }
13686                size += self.__buffa_unknown_fields.encoded_len() as u32;
13687                size
13688            }
13689            #[allow(clippy::needless_borrow)]
13690            fn write_to(
13691                &self,
13692                __cache: &mut ::buffa::SizeCache,
13693                buf: &mut impl ::buffa::bytes::BufMut,
13694            ) {
13695                #[allow(unused_imports)]
13696                use ::buffa::Enumeration as _;
13697                {
13698                    let val = self.side.to_i32();
13699                    if val != 0 {
13700                        ::buffa::types::put_int32_field(1u32, val, buf);
13701                    }
13702                }
13703                if self.duration_ms != 0i64 {
13704                    ::buffa::types::put_int64_field(2u32, self.duration_ms, buf);
13705                }
13706                if self.slice_interval_ms != 0i64 {
13707                    ::buffa::types::put_int64_field(3u32, self.slice_interval_ms, buf);
13708                }
13709                if let ::core::option::Option::Some(ref v) = self.execution {
13710                    match v {
13711                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13712                            x,
13713                        ) => {
13714                            ::buffa::types::put_len_delimited_header(
13715                                4u32,
13716                                __cache.consume_next(),
13717                                buf,
13718                            );
13719                            x.write_to(__cache, buf);
13720                        }
13721                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13722                            x,
13723                        ) => {
13724                            ::buffa::types::put_len_delimited_header(
13725                                5u32,
13726                                __cache.consume_next(),
13727                                buf,
13728                            );
13729                            x.write_to(__cache, buf);
13730                        }
13731                    }
13732                }
13733                self.__buffa_unknown_fields.write_to(buf);
13734            }
13735        }
13736        /// Serializes this view as protobuf JSON.
13737        ///
13738        /// Implicit-presence fields with default values are omitted, `required`
13739        /// fields are always emitted, explicit-presence (`optional`) fields are
13740        /// emitted only when set, bytes fields are base64-encoded, and enum
13741        /// values are their proto name strings.
13742        ///
13743        /// This impl uses `serialize_map(None)` because the number of emitted
13744        /// fields depends on default-omission rules; serializers that require
13745        /// known map lengths (e.g. `bincode`) will return a runtime error.
13746        /// Use the owned message type for those formats.
13747        impl<'__a> ::serde::Serialize for TwapTriggerView<'__a> {
13748            fn serialize<__S: ::serde::Serializer>(
13749                &self,
13750                __s: __S,
13751            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13752                use ::serde::ser::SerializeMap as _;
13753                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13754                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
13755                    __map.serialize_entry("side", &self.side)?;
13756                }
13757                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.duration_ms) {
13758                    __map
13759                        .serialize_entry(
13760                            "durationMs",
13761                            &::buffa::json_helpers::ProtoJson(&self.duration_ms),
13762                        )?;
13763                }
13764                if !::buffa::json_helpers::skip_if::is_zero_i64(
13765                    &self.slice_interval_ms,
13766                ) {
13767                    __map
13768                        .serialize_entry(
13769                            "sliceIntervalMs",
13770                            &::buffa::json_helpers::ProtoJson(&self.slice_interval_ms),
13771                        )?;
13772                }
13773                if let ::core::option::Option::Some(ref __ov) = self.execution {
13774                    match __ov {
13775                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13776                            v,
13777                        ) => {
13778                            __map.serialize_entry("marketIoc", v)?;
13779                        }
13780                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13781                            v,
13782                        ) => {
13783                            __map.serialize_entry("limitGtc", v)?;
13784                        }
13785                    }
13786                }
13787                __map.end()
13788            }
13789        }
13790        impl<'a> ::buffa::MessageName for TwapTriggerView<'a> {
13791            const PACKAGE: &'static str = "triggers.v1";
13792            const NAME: &'static str = "TwapTrigger";
13793            const FULL_NAME: &'static str = "triggers.v1.TwapTrigger";
13794            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
13795        }
13796        ::buffa::impl_default_view_instance!(TwapTriggerView);
13797        ::buffa::impl_view_reborrow!(TwapTriggerView);
13798        /** Self-contained, `'static` owned view of a `TwapTrigger` message.
13799
13800 Wraps [`::buffa::OwnedView`]`<`[`TwapTriggerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13801
13802 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TwapTriggerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13803        #[derive(Clone, Debug)]
13804        pub struct TwapTriggerOwnedView(::buffa::OwnedView<TwapTriggerView<'static>>);
13805        impl TwapTriggerOwnedView {
13806            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13807            ///
13808            /// The view borrows directly from the buffer's data; the buffer is
13809            /// retained inside the returned handle.
13810            ///
13811            /// # Errors
13812            ///
13813            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13814            /// protobuf data.
13815            pub fn decode(
13816                bytes: ::buffa::bytes::Bytes,
13817            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13818                ::core::result::Result::Ok(
13819                    TwapTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
13820                )
13821            }
13822            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13823            /// max message size).
13824            ///
13825            /// # Errors
13826            ///
13827            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13828            /// exceeds the configured limits.
13829            pub fn decode_with_options(
13830                bytes: ::buffa::bytes::Bytes,
13831                opts: &::buffa::DecodeOptions,
13832            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13833                ::core::result::Result::Ok(
13834                    TwapTriggerOwnedView(
13835                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13836                    ),
13837                )
13838            }
13839            /// Build from an owned message via an encode → decode round-trip.
13840            ///
13841            /// # Errors
13842            ///
13843            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13844            /// somehow invalid (should not happen for well-formed messages).
13845            pub fn from_owned(
13846                msg: &super::super::TwapTrigger,
13847            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13848                ::core::result::Result::Ok(
13849                    TwapTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
13850                )
13851            }
13852            /// Borrow the full [`TwapTriggerView`] with its lifetime tied to `&self`.
13853            #[must_use]
13854            pub fn view(&self) -> &TwapTriggerView<'_> {
13855                self.0.reborrow()
13856            }
13857            /// Convert to the owned message type.
13858            ///
13859            /// # Errors
13860            ///
13861            /// Returns an error if re-materializing preserved unknown fields
13862            /// fails (e.g. the unknown-field limit is exceeded).
13863            pub fn to_owned_message(
13864                &self,
13865            ) -> ::core::result::Result<
13866                super::super::TwapTrigger,
13867                ::buffa::DecodeError,
13868            > {
13869                self.0.to_owned_message()
13870            }
13871            /// The underlying bytes buffer.
13872            #[must_use]
13873            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13874                self.0.bytes()
13875            }
13876            /// Consume the handle, returning the underlying bytes buffer.
13877            #[must_use]
13878            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13879                self.0.into_bytes()
13880            }
13881            /// Child side.
13882            ///
13883            /// Field 1: `side`
13884            #[must_use]
13885            pub fn side(
13886                &self,
13887            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
13888                self.0.reborrow().side
13889            }
13890            /// Total execution duration in milliseconds.
13891            ///
13892            /// Field 2: `duration_ms`
13893            #[must_use]
13894            pub fn duration_ms(&self) -> i64 {
13895                self.0.reborrow().duration_ms
13896            }
13897            /// Interval between slices in milliseconds.
13898            ///
13899            /// Field 3: `slice_interval_ms`
13900            #[must_use]
13901            pub fn slice_interval_ms(&self) -> i64 {
13902                self.0.reborrow().slice_interval_ms
13903            }
13904            /// Oneof `execution`.
13905            #[must_use]
13906            pub fn execution(
13907                &self,
13908            ) -> ::core::option::Option<
13909                &super::super::__buffa::view::oneof::twap_trigger::Execution<'_>,
13910            > {
13911                self.0.reborrow().execution.as_ref()
13912            }
13913        }
13914        impl ::core::convert::From<::buffa::OwnedView<TwapTriggerView<'static>>>
13915        for TwapTriggerOwnedView {
13916            fn from(inner: ::buffa::OwnedView<TwapTriggerView<'static>>) -> Self {
13917                TwapTriggerOwnedView(inner)
13918            }
13919        }
13920        impl ::core::convert::From<TwapTriggerOwnedView>
13921        for ::buffa::OwnedView<TwapTriggerView<'static>> {
13922            fn from(wrapper: TwapTriggerOwnedView) -> Self {
13923                wrapper.0
13924            }
13925        }
13926        impl ::core::convert::AsRef<::buffa::OwnedView<TwapTriggerView<'static>>>
13927        for TwapTriggerOwnedView {
13928            fn as_ref(&self) -> &::buffa::OwnedView<TwapTriggerView<'static>> {
13929                &self.0
13930            }
13931        }
13932        impl ::buffa::HasMessageView for super::super::TwapTrigger {
13933            type View<'a> = TwapTriggerView<'a>;
13934            type ViewHandle = TwapTriggerOwnedView;
13935        }
13936        impl ::serde::Serialize for TwapTriggerOwnedView {
13937            fn serialize<__S: ::serde::Serializer>(
13938                &self,
13939                __s: __S,
13940            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13941                ::serde::Serialize::serialize(&self.0, __s)
13942            }
13943        }
13944        /// LadderTrigger configures the supported LINEAR limit-GTC ladder. All levels
13945        /// are admitted immediately and may rest concurrently.
13946        #[derive(Clone, Debug, Default)]
13947        pub struct LadderTriggerView<'a> {
13948            /// Child side.
13949            ///
13950            /// Field 1: `side`
13951            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
13952            /// Minimum generated level price in quote units scaled by 1e6.
13953            ///
13954            /// Field 2: `price_min_ticks`
13955            pub price_min_ticks: i64,
13956            /// Maximum generated level price in quote units scaled by 1e6.
13957            ///
13958            /// Field 3: `price_max_ticks`
13959            pub price_max_ticks: i64,
13960            /// Number of linearly distributed levels.
13961            ///
13962            /// Field 4: `levels`
13963            pub levels: i32,
13964            /// Reject each level instead of taking liquidity.
13965            ///
13966            /// Field 5: `post_only`
13967            pub post_only: bool,
13968            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13969        }
13970        impl<'a> ::buffa::MessageView<'a> for LadderTriggerView<'a> {
13971            type Owned = super::super::LadderTrigger;
13972            fn decode_view(
13973                buf: &'a [u8],
13974            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13975                let __limit = ::core::cell::Cell::new(
13976                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13977                );
13978                <Self as ::buffa::MessageView>::decode_view_ctx(
13979                    buf,
13980                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13981                )
13982            }
13983            fn decode_view_with_ctx(
13984                buf: &'a [u8],
13985                ctx: ::buffa::DecodeContext<'_>,
13986            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13987                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13988            }
13989            fn merge_view_field(
13990                &mut self,
13991                tag: ::buffa::encoding::Tag,
13992                cur: &'a [u8],
13993                before_tag: &'a [u8],
13994                ctx: ::buffa::DecodeContext<'_>,
13995            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13996                let _ = ctx;
13997                #[allow(unused_variables)]
13998                let view = self;
13999                let mut cur = cur;
14000                match tag.field_number() {
14001                    1u32 => {
14002                        ::buffa::encoding::check_wire_type(
14003                            tag,
14004                            ::buffa::encoding::WireType::Varint,
14005                        )?;
14006                        view.side = ::buffa::EnumValue::from(
14007                            ::buffa::types::decode_int32(&mut cur)?,
14008                        );
14009                    }
14010                    2u32 => {
14011                        ::buffa::encoding::check_wire_type(
14012                            tag,
14013                            ::buffa::encoding::WireType::Varint,
14014                        )?;
14015                        view.price_min_ticks = ::buffa::types::decode_int64(&mut cur)?;
14016                    }
14017                    3u32 => {
14018                        ::buffa::encoding::check_wire_type(
14019                            tag,
14020                            ::buffa::encoding::WireType::Varint,
14021                        )?;
14022                        view.price_max_ticks = ::buffa::types::decode_int64(&mut cur)?;
14023                    }
14024                    4u32 => {
14025                        ::buffa::encoding::check_wire_type(
14026                            tag,
14027                            ::buffa::encoding::WireType::Varint,
14028                        )?;
14029                        view.levels = ::buffa::types::decode_int32(&mut cur)?;
14030                    }
14031                    5u32 => {
14032                        ::buffa::encoding::check_wire_type(
14033                            tag,
14034                            ::buffa::encoding::WireType::Varint,
14035                        )?;
14036                        view.post_only = ::buffa::types::decode_bool(&mut cur)?;
14037                    }
14038                    _ => {
14039                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14040                        let span_len = before_tag.len() - cur.len();
14041                        view.__buffa_unknown_fields
14042                            .push_record(before_tag, span_len, ctx)?;
14043                    }
14044                }
14045                ::core::result::Result::Ok(cur)
14046            }
14047            fn to_owned_message(
14048                &self,
14049            ) -> ::core::result::Result<
14050                super::super::LadderTrigger,
14051                ::buffa::DecodeError,
14052            > {
14053                self.to_owned_from_source(None)
14054            }
14055            #[allow(clippy::useless_conversion, clippy::needless_update)]
14056            fn to_owned_from_source(
14057                &self,
14058                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14059            ) -> ::core::result::Result<
14060                super::super::LadderTrigger,
14061                ::buffa::DecodeError,
14062            > {
14063                #[allow(unused_imports)]
14064                use ::buffa::alloc::string::ToString as _;
14065                let _ = __buffa_src;
14066                ::core::result::Result::Ok(super::super::LadderTrigger {
14067                    side: self.side,
14068                    price_min_ticks: self.price_min_ticks,
14069                    price_max_ticks: self.price_max_ticks,
14070                    levels: self.levels,
14071                    post_only: self.post_only,
14072                    __buffa_unknown_fields: self
14073                        .__buffa_unknown_fields
14074                        .to_owned()?
14075                        .into(),
14076                    ..::core::default::Default::default()
14077                })
14078            }
14079        }
14080        impl<'a> ::buffa::ViewEncode<'a> for LadderTriggerView<'a> {
14081            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14082            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
14083                #[allow(unused_imports)]
14084                use ::buffa::Enumeration as _;
14085                let mut size = 0u32;
14086                {
14087                    let val = self.side.to_i32();
14088                    if val != 0 {
14089                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14090                    }
14091                }
14092                if self.price_min_ticks != 0i64 {
14093                    size
14094                        += 1u32
14095                            + ::buffa::types::int64_encoded_len(self.price_min_ticks)
14096                                as u32;
14097                }
14098                if self.price_max_ticks != 0i64 {
14099                    size
14100                        += 1u32
14101                            + ::buffa::types::int64_encoded_len(self.price_max_ticks)
14102                                as u32;
14103                }
14104                if self.levels != 0i32 {
14105                    size += 1u32 + ::buffa::types::int32_encoded_len(self.levels) as u32;
14106                }
14107                if self.post_only {
14108                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14109                }
14110                size += self.__buffa_unknown_fields.encoded_len() as u32;
14111                size
14112            }
14113            #[allow(clippy::needless_borrow)]
14114            fn write_to(
14115                &self,
14116                _cache: &mut ::buffa::SizeCache,
14117                buf: &mut impl ::buffa::bytes::BufMut,
14118            ) {
14119                #[allow(unused_imports)]
14120                use ::buffa::Enumeration as _;
14121                {
14122                    let val = self.side.to_i32();
14123                    if val != 0 {
14124                        ::buffa::types::put_int32_field(1u32, val, buf);
14125                    }
14126                }
14127                if self.price_min_ticks != 0i64 {
14128                    ::buffa::types::put_int64_field(2u32, self.price_min_ticks, buf);
14129                }
14130                if self.price_max_ticks != 0i64 {
14131                    ::buffa::types::put_int64_field(3u32, self.price_max_ticks, buf);
14132                }
14133                if self.levels != 0i32 {
14134                    ::buffa::types::put_int32_field(4u32, self.levels, buf);
14135                }
14136                if self.post_only {
14137                    ::buffa::types::put_bool_field(5u32, self.post_only, buf);
14138                }
14139                self.__buffa_unknown_fields.write_to(buf);
14140            }
14141        }
14142        /// Serializes this view as protobuf JSON.
14143        ///
14144        /// Implicit-presence fields with default values are omitted, `required`
14145        /// fields are always emitted, explicit-presence (`optional`) fields are
14146        /// emitted only when set, bytes fields are base64-encoded, and enum
14147        /// values are their proto name strings.
14148        ///
14149        /// This impl uses `serialize_map(None)` because the number of emitted
14150        /// fields depends on default-omission rules; serializers that require
14151        /// known map lengths (e.g. `bincode`) will return a runtime error.
14152        /// Use the owned message type for those formats.
14153        impl<'__a> ::serde::Serialize for LadderTriggerView<'__a> {
14154            fn serialize<__S: ::serde::Serializer>(
14155                &self,
14156                __s: __S,
14157            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14158                use ::serde::ser::SerializeMap as _;
14159                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14160                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
14161                    __map.serialize_entry("side", &self.side)?;
14162                }
14163                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_min_ticks) {
14164                    __map
14165                        .serialize_entry(
14166                            "priceMinTicks",
14167                            &::buffa::json_helpers::ProtoJson(&self.price_min_ticks),
14168                        )?;
14169                }
14170                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_max_ticks) {
14171                    __map
14172                        .serialize_entry(
14173                            "priceMaxTicks",
14174                            &::buffa::json_helpers::ProtoJson(&self.price_max_ticks),
14175                        )?;
14176                }
14177                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.levels) {
14178                    __map
14179                        .serialize_entry(
14180                            "levels",
14181                            &::buffa::json_helpers::ProtoJson(&self.levels),
14182                        )?;
14183                }
14184                if self.post_only {
14185                    __map.serialize_entry("postOnly", &self.post_only)?;
14186                }
14187                __map.end()
14188            }
14189        }
14190        impl<'a> ::buffa::MessageName for LadderTriggerView<'a> {
14191            const PACKAGE: &'static str = "triggers.v1";
14192            const NAME: &'static str = "LadderTrigger";
14193            const FULL_NAME: &'static str = "triggers.v1.LadderTrigger";
14194            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
14195        }
14196        ::buffa::impl_default_view_instance!(LadderTriggerView);
14197        ::buffa::impl_view_reborrow!(LadderTriggerView);
14198        /** Self-contained, `'static` owned view of a `LadderTrigger` message.
14199
14200 Wraps [`::buffa::OwnedView`]`<`[`LadderTriggerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
14201
14202 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`LadderTriggerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
14203        #[derive(Clone, Debug)]
14204        pub struct LadderTriggerOwnedView(
14205            ::buffa::OwnedView<LadderTriggerView<'static>>,
14206        );
14207        impl LadderTriggerOwnedView {
14208            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
14209            ///
14210            /// The view borrows directly from the buffer's data; the buffer is
14211            /// retained inside the returned handle.
14212            ///
14213            /// # Errors
14214            ///
14215            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
14216            /// protobuf data.
14217            pub fn decode(
14218                bytes: ::buffa::bytes::Bytes,
14219            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14220                ::core::result::Result::Ok(
14221                    LadderTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
14222                )
14223            }
14224            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
14225            /// max message size).
14226            ///
14227            /// # Errors
14228            ///
14229            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
14230            /// exceeds the configured limits.
14231            pub fn decode_with_options(
14232                bytes: ::buffa::bytes::Bytes,
14233                opts: &::buffa::DecodeOptions,
14234            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14235                ::core::result::Result::Ok(
14236                    LadderTriggerOwnedView(
14237                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
14238                    ),
14239                )
14240            }
14241            /// Build from an owned message via an encode → decode round-trip.
14242            ///
14243            /// # Errors
14244            ///
14245            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
14246            /// somehow invalid (should not happen for well-formed messages).
14247            pub fn from_owned(
14248                msg: &super::super::LadderTrigger,
14249            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14250                ::core::result::Result::Ok(
14251                    LadderTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
14252                )
14253            }
14254            /// Borrow the full [`LadderTriggerView`] with its lifetime tied to `&self`.
14255            #[must_use]
14256            pub fn view(&self) -> &LadderTriggerView<'_> {
14257                self.0.reborrow()
14258            }
14259            /// Convert to the owned message type.
14260            ///
14261            /// # Errors
14262            ///
14263            /// Returns an error if re-materializing preserved unknown fields
14264            /// fails (e.g. the unknown-field limit is exceeded).
14265            pub fn to_owned_message(
14266                &self,
14267            ) -> ::core::result::Result<
14268                super::super::LadderTrigger,
14269                ::buffa::DecodeError,
14270            > {
14271                self.0.to_owned_message()
14272            }
14273            /// The underlying bytes buffer.
14274            #[must_use]
14275            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
14276                self.0.bytes()
14277            }
14278            /// Consume the handle, returning the underlying bytes buffer.
14279            #[must_use]
14280            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
14281                self.0.into_bytes()
14282            }
14283            /// Child side.
14284            ///
14285            /// Field 1: `side`
14286            #[must_use]
14287            pub fn side(
14288                &self,
14289            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
14290                self.0.reborrow().side
14291            }
14292            /// Minimum generated level price in quote units scaled by 1e6.
14293            ///
14294            /// Field 2: `price_min_ticks`
14295            #[must_use]
14296            pub fn price_min_ticks(&self) -> i64 {
14297                self.0.reborrow().price_min_ticks
14298            }
14299            /// Maximum generated level price in quote units scaled by 1e6.
14300            ///
14301            /// Field 3: `price_max_ticks`
14302            #[must_use]
14303            pub fn price_max_ticks(&self) -> i64 {
14304                self.0.reborrow().price_max_ticks
14305            }
14306            /// Number of linearly distributed levels.
14307            ///
14308            /// Field 4: `levels`
14309            #[must_use]
14310            pub fn levels(&self) -> i32 {
14311                self.0.reborrow().levels
14312            }
14313            /// Reject each level instead of taking liquidity.
14314            ///
14315            /// Field 5: `post_only`
14316            #[must_use]
14317            pub fn post_only(&self) -> bool {
14318                self.0.reborrow().post_only
14319            }
14320        }
14321        impl ::core::convert::From<::buffa::OwnedView<LadderTriggerView<'static>>>
14322        for LadderTriggerOwnedView {
14323            fn from(inner: ::buffa::OwnedView<LadderTriggerView<'static>>) -> Self {
14324                LadderTriggerOwnedView(inner)
14325            }
14326        }
14327        impl ::core::convert::From<LadderTriggerOwnedView>
14328        for ::buffa::OwnedView<LadderTriggerView<'static>> {
14329            fn from(wrapper: LadderTriggerOwnedView) -> Self {
14330                wrapper.0
14331            }
14332        }
14333        impl ::core::convert::AsRef<::buffa::OwnedView<LadderTriggerView<'static>>>
14334        for LadderTriggerOwnedView {
14335            fn as_ref(&self) -> &::buffa::OwnedView<LadderTriggerView<'static>> {
14336                &self.0
14337            }
14338        }
14339        impl ::buffa::HasMessageView for super::super::LadderTrigger {
14340            type View<'a> = LadderTriggerView<'a>;
14341            type ViewHandle = LadderTriggerOwnedView;
14342        }
14343        impl ::serde::Serialize for LadderTriggerOwnedView {
14344            fn serialize<__S: ::serde::Serializer>(
14345                &self,
14346                __s: __S,
14347            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14348                ::serde::Serialize::serialize(&self.0, __s)
14349            }
14350        }
14351        /// TriggerIntent contains one standalone trigger's immutable configuration.
14352        #[derive(Clone, Debug, Default)]
14353        pub struct TriggerIntentView<'a> {
14354            /// Symbol, for example "BTC-USDT".
14355            ///
14356            /// Field 1: `symbol`
14357            pub symbol: &'a str,
14358            /// Total quantity scaled by the pair's base_quantity_scale.
14359            ///
14360            /// Field 2: `qty_scaled`
14361            pub qty_scaled: i64,
14362            /// Fee asset for BUY children. SELL children must use QUOTE.
14363            ///
14364            /// Field 3: `fee_asset`
14365            pub fee_asset: ::buffa::EnumValue<
14366                super::super::super::super::orders::v1::FeeAsset,
14367            >,
14368            /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
14369            ///
14370            /// Field 4: `self_trade_prevention_mode`
14371            pub self_trade_prevention_mode: ::buffa::EnumValue<
14372                super::super::super::super::orders::v1::SelfTradePreventionMode,
14373            >,
14374            /// Client-provided trigger ID for idempotency.
14375            ///
14376            /// Field 5: `client_trigger_id`
14377            pub client_trigger_id: &'a str,
14378            pub strategy: ::core::option::Option<
14379                super::super::__buffa::view::oneof::trigger_intent::Strategy<'a>,
14380            >,
14381            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14382        }
14383        impl<'a> ::buffa::MessageView<'a> for TriggerIntentView<'a> {
14384            type Owned = super::super::TriggerIntent;
14385            fn decode_view(
14386                buf: &'a [u8],
14387            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14388                let __limit = ::core::cell::Cell::new(
14389                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14390                );
14391                <Self as ::buffa::MessageView>::decode_view_ctx(
14392                    buf,
14393                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14394                )
14395            }
14396            fn decode_view_with_ctx(
14397                buf: &'a [u8],
14398                ctx: ::buffa::DecodeContext<'_>,
14399            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14400                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14401            }
14402            fn merge_view_field(
14403                &mut self,
14404                tag: ::buffa::encoding::Tag,
14405                cur: &'a [u8],
14406                before_tag: &'a [u8],
14407                ctx: ::buffa::DecodeContext<'_>,
14408            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14409                let _ = ctx;
14410                #[allow(unused_variables)]
14411                let view = self;
14412                let mut cur = cur;
14413                match tag.field_number() {
14414                    1u32 => {
14415                        ::buffa::encoding::check_wire_type(
14416                            tag,
14417                            ::buffa::encoding::WireType::LengthDelimited,
14418                        )?;
14419                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
14420                    }
14421                    2u32 => {
14422                        ::buffa::encoding::check_wire_type(
14423                            tag,
14424                            ::buffa::encoding::WireType::Varint,
14425                        )?;
14426                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
14427                    }
14428                    3u32 => {
14429                        ::buffa::encoding::check_wire_type(
14430                            tag,
14431                            ::buffa::encoding::WireType::Varint,
14432                        )?;
14433                        view.fee_asset = ::buffa::EnumValue::from(
14434                            ::buffa::types::decode_int32(&mut cur)?,
14435                        );
14436                    }
14437                    4u32 => {
14438                        ::buffa::encoding::check_wire_type(
14439                            tag,
14440                            ::buffa::encoding::WireType::Varint,
14441                        )?;
14442                        view.self_trade_prevention_mode = ::buffa::EnumValue::from(
14443                            ::buffa::types::decode_int32(&mut cur)?,
14444                        );
14445                    }
14446                    5u32 => {
14447                        ::buffa::encoding::check_wire_type(
14448                            tag,
14449                            ::buffa::encoding::WireType::LengthDelimited,
14450                        )?;
14451                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
14452                    }
14453                    10u32 => {
14454                        ::buffa::encoding::check_wire_type(
14455                            tag,
14456                            ::buffa::encoding::WireType::LengthDelimited,
14457                        )?;
14458                        let __sub_ctx = ctx.descend()?;
14459                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14460                        if let Some(
14461                            super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14462                                ref mut existing,
14463                            ),
14464                        ) = view.strategy
14465                        {
14466                            ::buffa::MessageView::merge_into_view(
14467                                &mut **existing,
14468                                sub,
14469                                __sub_ctx,
14470                            )?;
14471                        } else {
14472                            view.strategy = Some(
14473                                super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14474                                    ::buffa::alloc::boxed::Box::new(
14475                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
14476                                            sub,
14477                                            __sub_ctx,
14478                                        )?,
14479                                    ),
14480                                ),
14481                            );
14482                        }
14483                    }
14484                    11u32 => {
14485                        ::buffa::encoding::check_wire_type(
14486                            tag,
14487                            ::buffa::encoding::WireType::LengthDelimited,
14488                        )?;
14489                        let __sub_ctx = ctx.descend()?;
14490                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14491                        if let Some(
14492                            super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14493                                ref mut existing,
14494                            ),
14495                        ) = view.strategy
14496                        {
14497                            ::buffa::MessageView::merge_into_view(
14498                                &mut **existing,
14499                                sub,
14500                                __sub_ctx,
14501                            )?;
14502                        } else {
14503                            view.strategy = Some(
14504                                super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14505                                    ::buffa::alloc::boxed::Box::new(
14506                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
14507                                            sub,
14508                                            __sub_ctx,
14509                                        )?,
14510                                    ),
14511                                ),
14512                            );
14513                        }
14514                    }
14515                    12u32 => {
14516                        ::buffa::encoding::check_wire_type(
14517                            tag,
14518                            ::buffa::encoding::WireType::LengthDelimited,
14519                        )?;
14520                        let __sub_ctx = ctx.descend()?;
14521                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14522                        if let Some(
14523                            super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14524                                ref mut existing,
14525                            ),
14526                        ) = view.strategy
14527                        {
14528                            ::buffa::MessageView::merge_into_view(
14529                                &mut **existing,
14530                                sub,
14531                                __sub_ctx,
14532                            )?;
14533                        } else {
14534                            view.strategy = Some(
14535                                super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14536                                    ::buffa::alloc::boxed::Box::new(
14537                                        <super::super::__buffa::view::TrailingStopTriggerView as ::buffa::MessageView>::decode_view_ctx(
14538                                            sub,
14539                                            __sub_ctx,
14540                                        )?,
14541                                    ),
14542                                ),
14543                            );
14544                        }
14545                    }
14546                    13u32 => {
14547                        ::buffa::encoding::check_wire_type(
14548                            tag,
14549                            ::buffa::encoding::WireType::LengthDelimited,
14550                        )?;
14551                        let __sub_ctx = ctx.descend()?;
14552                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14553                        if let Some(
14554                            super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14555                                ref mut existing,
14556                            ),
14557                        ) = view.strategy
14558                        {
14559                            ::buffa::MessageView::merge_into_view(
14560                                &mut **existing,
14561                                sub,
14562                                __sub_ctx,
14563                            )?;
14564                        } else {
14565                            view.strategy = Some(
14566                                super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14567                                    ::buffa::alloc::boxed::Box::new(
14568                                        <super::super::__buffa::view::TwapTriggerView as ::buffa::MessageView>::decode_view_ctx(
14569                                            sub,
14570                                            __sub_ctx,
14571                                        )?,
14572                                    ),
14573                                ),
14574                            );
14575                        }
14576                    }
14577                    14u32 => {
14578                        ::buffa::encoding::check_wire_type(
14579                            tag,
14580                            ::buffa::encoding::WireType::LengthDelimited,
14581                        )?;
14582                        let __sub_ctx = ctx.descend()?;
14583                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14584                        if let Some(
14585                            super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14586                                ref mut existing,
14587                            ),
14588                        ) = view.strategy
14589                        {
14590                            ::buffa::MessageView::merge_into_view(
14591                                &mut **existing,
14592                                sub,
14593                                __sub_ctx,
14594                            )?;
14595                        } else {
14596                            view.strategy = Some(
14597                                super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14598                                    ::buffa::alloc::boxed::Box::new(
14599                                        <super::super::__buffa::view::LadderTriggerView as ::buffa::MessageView>::decode_view_ctx(
14600                                            sub,
14601                                            __sub_ctx,
14602                                        )?,
14603                                    ),
14604                                ),
14605                            );
14606                        }
14607                    }
14608                    _ => {
14609                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14610                        let span_len = before_tag.len() - cur.len();
14611                        view.__buffa_unknown_fields
14612                            .push_record(before_tag, span_len, ctx)?;
14613                    }
14614                }
14615                ::core::result::Result::Ok(cur)
14616            }
14617            fn to_owned_message(
14618                &self,
14619            ) -> ::core::result::Result<
14620                super::super::TriggerIntent,
14621                ::buffa::DecodeError,
14622            > {
14623                self.to_owned_from_source(None)
14624            }
14625            #[allow(clippy::useless_conversion, clippy::needless_update)]
14626            fn to_owned_from_source(
14627                &self,
14628                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14629            ) -> ::core::result::Result<
14630                super::super::TriggerIntent,
14631                ::buffa::DecodeError,
14632            > {
14633                #[allow(unused_imports)]
14634                use ::buffa::alloc::string::ToString as _;
14635                let _ = __buffa_src;
14636                ::core::result::Result::Ok(super::super::TriggerIntent {
14637                    symbol: self.symbol.to_string(),
14638                    qty_scaled: self.qty_scaled,
14639                    fee_asset: self.fee_asset,
14640                    self_trade_prevention_mode: self.self_trade_prevention_mode,
14641                    client_trigger_id: self.client_trigger_id.to_string(),
14642                    strategy: match self.strategy.as_ref() {
14643                        ::core::option::Option::Some(v) => {
14644                            ::core::option::Option::Some(
14645                                match v {
14646                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14647                                        v,
14648                                    ) => {
14649                                        super::super::__buffa::oneof::trigger_intent::Strategy::StopLoss(
14650                                            ::buffa::alloc::boxed::Box::new(
14651                                                v.to_owned_from_source(__buffa_src)?,
14652                                            ),
14653                                        )
14654                                    }
14655                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14656                                        v,
14657                                    ) => {
14658                                        super::super::__buffa::oneof::trigger_intent::Strategy::TakeProfit(
14659                                            ::buffa::alloc::boxed::Box::new(
14660                                                v.to_owned_from_source(__buffa_src)?,
14661                                            ),
14662                                        )
14663                                    }
14664                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14665                                        v,
14666                                    ) => {
14667                                        super::super::__buffa::oneof::trigger_intent::Strategy::TrailingStop(
14668                                            ::buffa::alloc::boxed::Box::new(
14669                                                v.to_owned_from_source(__buffa_src)?,
14670                                            ),
14671                                        )
14672                                    }
14673                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14674                                        v,
14675                                    ) => {
14676                                        super::super::__buffa::oneof::trigger_intent::Strategy::Twap(
14677                                            ::buffa::alloc::boxed::Box::new(
14678                                                v.to_owned_from_source(__buffa_src)?,
14679                                            ),
14680                                        )
14681                                    }
14682                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14683                                        v,
14684                                    ) => {
14685                                        super::super::__buffa::oneof::trigger_intent::Strategy::Ladder(
14686                                            ::buffa::alloc::boxed::Box::new(
14687                                                v.to_owned_from_source(__buffa_src)?,
14688                                            ),
14689                                        )
14690                                    }
14691                                },
14692                            )
14693                        }
14694                        ::core::option::Option::None => ::core::option::Option::None,
14695                    },
14696                    __buffa_unknown_fields: self
14697                        .__buffa_unknown_fields
14698                        .to_owned()?
14699                        .into(),
14700                    ..::core::default::Default::default()
14701                })
14702            }
14703        }
14704        impl<'a> ::buffa::ViewEncode<'a> for TriggerIntentView<'a> {
14705            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14706            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14707                #[allow(unused_imports)]
14708                use ::buffa::Enumeration as _;
14709                let mut size = 0u32;
14710                if !self.symbol.is_empty() {
14711                    size
14712                        += 1u32
14713                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
14714                }
14715                if self.qty_scaled != 0i64 {
14716                    size
14717                        += 1u32
14718                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
14719                }
14720                {
14721                    let val = self.fee_asset.to_i32();
14722                    if val != 0 {
14723                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14724                    }
14725                }
14726                {
14727                    let val = self.self_trade_prevention_mode.to_i32();
14728                    if val != 0 {
14729                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14730                    }
14731                }
14732                if !self.client_trigger_id.is_empty() {
14733                    size
14734                        += 1u32
14735                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
14736                                as u32;
14737                }
14738                if let ::core::option::Option::Some(ref v) = self.strategy {
14739                    match v {
14740                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14741                            x,
14742                        ) => {
14743                            let __slot = __cache.reserve();
14744                            let inner = x.compute_size(__cache);
14745                            __cache.set(__slot, inner);
14746                            size
14747                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14748                                    + inner;
14749                        }
14750                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14751                            x,
14752                        ) => {
14753                            let __slot = __cache.reserve();
14754                            let inner = x.compute_size(__cache);
14755                            __cache.set(__slot, inner);
14756                            size
14757                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14758                                    + inner;
14759                        }
14760                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14761                            x,
14762                        ) => {
14763                            let __slot = __cache.reserve();
14764                            let inner = x.compute_size(__cache);
14765                            __cache.set(__slot, inner);
14766                            size
14767                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14768                                    + inner;
14769                        }
14770                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14771                            x,
14772                        ) => {
14773                            let __slot = __cache.reserve();
14774                            let inner = x.compute_size(__cache);
14775                            __cache.set(__slot, inner);
14776                            size
14777                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14778                                    + inner;
14779                        }
14780                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14781                            x,
14782                        ) => {
14783                            let __slot = __cache.reserve();
14784                            let inner = x.compute_size(__cache);
14785                            __cache.set(__slot, inner);
14786                            size
14787                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14788                                    + inner;
14789                        }
14790                    }
14791                }
14792                size += self.__buffa_unknown_fields.encoded_len() as u32;
14793                size
14794            }
14795            #[allow(clippy::needless_borrow)]
14796            fn write_to(
14797                &self,
14798                __cache: &mut ::buffa::SizeCache,
14799                buf: &mut impl ::buffa::bytes::BufMut,
14800            ) {
14801                #[allow(unused_imports)]
14802                use ::buffa::Enumeration as _;
14803                if !self.symbol.is_empty() {
14804                    ::buffa::types::put_string_field(1u32, &self.symbol, buf);
14805                }
14806                if self.qty_scaled != 0i64 {
14807                    ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
14808                }
14809                {
14810                    let val = self.fee_asset.to_i32();
14811                    if val != 0 {
14812                        ::buffa::types::put_int32_field(3u32, val, buf);
14813                    }
14814                }
14815                {
14816                    let val = self.self_trade_prevention_mode.to_i32();
14817                    if val != 0 {
14818                        ::buffa::types::put_int32_field(4u32, val, buf);
14819                    }
14820                }
14821                if !self.client_trigger_id.is_empty() {
14822                    ::buffa::types::put_string_field(5u32, &self.client_trigger_id, buf);
14823                }
14824                if let ::core::option::Option::Some(ref v) = self.strategy {
14825                    match v {
14826                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14827                            x,
14828                        ) => {
14829                            ::buffa::types::put_len_delimited_header(
14830                                10u32,
14831                                __cache.consume_next(),
14832                                buf,
14833                            );
14834                            x.write_to(__cache, buf);
14835                        }
14836                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14837                            x,
14838                        ) => {
14839                            ::buffa::types::put_len_delimited_header(
14840                                11u32,
14841                                __cache.consume_next(),
14842                                buf,
14843                            );
14844                            x.write_to(__cache, buf);
14845                        }
14846                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14847                            x,
14848                        ) => {
14849                            ::buffa::types::put_len_delimited_header(
14850                                12u32,
14851                                __cache.consume_next(),
14852                                buf,
14853                            );
14854                            x.write_to(__cache, buf);
14855                        }
14856                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14857                            x,
14858                        ) => {
14859                            ::buffa::types::put_len_delimited_header(
14860                                13u32,
14861                                __cache.consume_next(),
14862                                buf,
14863                            );
14864                            x.write_to(__cache, buf);
14865                        }
14866                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14867                            x,
14868                        ) => {
14869                            ::buffa::types::put_len_delimited_header(
14870                                14u32,
14871                                __cache.consume_next(),
14872                                buf,
14873                            );
14874                            x.write_to(__cache, buf);
14875                        }
14876                    }
14877                }
14878                self.__buffa_unknown_fields.write_to(buf);
14879            }
14880        }
14881        /// Serializes this view as protobuf JSON.
14882        ///
14883        /// Implicit-presence fields with default values are omitted, `required`
14884        /// fields are always emitted, explicit-presence (`optional`) fields are
14885        /// emitted only when set, bytes fields are base64-encoded, and enum
14886        /// values are their proto name strings.
14887        ///
14888        /// This impl uses `serialize_map(None)` because the number of emitted
14889        /// fields depends on default-omission rules; serializers that require
14890        /// known map lengths (e.g. `bincode`) will return a runtime error.
14891        /// Use the owned message type for those formats.
14892        impl<'__a> ::serde::Serialize for TriggerIntentView<'__a> {
14893            fn serialize<__S: ::serde::Serializer>(
14894                &self,
14895                __s: __S,
14896            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14897                use ::serde::ser::SerializeMap as _;
14898                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14899                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
14900                    __map.serialize_entry("symbol", self.symbol)?;
14901                }
14902                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
14903                    __map
14904                        .serialize_entry(
14905                            "qtyScaled",
14906                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
14907                        )?;
14908                }
14909                if !::buffa::json_helpers::skip_if::is_default_enum_value(
14910                    &self.fee_asset,
14911                ) {
14912                    __map.serialize_entry("feeAsset", &self.fee_asset)?;
14913                }
14914                if !::buffa::json_helpers::skip_if::is_default_enum_value(
14915                    &self.self_trade_prevention_mode,
14916                ) {
14917                    __map
14918                        .serialize_entry(
14919                            "selfTradePreventionMode",
14920                            &self.self_trade_prevention_mode,
14921                        )?;
14922                }
14923                if !::buffa::json_helpers::skip_if::is_empty_str(
14924                    self.client_trigger_id,
14925                ) {
14926                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
14927                }
14928                if let ::core::option::Option::Some(ref __ov) = self.strategy {
14929                    match __ov {
14930                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14931                            v,
14932                        ) => {
14933                            __map.serialize_entry("stopLoss", v)?;
14934                        }
14935                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14936                            v,
14937                        ) => {
14938                            __map.serialize_entry("takeProfit", v)?;
14939                        }
14940                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14941                            v,
14942                        ) => {
14943                            __map.serialize_entry("trailingStop", v)?;
14944                        }
14945                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14946                            v,
14947                        ) => {
14948                            __map.serialize_entry("twap", v)?;
14949                        }
14950                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14951                            v,
14952                        ) => {
14953                            __map.serialize_entry("ladder", v)?;
14954                        }
14955                    }
14956                }
14957                __map.end()
14958            }
14959        }
14960        impl<'a> ::buffa::MessageName for TriggerIntentView<'a> {
14961            const PACKAGE: &'static str = "triggers.v1";
14962            const NAME: &'static str = "TriggerIntent";
14963            const FULL_NAME: &'static str = "triggers.v1.TriggerIntent";
14964            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
14965        }
14966        ::buffa::impl_default_view_instance!(TriggerIntentView);
14967        ::buffa::impl_view_reborrow!(TriggerIntentView);
14968        /** Self-contained, `'static` owned view of a `TriggerIntent` message.
14969
14970 Wraps [`::buffa::OwnedView`]`<`[`TriggerIntentView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
14971
14972 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerIntentView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
14973        #[derive(Clone, Debug)]
14974        pub struct TriggerIntentOwnedView(
14975            ::buffa::OwnedView<TriggerIntentView<'static>>,
14976        );
14977        impl TriggerIntentOwnedView {
14978            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
14979            ///
14980            /// The view borrows directly from the buffer's data; the buffer is
14981            /// retained inside the returned handle.
14982            ///
14983            /// # Errors
14984            ///
14985            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
14986            /// protobuf data.
14987            pub fn decode(
14988                bytes: ::buffa::bytes::Bytes,
14989            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14990                ::core::result::Result::Ok(
14991                    TriggerIntentOwnedView(::buffa::OwnedView::decode(bytes)?),
14992                )
14993            }
14994            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
14995            /// max message size).
14996            ///
14997            /// # Errors
14998            ///
14999            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15000            /// exceeds the configured limits.
15001            pub fn decode_with_options(
15002                bytes: ::buffa::bytes::Bytes,
15003                opts: &::buffa::DecodeOptions,
15004            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15005                ::core::result::Result::Ok(
15006                    TriggerIntentOwnedView(
15007                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15008                    ),
15009                )
15010            }
15011            /// Build from an owned message via an encode → decode round-trip.
15012            ///
15013            /// # Errors
15014            ///
15015            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15016            /// somehow invalid (should not happen for well-formed messages).
15017            pub fn from_owned(
15018                msg: &super::super::TriggerIntent,
15019            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15020                ::core::result::Result::Ok(
15021                    TriggerIntentOwnedView(::buffa::OwnedView::from_owned(msg)?),
15022                )
15023            }
15024            /// Borrow the full [`TriggerIntentView`] with its lifetime tied to `&self`.
15025            #[must_use]
15026            pub fn view(&self) -> &TriggerIntentView<'_> {
15027                self.0.reborrow()
15028            }
15029            /// Convert to the owned message type.
15030            ///
15031            /// # Errors
15032            ///
15033            /// Returns an error if re-materializing preserved unknown fields
15034            /// fails (e.g. the unknown-field limit is exceeded).
15035            pub fn to_owned_message(
15036                &self,
15037            ) -> ::core::result::Result<
15038                super::super::TriggerIntent,
15039                ::buffa::DecodeError,
15040            > {
15041                self.0.to_owned_message()
15042            }
15043            /// The underlying bytes buffer.
15044            #[must_use]
15045            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15046                self.0.bytes()
15047            }
15048            /// Consume the handle, returning the underlying bytes buffer.
15049            #[must_use]
15050            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15051                self.0.into_bytes()
15052            }
15053            /// Symbol, for example "BTC-USDT".
15054            ///
15055            /// Field 1: `symbol`
15056            #[must_use]
15057            pub fn symbol(&self) -> &'_ str {
15058                self.0.reborrow().symbol
15059            }
15060            /// Total quantity scaled by the pair's base_quantity_scale.
15061            ///
15062            /// Field 2: `qty_scaled`
15063            #[must_use]
15064            pub fn qty_scaled(&self) -> i64 {
15065                self.0.reborrow().qty_scaled
15066            }
15067            /// Fee asset for BUY children. SELL children must use QUOTE.
15068            ///
15069            /// Field 3: `fee_asset`
15070            #[must_use]
15071            pub fn fee_asset(
15072                &self,
15073            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::FeeAsset> {
15074                self.0.reborrow().fee_asset
15075            }
15076            /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
15077            ///
15078            /// Field 4: `self_trade_prevention_mode`
15079            #[must_use]
15080            pub fn self_trade_prevention_mode(
15081                &self,
15082            ) -> ::buffa::EnumValue<
15083                super::super::super::super::orders::v1::SelfTradePreventionMode,
15084            > {
15085                self.0.reborrow().self_trade_prevention_mode
15086            }
15087            /// Client-provided trigger ID for idempotency.
15088            ///
15089            /// Field 5: `client_trigger_id`
15090            #[must_use]
15091            pub fn client_trigger_id(&self) -> &'_ str {
15092                self.0.reborrow().client_trigger_id
15093            }
15094            /// Oneof `strategy`.
15095            #[must_use]
15096            pub fn strategy(
15097                &self,
15098            ) -> ::core::option::Option<
15099                &super::super::__buffa::view::oneof::trigger_intent::Strategy<'_>,
15100            > {
15101                self.0.reborrow().strategy.as_ref()
15102            }
15103        }
15104        impl ::core::convert::From<::buffa::OwnedView<TriggerIntentView<'static>>>
15105        for TriggerIntentOwnedView {
15106            fn from(inner: ::buffa::OwnedView<TriggerIntentView<'static>>) -> Self {
15107                TriggerIntentOwnedView(inner)
15108            }
15109        }
15110        impl ::core::convert::From<TriggerIntentOwnedView>
15111        for ::buffa::OwnedView<TriggerIntentView<'static>> {
15112            fn from(wrapper: TriggerIntentOwnedView) -> Self {
15113                wrapper.0
15114            }
15115        }
15116        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerIntentView<'static>>>
15117        for TriggerIntentOwnedView {
15118            fn as_ref(&self) -> &::buffa::OwnedView<TriggerIntentView<'static>> {
15119                &self.0
15120            }
15121        }
15122        impl ::buffa::HasMessageView for super::super::TriggerIntent {
15123            type View<'a> = TriggerIntentView<'a>;
15124            type ViewHandle = TriggerIntentOwnedView;
15125        }
15126        impl ::serde::Serialize for TriggerIntentOwnedView {
15127            fn serialize<__S: ::serde::Serializer>(
15128                &self,
15129                __s: __S,
15130            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15131                ::serde::Serialize::serialize(&self.0, __s)
15132            }
15133        }
15134        /// CreateTriggerRequest submits one standalone trigger intent for admission.
15135        #[derive(Clone, Debug, Default)]
15136        pub struct CreateTriggerRequestView<'a> {
15137            /// Target sub-account. When omitted, uses the caller's root account.
15138            ///
15139            /// Field 1: `subaccount_id`
15140            pub subaccount_id: ::core::option::Option<u64>,
15141            /// Trigger to admit.
15142            ///
15143            /// Field 2: `trigger`
15144            pub trigger: ::buffa::MessageFieldView<
15145                super::super::__buffa::view::TriggerIntentView<'a>,
15146            >,
15147            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15148        }
15149        impl<'a> ::buffa::MessageView<'a> for CreateTriggerRequestView<'a> {
15150            type Owned = super::super::CreateTriggerRequest;
15151            fn decode_view(
15152                buf: &'a [u8],
15153            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15154                let __limit = ::core::cell::Cell::new(
15155                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15156                );
15157                <Self as ::buffa::MessageView>::decode_view_ctx(
15158                    buf,
15159                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15160                )
15161            }
15162            fn decode_view_with_ctx(
15163                buf: &'a [u8],
15164                ctx: ::buffa::DecodeContext<'_>,
15165            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15166                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15167            }
15168            fn merge_view_field(
15169                &mut self,
15170                tag: ::buffa::encoding::Tag,
15171                cur: &'a [u8],
15172                before_tag: &'a [u8],
15173                ctx: ::buffa::DecodeContext<'_>,
15174            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15175                let _ = ctx;
15176                #[allow(unused_variables)]
15177                let view = self;
15178                let mut cur = cur;
15179                match tag.field_number() {
15180                    1u32 => {
15181                        ::buffa::encoding::check_wire_type(
15182                            tag,
15183                            ::buffa::encoding::WireType::Fixed64,
15184                        )?;
15185                        view.subaccount_id = Some(
15186                            ::buffa::types::decode_fixed64(&mut cur)?,
15187                        );
15188                    }
15189                    2u32 => {
15190                        ::buffa::encoding::check_wire_type(
15191                            tag,
15192                            ::buffa::encoding::WireType::LengthDelimited,
15193                        )?;
15194                        let __sub_ctx = ctx.descend()?;
15195                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15196                        match view.trigger.as_mut() {
15197                            Some(existing) => {
15198                                ::buffa::MessageView::merge_into_view(
15199                                    existing,
15200                                    sub,
15201                                    __sub_ctx,
15202                                )?
15203                            }
15204                            None => {
15205                                view.trigger = ::buffa::MessageFieldView::set(
15206                                    <super::super::__buffa::view::TriggerIntentView as ::buffa::MessageView>::decode_view_ctx(
15207                                        sub,
15208                                        __sub_ctx,
15209                                    )?,
15210                                );
15211                            }
15212                        }
15213                    }
15214                    _ => {
15215                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15216                        let span_len = before_tag.len() - cur.len();
15217                        view.__buffa_unknown_fields
15218                            .push_record(before_tag, span_len, ctx)?;
15219                    }
15220                }
15221                ::core::result::Result::Ok(cur)
15222            }
15223            fn to_owned_message(
15224                &self,
15225            ) -> ::core::result::Result<
15226                super::super::CreateTriggerRequest,
15227                ::buffa::DecodeError,
15228            > {
15229                self.to_owned_from_source(None)
15230            }
15231            #[allow(clippy::useless_conversion, clippy::needless_update)]
15232            fn to_owned_from_source(
15233                &self,
15234                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15235            ) -> ::core::result::Result<
15236                super::super::CreateTriggerRequest,
15237                ::buffa::DecodeError,
15238            > {
15239                #[allow(unused_imports)]
15240                use ::buffa::alloc::string::ToString as _;
15241                let _ = __buffa_src;
15242                ::core::result::Result::Ok(super::super::CreateTriggerRequest {
15243                    subaccount_id: self.subaccount_id,
15244                    trigger: match self.trigger.as_option() {
15245                        Some(v) => {
15246                            ::buffa::MessageField::<
15247                                super::super::TriggerIntent,
15248                            >::some(v.to_owned_from_source(__buffa_src)?)
15249                        }
15250                        None => ::buffa::MessageField::none(),
15251                    },
15252                    __buffa_unknown_fields: self
15253                        .__buffa_unknown_fields
15254                        .to_owned()?
15255                        .into(),
15256                    ..::core::default::Default::default()
15257                })
15258            }
15259        }
15260        impl<'a> ::buffa::ViewEncode<'a> for CreateTriggerRequestView<'a> {
15261            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15262            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15263                #[allow(unused_imports)]
15264                use ::buffa::Enumeration as _;
15265                let mut size = 0u32;
15266                if self.subaccount_id.is_some() {
15267                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15268                }
15269                if self.trigger.is_set() {
15270                    let __slot = __cache.reserve();
15271                    let inner_size = self.trigger.compute_size(__cache);
15272                    __cache.set(__slot, inner_size);
15273                    size
15274                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15275                            + inner_size;
15276                }
15277                size += self.__buffa_unknown_fields.encoded_len() as u32;
15278                size
15279            }
15280            #[allow(clippy::needless_borrow)]
15281            fn write_to(
15282                &self,
15283                __cache: &mut ::buffa::SizeCache,
15284                buf: &mut impl ::buffa::bytes::BufMut,
15285            ) {
15286                #[allow(unused_imports)]
15287                use ::buffa::Enumeration as _;
15288                if let Some(v) = self.subaccount_id {
15289                    ::buffa::types::put_fixed64_field(1u32, v, buf);
15290                }
15291                if self.trigger.is_set() {
15292                    ::buffa::types::put_len_delimited_header(
15293                        2u32,
15294                        __cache.consume_next(),
15295                        buf,
15296                    );
15297                    self.trigger.write_to(__cache, buf);
15298                }
15299                self.__buffa_unknown_fields.write_to(buf);
15300            }
15301        }
15302        /// Serializes this view as protobuf JSON.
15303        ///
15304        /// Implicit-presence fields with default values are omitted, `required`
15305        /// fields are always emitted, explicit-presence (`optional`) fields are
15306        /// emitted only when set, bytes fields are base64-encoded, and enum
15307        /// values are their proto name strings.
15308        ///
15309        /// This impl uses `serialize_map(None)` because the number of emitted
15310        /// fields depends on default-omission rules; serializers that require
15311        /// known map lengths (e.g. `bincode`) will return a runtime error.
15312        /// Use the owned message type for those formats.
15313        impl<'__a> ::serde::Serialize for CreateTriggerRequestView<'__a> {
15314            fn serialize<__S: ::serde::Serializer>(
15315                &self,
15316                __s: __S,
15317            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15318                use ::serde::ser::SerializeMap as _;
15319                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15320                if let ::core::option::Option::Some(__v) = self.subaccount_id {
15321                    __map
15322                        .serialize_entry(
15323                            "subaccountId",
15324                            &::buffa::json_helpers::ProtoJson(&__v),
15325                        )?;
15326                }
15327                {
15328                    if let ::core::option::Option::Some(__v) = self.trigger.as_option() {
15329                        __map.serialize_entry("trigger", __v)?;
15330                    }
15331                }
15332                __map.end()
15333            }
15334        }
15335        impl<'a> ::buffa::MessageName for CreateTriggerRequestView<'a> {
15336            const PACKAGE: &'static str = "triggers.v1";
15337            const NAME: &'static str = "CreateTriggerRequest";
15338            const FULL_NAME: &'static str = "triggers.v1.CreateTriggerRequest";
15339            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
15340        }
15341        ::buffa::impl_default_view_instance!(CreateTriggerRequestView);
15342        ::buffa::impl_view_reborrow!(CreateTriggerRequestView);
15343        /** Self-contained, `'static` owned view of a `CreateTriggerRequest` message.
15344
15345 Wraps [`::buffa::OwnedView`]`<`[`CreateTriggerRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
15346
15347 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateTriggerRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
15348        #[derive(Clone, Debug)]
15349        pub struct CreateTriggerRequestOwnedView(
15350            ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15351        );
15352        impl CreateTriggerRequestOwnedView {
15353            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15354            ///
15355            /// The view borrows directly from the buffer's data; the buffer is
15356            /// retained inside the returned handle.
15357            ///
15358            /// # Errors
15359            ///
15360            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15361            /// protobuf data.
15362            pub fn decode(
15363                bytes: ::buffa::bytes::Bytes,
15364            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15365                ::core::result::Result::Ok(
15366                    CreateTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
15367                )
15368            }
15369            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15370            /// max message size).
15371            ///
15372            /// # Errors
15373            ///
15374            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15375            /// exceeds the configured limits.
15376            pub fn decode_with_options(
15377                bytes: ::buffa::bytes::Bytes,
15378                opts: &::buffa::DecodeOptions,
15379            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15380                ::core::result::Result::Ok(
15381                    CreateTriggerRequestOwnedView(
15382                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15383                    ),
15384                )
15385            }
15386            /// Build from an owned message via an encode → decode round-trip.
15387            ///
15388            /// # Errors
15389            ///
15390            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15391            /// somehow invalid (should not happen for well-formed messages).
15392            pub fn from_owned(
15393                msg: &super::super::CreateTriggerRequest,
15394            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15395                ::core::result::Result::Ok(
15396                    CreateTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
15397                )
15398            }
15399            /// Borrow the full [`CreateTriggerRequestView`] with its lifetime tied to `&self`.
15400            #[must_use]
15401            pub fn view(&self) -> &CreateTriggerRequestView<'_> {
15402                self.0.reborrow()
15403            }
15404            /// Convert to the owned message type.
15405            ///
15406            /// # Errors
15407            ///
15408            /// Returns an error if re-materializing preserved unknown fields
15409            /// fails (e.g. the unknown-field limit is exceeded).
15410            pub fn to_owned_message(
15411                &self,
15412            ) -> ::core::result::Result<
15413                super::super::CreateTriggerRequest,
15414                ::buffa::DecodeError,
15415            > {
15416                self.0.to_owned_message()
15417            }
15418            /// The underlying bytes buffer.
15419            #[must_use]
15420            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15421                self.0.bytes()
15422            }
15423            /// Consume the handle, returning the underlying bytes buffer.
15424            #[must_use]
15425            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15426                self.0.into_bytes()
15427            }
15428            /// Target sub-account. When omitted, uses the caller's root account.
15429            ///
15430            /// Field 1: `subaccount_id`
15431            #[must_use]
15432            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
15433                self.0.reborrow().subaccount_id
15434            }
15435            /// Trigger to admit.
15436            ///
15437            /// Field 2: `trigger`
15438            #[must_use]
15439            pub fn trigger(
15440                &self,
15441            ) -> &::buffa::MessageFieldView<
15442                super::super::__buffa::view::TriggerIntentView<'_>,
15443            > {
15444                &self.0.reborrow().trigger
15445            }
15446        }
15447        impl ::core::convert::From<::buffa::OwnedView<CreateTriggerRequestView<'static>>>
15448        for CreateTriggerRequestOwnedView {
15449            fn from(
15450                inner: ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15451            ) -> Self {
15452                CreateTriggerRequestOwnedView(inner)
15453            }
15454        }
15455        impl ::core::convert::From<CreateTriggerRequestOwnedView>
15456        for ::buffa::OwnedView<CreateTriggerRequestView<'static>> {
15457            fn from(wrapper: CreateTriggerRequestOwnedView) -> Self {
15458                wrapper.0
15459            }
15460        }
15461        impl ::core::convert::AsRef<
15462            ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15463        > for CreateTriggerRequestOwnedView {
15464            fn as_ref(&self) -> &::buffa::OwnedView<CreateTriggerRequestView<'static>> {
15465                &self.0
15466            }
15467        }
15468        impl ::buffa::HasMessageView for super::super::CreateTriggerRequest {
15469            type View<'a> = CreateTriggerRequestView<'a>;
15470            type ViewHandle = CreateTriggerRequestOwnedView;
15471        }
15472        impl ::serde::Serialize for CreateTriggerRequestOwnedView {
15473            fn serialize<__S: ::serde::Serializer>(
15474                &self,
15475                __s: __S,
15476            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15477                ::serde::Serialize::serialize(&self.0, __s)
15478            }
15479        }
15480        /// CreateTriggerResponse acknowledges trigger creation only. Arming and child
15481        /// execution happen asynchronously and are visible through trigger reads/events.
15482        #[derive(Clone, Debug, Default)]
15483        pub struct CreateTriggerResponseView<'a> {
15484            /// Assigned trigger ID.
15485            ///
15486            /// Field 1: `trigger_id`
15487            pub trigger_id: u64,
15488            /// Echoed client trigger ID.
15489            ///
15490            /// Field 2: `client_trigger_id`
15491            pub client_trigger_id: &'a str,
15492            /// Time creation admission completed.
15493            ///
15494            /// Field 3: `accepted_at`
15495            pub accepted_at: ::buffa::MessageFieldView<
15496                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
15497            >,
15498            /// Admission completion time in nanoseconds since epoch (UTC).
15499            ///
15500            /// Field 4: `accepted_at_ts_ns`
15501            pub accepted_at_ts_ns: u64,
15502            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15503        }
15504        impl<'a> ::buffa::MessageView<'a> for CreateTriggerResponseView<'a> {
15505            type Owned = super::super::CreateTriggerResponse;
15506            fn decode_view(
15507                buf: &'a [u8],
15508            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15509                let __limit = ::core::cell::Cell::new(
15510                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15511                );
15512                <Self as ::buffa::MessageView>::decode_view_ctx(
15513                    buf,
15514                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15515                )
15516            }
15517            fn decode_view_with_ctx(
15518                buf: &'a [u8],
15519                ctx: ::buffa::DecodeContext<'_>,
15520            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15521                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15522            }
15523            fn merge_view_field(
15524                &mut self,
15525                tag: ::buffa::encoding::Tag,
15526                cur: &'a [u8],
15527                before_tag: &'a [u8],
15528                ctx: ::buffa::DecodeContext<'_>,
15529            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15530                let _ = ctx;
15531                #[allow(unused_variables)]
15532                let view = self;
15533                let mut cur = cur;
15534                match tag.field_number() {
15535                    1u32 => {
15536                        ::buffa::encoding::check_wire_type(
15537                            tag,
15538                            ::buffa::encoding::WireType::Fixed64,
15539                        )?;
15540                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
15541                    }
15542                    2u32 => {
15543                        ::buffa::encoding::check_wire_type(
15544                            tag,
15545                            ::buffa::encoding::WireType::LengthDelimited,
15546                        )?;
15547                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
15548                    }
15549                    3u32 => {
15550                        ::buffa::encoding::check_wire_type(
15551                            tag,
15552                            ::buffa::encoding::WireType::LengthDelimited,
15553                        )?;
15554                        let __sub_ctx = ctx.descend()?;
15555                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15556                        match view.accepted_at.as_mut() {
15557                            Some(existing) => {
15558                                ::buffa::MessageView::merge_into_view(
15559                                    existing,
15560                                    sub,
15561                                    __sub_ctx,
15562                                )?
15563                            }
15564                            None => {
15565                                view.accepted_at = ::buffa::MessageFieldView::set(
15566                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
15567                                        sub,
15568                                        __sub_ctx,
15569                                    )?,
15570                                );
15571                            }
15572                        }
15573                    }
15574                    4u32 => {
15575                        ::buffa::encoding::check_wire_type(
15576                            tag,
15577                            ::buffa::encoding::WireType::Varint,
15578                        )?;
15579                        view.accepted_at_ts_ns = ::buffa::types::decode_uint64(
15580                            &mut cur,
15581                        )?;
15582                    }
15583                    _ => {
15584                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15585                        let span_len = before_tag.len() - cur.len();
15586                        view.__buffa_unknown_fields
15587                            .push_record(before_tag, span_len, ctx)?;
15588                    }
15589                }
15590                ::core::result::Result::Ok(cur)
15591            }
15592            fn to_owned_message(
15593                &self,
15594            ) -> ::core::result::Result<
15595                super::super::CreateTriggerResponse,
15596                ::buffa::DecodeError,
15597            > {
15598                self.to_owned_from_source(None)
15599            }
15600            #[allow(clippy::useless_conversion, clippy::needless_update)]
15601            fn to_owned_from_source(
15602                &self,
15603                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15604            ) -> ::core::result::Result<
15605                super::super::CreateTriggerResponse,
15606                ::buffa::DecodeError,
15607            > {
15608                #[allow(unused_imports)]
15609                use ::buffa::alloc::string::ToString as _;
15610                let _ = __buffa_src;
15611                ::core::result::Result::Ok(super::super::CreateTriggerResponse {
15612                    trigger_id: self.trigger_id,
15613                    client_trigger_id: self.client_trigger_id.to_string(),
15614                    accepted_at: match self.accepted_at.as_option() {
15615                        Some(v) => {
15616                            ::buffa::MessageField::<
15617                                ::buffa_types::google::protobuf::Timestamp,
15618                            >::some(v.to_owned_from_source(__buffa_src)?)
15619                        }
15620                        None => ::buffa::MessageField::none(),
15621                    },
15622                    accepted_at_ts_ns: self.accepted_at_ts_ns,
15623                    __buffa_unknown_fields: self
15624                        .__buffa_unknown_fields
15625                        .to_owned()?
15626                        .into(),
15627                    ..::core::default::Default::default()
15628                })
15629            }
15630        }
15631        impl<'a> ::buffa::ViewEncode<'a> for CreateTriggerResponseView<'a> {
15632            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15633            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15634                #[allow(unused_imports)]
15635                use ::buffa::Enumeration as _;
15636                let mut size = 0u32;
15637                if self.trigger_id != 0u64 {
15638                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15639                }
15640                if !self.client_trigger_id.is_empty() {
15641                    size
15642                        += 1u32
15643                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
15644                                as u32;
15645                }
15646                if self.accepted_at.is_set() {
15647                    let __slot = __cache.reserve();
15648                    let inner_size = self.accepted_at.compute_size(__cache);
15649                    __cache.set(__slot, inner_size);
15650                    size
15651                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15652                            + inner_size;
15653                }
15654                if self.accepted_at_ts_ns != 0u64 {
15655                    size
15656                        += 1u32
15657                            + ::buffa::types::uint64_encoded_len(self.accepted_at_ts_ns)
15658                                as u32;
15659                }
15660                size += self.__buffa_unknown_fields.encoded_len() as u32;
15661                size
15662            }
15663            #[allow(clippy::needless_borrow)]
15664            fn write_to(
15665                &self,
15666                __cache: &mut ::buffa::SizeCache,
15667                buf: &mut impl ::buffa::bytes::BufMut,
15668            ) {
15669                #[allow(unused_imports)]
15670                use ::buffa::Enumeration as _;
15671                if self.trigger_id != 0u64 {
15672                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
15673                }
15674                if !self.client_trigger_id.is_empty() {
15675                    ::buffa::types::put_string_field(2u32, &self.client_trigger_id, buf);
15676                }
15677                if self.accepted_at.is_set() {
15678                    ::buffa::types::put_len_delimited_header(
15679                        3u32,
15680                        __cache.consume_next(),
15681                        buf,
15682                    );
15683                    self.accepted_at.write_to(__cache, buf);
15684                }
15685                if self.accepted_at_ts_ns != 0u64 {
15686                    ::buffa::types::put_uint64_field(4u32, self.accepted_at_ts_ns, buf);
15687                }
15688                self.__buffa_unknown_fields.write_to(buf);
15689            }
15690        }
15691        /// Serializes this view as protobuf JSON.
15692        ///
15693        /// Implicit-presence fields with default values are omitted, `required`
15694        /// fields are always emitted, explicit-presence (`optional`) fields are
15695        /// emitted only when set, bytes fields are base64-encoded, and enum
15696        /// values are their proto name strings.
15697        ///
15698        /// This impl uses `serialize_map(None)` because the number of emitted
15699        /// fields depends on default-omission rules; serializers that require
15700        /// known map lengths (e.g. `bincode`) will return a runtime error.
15701        /// Use the owned message type for those formats.
15702        impl<'__a> ::serde::Serialize for CreateTriggerResponseView<'__a> {
15703            fn serialize<__S: ::serde::Serializer>(
15704                &self,
15705                __s: __S,
15706            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15707                use ::serde::ser::SerializeMap as _;
15708                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15709                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
15710                    __map
15711                        .serialize_entry(
15712                            "triggerId",
15713                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
15714                        )?;
15715                }
15716                if !::buffa::json_helpers::skip_if::is_empty_str(
15717                    self.client_trigger_id,
15718                ) {
15719                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
15720                }
15721                {
15722                    if let ::core::option::Option::Some(__v) = self
15723                        .accepted_at
15724                        .as_option()
15725                    {
15726                        __map.serialize_entry("acceptedAt", __v)?;
15727                    }
15728                }
15729                if !::buffa::json_helpers::skip_if::is_zero_u64(
15730                    &self.accepted_at_ts_ns,
15731                ) {
15732                    __map
15733                        .serialize_entry(
15734                            "acceptedAtTsNs",
15735                            &::buffa::json_helpers::ProtoJson(&self.accepted_at_ts_ns),
15736                        )?;
15737                }
15738                __map.end()
15739            }
15740        }
15741        impl<'a> ::buffa::MessageName for CreateTriggerResponseView<'a> {
15742            const PACKAGE: &'static str = "triggers.v1";
15743            const NAME: &'static str = "CreateTriggerResponse";
15744            const FULL_NAME: &'static str = "triggers.v1.CreateTriggerResponse";
15745            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
15746        }
15747        ::buffa::impl_default_view_instance!(CreateTriggerResponseView);
15748        ::buffa::impl_view_reborrow!(CreateTriggerResponseView);
15749        /** Self-contained, `'static` owned view of a `CreateTriggerResponse` message.
15750
15751 Wraps [`::buffa::OwnedView`]`<`[`CreateTriggerResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
15752
15753 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CreateTriggerResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
15754        #[derive(Clone, Debug)]
15755        pub struct CreateTriggerResponseOwnedView(
15756            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15757        );
15758        impl CreateTriggerResponseOwnedView {
15759            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15760            ///
15761            /// The view borrows directly from the buffer's data; the buffer is
15762            /// retained inside the returned handle.
15763            ///
15764            /// # Errors
15765            ///
15766            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15767            /// protobuf data.
15768            pub fn decode(
15769                bytes: ::buffa::bytes::Bytes,
15770            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15771                ::core::result::Result::Ok(
15772                    CreateTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
15773                )
15774            }
15775            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15776            /// max message size).
15777            ///
15778            /// # Errors
15779            ///
15780            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15781            /// exceeds the configured limits.
15782            pub fn decode_with_options(
15783                bytes: ::buffa::bytes::Bytes,
15784                opts: &::buffa::DecodeOptions,
15785            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15786                ::core::result::Result::Ok(
15787                    CreateTriggerResponseOwnedView(
15788                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15789                    ),
15790                )
15791            }
15792            /// Build from an owned message via an encode → decode round-trip.
15793            ///
15794            /// # Errors
15795            ///
15796            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15797            /// somehow invalid (should not happen for well-formed messages).
15798            pub fn from_owned(
15799                msg: &super::super::CreateTriggerResponse,
15800            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15801                ::core::result::Result::Ok(
15802                    CreateTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
15803                )
15804            }
15805            /// Borrow the full [`CreateTriggerResponseView`] with its lifetime tied to `&self`.
15806            #[must_use]
15807            pub fn view(&self) -> &CreateTriggerResponseView<'_> {
15808                self.0.reborrow()
15809            }
15810            /// Convert to the owned message type.
15811            ///
15812            /// # Errors
15813            ///
15814            /// Returns an error if re-materializing preserved unknown fields
15815            /// fails (e.g. the unknown-field limit is exceeded).
15816            pub fn to_owned_message(
15817                &self,
15818            ) -> ::core::result::Result<
15819                super::super::CreateTriggerResponse,
15820                ::buffa::DecodeError,
15821            > {
15822                self.0.to_owned_message()
15823            }
15824            /// The underlying bytes buffer.
15825            #[must_use]
15826            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15827                self.0.bytes()
15828            }
15829            /// Consume the handle, returning the underlying bytes buffer.
15830            #[must_use]
15831            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15832                self.0.into_bytes()
15833            }
15834            /// Assigned trigger ID.
15835            ///
15836            /// Field 1: `trigger_id`
15837            #[must_use]
15838            pub fn trigger_id(&self) -> u64 {
15839                self.0.reborrow().trigger_id
15840            }
15841            /// Echoed client trigger ID.
15842            ///
15843            /// Field 2: `client_trigger_id`
15844            #[must_use]
15845            pub fn client_trigger_id(&self) -> &'_ str {
15846                self.0.reborrow().client_trigger_id
15847            }
15848            /// Time creation admission completed.
15849            ///
15850            /// Field 3: `accepted_at`
15851            #[must_use]
15852            pub fn accepted_at(
15853                &self,
15854            ) -> &::buffa::MessageFieldView<
15855                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
15856            > {
15857                &self.0.reborrow().accepted_at
15858            }
15859            /// Admission completion time in nanoseconds since epoch (UTC).
15860            ///
15861            /// Field 4: `accepted_at_ts_ns`
15862            #[must_use]
15863            pub fn accepted_at_ts_ns(&self) -> u64 {
15864                self.0.reborrow().accepted_at_ts_ns
15865            }
15866        }
15867        impl ::core::convert::From<
15868            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15869        > for CreateTriggerResponseOwnedView {
15870            fn from(
15871                inner: ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15872            ) -> Self {
15873                CreateTriggerResponseOwnedView(inner)
15874            }
15875        }
15876        impl ::core::convert::From<CreateTriggerResponseOwnedView>
15877        for ::buffa::OwnedView<CreateTriggerResponseView<'static>> {
15878            fn from(wrapper: CreateTriggerResponseOwnedView) -> Self {
15879                wrapper.0
15880            }
15881        }
15882        impl ::core::convert::AsRef<
15883            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15884        > for CreateTriggerResponseOwnedView {
15885            fn as_ref(&self) -> &::buffa::OwnedView<CreateTriggerResponseView<'static>> {
15886                &self.0
15887            }
15888        }
15889        impl ::buffa::HasMessageView for super::super::CreateTriggerResponse {
15890            type View<'a> = CreateTriggerResponseView<'a>;
15891            type ViewHandle = CreateTriggerResponseOwnedView;
15892        }
15893        impl ::serde::Serialize for CreateTriggerResponseOwnedView {
15894            fn serialize<__S: ::serde::Serializer>(
15895                &self,
15896                __s: __S,
15897            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15898                ::serde::Serialize::serialize(&self.0, __s)
15899            }
15900        }
15901        /// =============================================================================
15902        /// Get Trigger
15903        /// =============================================================================
15904        ///
15905        /// GetTriggerRequest retrieves one trigger by ID.
15906        #[derive(Clone, Debug, Default)]
15907        pub struct GetTriggerRequestView<'a> {
15908            /// Trigger ID to retrieve.
15909            ///
15910            /// Field 1: `trigger_id`
15911            pub trigger_id: u64,
15912            /// Optional sub-account for authorization.
15913            ///
15914            /// Field 2: `subaccount_id`
15915            pub subaccount_id: ::core::option::Option<u64>,
15916            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15917        }
15918        impl<'a> ::buffa::MessageView<'a> for GetTriggerRequestView<'a> {
15919            type Owned = super::super::GetTriggerRequest;
15920            fn decode_view(
15921                buf: &'a [u8],
15922            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15923                let __limit = ::core::cell::Cell::new(
15924                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15925                );
15926                <Self as ::buffa::MessageView>::decode_view_ctx(
15927                    buf,
15928                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15929                )
15930            }
15931            fn decode_view_with_ctx(
15932                buf: &'a [u8],
15933                ctx: ::buffa::DecodeContext<'_>,
15934            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15935                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15936            }
15937            fn merge_view_field(
15938                &mut self,
15939                tag: ::buffa::encoding::Tag,
15940                cur: &'a [u8],
15941                before_tag: &'a [u8],
15942                ctx: ::buffa::DecodeContext<'_>,
15943            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15944                let _ = ctx;
15945                #[allow(unused_variables)]
15946                let view = self;
15947                let mut cur = cur;
15948                match tag.field_number() {
15949                    1u32 => {
15950                        ::buffa::encoding::check_wire_type(
15951                            tag,
15952                            ::buffa::encoding::WireType::Fixed64,
15953                        )?;
15954                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
15955                    }
15956                    2u32 => {
15957                        ::buffa::encoding::check_wire_type(
15958                            tag,
15959                            ::buffa::encoding::WireType::Fixed64,
15960                        )?;
15961                        view.subaccount_id = Some(
15962                            ::buffa::types::decode_fixed64(&mut cur)?,
15963                        );
15964                    }
15965                    _ => {
15966                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15967                        let span_len = before_tag.len() - cur.len();
15968                        view.__buffa_unknown_fields
15969                            .push_record(before_tag, span_len, ctx)?;
15970                    }
15971                }
15972                ::core::result::Result::Ok(cur)
15973            }
15974            fn to_owned_message(
15975                &self,
15976            ) -> ::core::result::Result<
15977                super::super::GetTriggerRequest,
15978                ::buffa::DecodeError,
15979            > {
15980                self.to_owned_from_source(None)
15981            }
15982            #[allow(clippy::useless_conversion, clippy::needless_update)]
15983            fn to_owned_from_source(
15984                &self,
15985                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15986            ) -> ::core::result::Result<
15987                super::super::GetTriggerRequest,
15988                ::buffa::DecodeError,
15989            > {
15990                #[allow(unused_imports)]
15991                use ::buffa::alloc::string::ToString as _;
15992                let _ = __buffa_src;
15993                ::core::result::Result::Ok(super::super::GetTriggerRequest {
15994                    trigger_id: self.trigger_id,
15995                    subaccount_id: self.subaccount_id,
15996                    __buffa_unknown_fields: self
15997                        .__buffa_unknown_fields
15998                        .to_owned()?
15999                        .into(),
16000                    ..::core::default::Default::default()
16001                })
16002            }
16003        }
16004        impl<'a> ::buffa::ViewEncode<'a> for GetTriggerRequestView<'a> {
16005            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16006            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16007                #[allow(unused_imports)]
16008                use ::buffa::Enumeration as _;
16009                let mut size = 0u32;
16010                if self.trigger_id != 0u64 {
16011                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16012                }
16013                if self.subaccount_id.is_some() {
16014                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16015                }
16016                size += self.__buffa_unknown_fields.encoded_len() as u32;
16017                size
16018            }
16019            #[allow(clippy::needless_borrow)]
16020            fn write_to(
16021                &self,
16022                _cache: &mut ::buffa::SizeCache,
16023                buf: &mut impl ::buffa::bytes::BufMut,
16024            ) {
16025                #[allow(unused_imports)]
16026                use ::buffa::Enumeration as _;
16027                if self.trigger_id != 0u64 {
16028                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
16029                }
16030                if let Some(v) = self.subaccount_id {
16031                    ::buffa::types::put_fixed64_field(2u32, v, buf);
16032                }
16033                self.__buffa_unknown_fields.write_to(buf);
16034            }
16035        }
16036        /// Serializes this view as protobuf JSON.
16037        ///
16038        /// Implicit-presence fields with default values are omitted, `required`
16039        /// fields are always emitted, explicit-presence (`optional`) fields are
16040        /// emitted only when set, bytes fields are base64-encoded, and enum
16041        /// values are their proto name strings.
16042        ///
16043        /// This impl uses `serialize_map(None)` because the number of emitted
16044        /// fields depends on default-omission rules; serializers that require
16045        /// known map lengths (e.g. `bincode`) will return a runtime error.
16046        /// Use the owned message type for those formats.
16047        impl<'__a> ::serde::Serialize for GetTriggerRequestView<'__a> {
16048            fn serialize<__S: ::serde::Serializer>(
16049                &self,
16050                __s: __S,
16051            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16052                use ::serde::ser::SerializeMap as _;
16053                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16054                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
16055                    __map
16056                        .serialize_entry(
16057                            "triggerId",
16058                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
16059                        )?;
16060                }
16061                if let ::core::option::Option::Some(__v) = self.subaccount_id {
16062                    __map
16063                        .serialize_entry(
16064                            "subaccountId",
16065                            &::buffa::json_helpers::ProtoJson(&__v),
16066                        )?;
16067                }
16068                __map.end()
16069            }
16070        }
16071        impl<'a> ::buffa::MessageName for GetTriggerRequestView<'a> {
16072            const PACKAGE: &'static str = "triggers.v1";
16073            const NAME: &'static str = "GetTriggerRequest";
16074            const FULL_NAME: &'static str = "triggers.v1.GetTriggerRequest";
16075            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
16076        }
16077        ::buffa::impl_default_view_instance!(GetTriggerRequestView);
16078        ::buffa::impl_view_reborrow!(GetTriggerRequestView);
16079        /** Self-contained, `'static` owned view of a `GetTriggerRequest` message.
16080
16081 Wraps [`::buffa::OwnedView`]`<`[`GetTriggerRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
16082
16083 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetTriggerRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
16084        #[derive(Clone, Debug)]
16085        pub struct GetTriggerRequestOwnedView(
16086            ::buffa::OwnedView<GetTriggerRequestView<'static>>,
16087        );
16088        impl GetTriggerRequestOwnedView {
16089            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16090            ///
16091            /// The view borrows directly from the buffer's data; the buffer is
16092            /// retained inside the returned handle.
16093            ///
16094            /// # Errors
16095            ///
16096            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16097            /// protobuf data.
16098            pub fn decode(
16099                bytes: ::buffa::bytes::Bytes,
16100            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16101                ::core::result::Result::Ok(
16102                    GetTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
16103                )
16104            }
16105            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16106            /// max message size).
16107            ///
16108            /// # Errors
16109            ///
16110            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16111            /// exceeds the configured limits.
16112            pub fn decode_with_options(
16113                bytes: ::buffa::bytes::Bytes,
16114                opts: &::buffa::DecodeOptions,
16115            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16116                ::core::result::Result::Ok(
16117                    GetTriggerRequestOwnedView(
16118                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16119                    ),
16120                )
16121            }
16122            /// Build from an owned message via an encode → decode round-trip.
16123            ///
16124            /// # Errors
16125            ///
16126            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16127            /// somehow invalid (should not happen for well-formed messages).
16128            pub fn from_owned(
16129                msg: &super::super::GetTriggerRequest,
16130            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16131                ::core::result::Result::Ok(
16132                    GetTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
16133                )
16134            }
16135            /// Borrow the full [`GetTriggerRequestView`] with its lifetime tied to `&self`.
16136            #[must_use]
16137            pub fn view(&self) -> &GetTriggerRequestView<'_> {
16138                self.0.reborrow()
16139            }
16140            /// Convert to the owned message type.
16141            ///
16142            /// # Errors
16143            ///
16144            /// Returns an error if re-materializing preserved unknown fields
16145            /// fails (e.g. the unknown-field limit is exceeded).
16146            pub fn to_owned_message(
16147                &self,
16148            ) -> ::core::result::Result<
16149                super::super::GetTriggerRequest,
16150                ::buffa::DecodeError,
16151            > {
16152                self.0.to_owned_message()
16153            }
16154            /// The underlying bytes buffer.
16155            #[must_use]
16156            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16157                self.0.bytes()
16158            }
16159            /// Consume the handle, returning the underlying bytes buffer.
16160            #[must_use]
16161            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16162                self.0.into_bytes()
16163            }
16164            /// Trigger ID to retrieve.
16165            ///
16166            /// Field 1: `trigger_id`
16167            #[must_use]
16168            pub fn trigger_id(&self) -> u64 {
16169                self.0.reborrow().trigger_id
16170            }
16171            /// Optional sub-account for authorization.
16172            ///
16173            /// Field 2: `subaccount_id`
16174            #[must_use]
16175            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
16176                self.0.reborrow().subaccount_id
16177            }
16178        }
16179        impl ::core::convert::From<::buffa::OwnedView<GetTriggerRequestView<'static>>>
16180        for GetTriggerRequestOwnedView {
16181            fn from(inner: ::buffa::OwnedView<GetTriggerRequestView<'static>>) -> Self {
16182                GetTriggerRequestOwnedView(inner)
16183            }
16184        }
16185        impl ::core::convert::From<GetTriggerRequestOwnedView>
16186        for ::buffa::OwnedView<GetTriggerRequestView<'static>> {
16187            fn from(wrapper: GetTriggerRequestOwnedView) -> Self {
16188                wrapper.0
16189            }
16190        }
16191        impl ::core::convert::AsRef<::buffa::OwnedView<GetTriggerRequestView<'static>>>
16192        for GetTriggerRequestOwnedView {
16193            fn as_ref(&self) -> &::buffa::OwnedView<GetTriggerRequestView<'static>> {
16194                &self.0
16195            }
16196        }
16197        impl ::buffa::HasMessageView for super::super::GetTriggerRequest {
16198            type View<'a> = GetTriggerRequestView<'a>;
16199            type ViewHandle = GetTriggerRequestOwnedView;
16200        }
16201        impl ::serde::Serialize for GetTriggerRequestOwnedView {
16202            fn serialize<__S: ::serde::Serializer>(
16203                &self,
16204                __s: __S,
16205            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16206                ::serde::Serialize::serialize(&self.0, __s)
16207            }
16208        }
16209        /// GetTriggerResponse returns the requested trigger.
16210        #[derive(Clone, Debug, Default)]
16211        pub struct GetTriggerResponseView<'a> {
16212            /// Trigger state and configuration.
16213            ///
16214            /// Field 1: `trigger`
16215            pub trigger: ::buffa::MessageFieldView<
16216                super::super::__buffa::view::TriggerView<'a>,
16217            >,
16218            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16219        }
16220        impl<'a> ::buffa::MessageView<'a> for GetTriggerResponseView<'a> {
16221            type Owned = super::super::GetTriggerResponse;
16222            fn decode_view(
16223                buf: &'a [u8],
16224            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16225                let __limit = ::core::cell::Cell::new(
16226                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16227                );
16228                <Self as ::buffa::MessageView>::decode_view_ctx(
16229                    buf,
16230                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16231                )
16232            }
16233            fn decode_view_with_ctx(
16234                buf: &'a [u8],
16235                ctx: ::buffa::DecodeContext<'_>,
16236            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16237                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16238            }
16239            fn merge_view_field(
16240                &mut self,
16241                tag: ::buffa::encoding::Tag,
16242                cur: &'a [u8],
16243                before_tag: &'a [u8],
16244                ctx: ::buffa::DecodeContext<'_>,
16245            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16246                let _ = ctx;
16247                #[allow(unused_variables)]
16248                let view = self;
16249                let mut cur = cur;
16250                match tag.field_number() {
16251                    1u32 => {
16252                        ::buffa::encoding::check_wire_type(
16253                            tag,
16254                            ::buffa::encoding::WireType::LengthDelimited,
16255                        )?;
16256                        let __sub_ctx = ctx.descend()?;
16257                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
16258                        match view.trigger.as_mut() {
16259                            Some(existing) => {
16260                                ::buffa::MessageView::merge_into_view(
16261                                    existing,
16262                                    sub,
16263                                    __sub_ctx,
16264                                )?
16265                            }
16266                            None => {
16267                                view.trigger = ::buffa::MessageFieldView::set(
16268                                    <super::super::__buffa::view::TriggerView as ::buffa::MessageView>::decode_view_ctx(
16269                                        sub,
16270                                        __sub_ctx,
16271                                    )?,
16272                                );
16273                            }
16274                        }
16275                    }
16276                    _ => {
16277                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16278                        let span_len = before_tag.len() - cur.len();
16279                        view.__buffa_unknown_fields
16280                            .push_record(before_tag, span_len, ctx)?;
16281                    }
16282                }
16283                ::core::result::Result::Ok(cur)
16284            }
16285            fn to_owned_message(
16286                &self,
16287            ) -> ::core::result::Result<
16288                super::super::GetTriggerResponse,
16289                ::buffa::DecodeError,
16290            > {
16291                self.to_owned_from_source(None)
16292            }
16293            #[allow(clippy::useless_conversion, clippy::needless_update)]
16294            fn to_owned_from_source(
16295                &self,
16296                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16297            ) -> ::core::result::Result<
16298                super::super::GetTriggerResponse,
16299                ::buffa::DecodeError,
16300            > {
16301                #[allow(unused_imports)]
16302                use ::buffa::alloc::string::ToString as _;
16303                let _ = __buffa_src;
16304                ::core::result::Result::Ok(super::super::GetTriggerResponse {
16305                    trigger: match self.trigger.as_option() {
16306                        Some(v) => {
16307                            ::buffa::MessageField::<
16308                                super::super::Trigger,
16309                            >::some(v.to_owned_from_source(__buffa_src)?)
16310                        }
16311                        None => ::buffa::MessageField::none(),
16312                    },
16313                    __buffa_unknown_fields: self
16314                        .__buffa_unknown_fields
16315                        .to_owned()?
16316                        .into(),
16317                    ..::core::default::Default::default()
16318                })
16319            }
16320        }
16321        impl<'a> ::buffa::ViewEncode<'a> for GetTriggerResponseView<'a> {
16322            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16323            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
16324                #[allow(unused_imports)]
16325                use ::buffa::Enumeration as _;
16326                let mut size = 0u32;
16327                if self.trigger.is_set() {
16328                    let __slot = __cache.reserve();
16329                    let inner_size = self.trigger.compute_size(__cache);
16330                    __cache.set(__slot, inner_size);
16331                    size
16332                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
16333                            + inner_size;
16334                }
16335                size += self.__buffa_unknown_fields.encoded_len() as u32;
16336                size
16337            }
16338            #[allow(clippy::needless_borrow)]
16339            fn write_to(
16340                &self,
16341                __cache: &mut ::buffa::SizeCache,
16342                buf: &mut impl ::buffa::bytes::BufMut,
16343            ) {
16344                #[allow(unused_imports)]
16345                use ::buffa::Enumeration as _;
16346                if self.trigger.is_set() {
16347                    ::buffa::types::put_len_delimited_header(
16348                        1u32,
16349                        __cache.consume_next(),
16350                        buf,
16351                    );
16352                    self.trigger.write_to(__cache, buf);
16353                }
16354                self.__buffa_unknown_fields.write_to(buf);
16355            }
16356        }
16357        /// Serializes this view as protobuf JSON.
16358        ///
16359        /// Implicit-presence fields with default values are omitted, `required`
16360        /// fields are always emitted, explicit-presence (`optional`) fields are
16361        /// emitted only when set, bytes fields are base64-encoded, and enum
16362        /// values are their proto name strings.
16363        ///
16364        /// This impl uses `serialize_map(None)` because the number of emitted
16365        /// fields depends on default-omission rules; serializers that require
16366        /// known map lengths (e.g. `bincode`) will return a runtime error.
16367        /// Use the owned message type for those formats.
16368        impl<'__a> ::serde::Serialize for GetTriggerResponseView<'__a> {
16369            fn serialize<__S: ::serde::Serializer>(
16370                &self,
16371                __s: __S,
16372            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16373                use ::serde::ser::SerializeMap as _;
16374                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16375                {
16376                    if let ::core::option::Option::Some(__v) = self.trigger.as_option() {
16377                        __map.serialize_entry("trigger", __v)?;
16378                    }
16379                }
16380                __map.end()
16381            }
16382        }
16383        impl<'a> ::buffa::MessageName for GetTriggerResponseView<'a> {
16384            const PACKAGE: &'static str = "triggers.v1";
16385            const NAME: &'static str = "GetTriggerResponse";
16386            const FULL_NAME: &'static str = "triggers.v1.GetTriggerResponse";
16387            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
16388        }
16389        ::buffa::impl_default_view_instance!(GetTriggerResponseView);
16390        ::buffa::impl_view_reborrow!(GetTriggerResponseView);
16391        /** Self-contained, `'static` owned view of a `GetTriggerResponse` message.
16392
16393 Wraps [`::buffa::OwnedView`]`<`[`GetTriggerResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
16394
16395 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetTriggerResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
16396        #[derive(Clone, Debug)]
16397        pub struct GetTriggerResponseOwnedView(
16398            ::buffa::OwnedView<GetTriggerResponseView<'static>>,
16399        );
16400        impl GetTriggerResponseOwnedView {
16401            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16402            ///
16403            /// The view borrows directly from the buffer's data; the buffer is
16404            /// retained inside the returned handle.
16405            ///
16406            /// # Errors
16407            ///
16408            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16409            /// protobuf data.
16410            pub fn decode(
16411                bytes: ::buffa::bytes::Bytes,
16412            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16413                ::core::result::Result::Ok(
16414                    GetTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
16415                )
16416            }
16417            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16418            /// max message size).
16419            ///
16420            /// # Errors
16421            ///
16422            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16423            /// exceeds the configured limits.
16424            pub fn decode_with_options(
16425                bytes: ::buffa::bytes::Bytes,
16426                opts: &::buffa::DecodeOptions,
16427            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16428                ::core::result::Result::Ok(
16429                    GetTriggerResponseOwnedView(
16430                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16431                    ),
16432                )
16433            }
16434            /// Build from an owned message via an encode → decode round-trip.
16435            ///
16436            /// # Errors
16437            ///
16438            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16439            /// somehow invalid (should not happen for well-formed messages).
16440            pub fn from_owned(
16441                msg: &super::super::GetTriggerResponse,
16442            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16443                ::core::result::Result::Ok(
16444                    GetTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
16445                )
16446            }
16447            /// Borrow the full [`GetTriggerResponseView`] with its lifetime tied to `&self`.
16448            #[must_use]
16449            pub fn view(&self) -> &GetTriggerResponseView<'_> {
16450                self.0.reborrow()
16451            }
16452            /// Convert to the owned message type.
16453            ///
16454            /// # Errors
16455            ///
16456            /// Returns an error if re-materializing preserved unknown fields
16457            /// fails (e.g. the unknown-field limit is exceeded).
16458            pub fn to_owned_message(
16459                &self,
16460            ) -> ::core::result::Result<
16461                super::super::GetTriggerResponse,
16462                ::buffa::DecodeError,
16463            > {
16464                self.0.to_owned_message()
16465            }
16466            /// The underlying bytes buffer.
16467            #[must_use]
16468            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16469                self.0.bytes()
16470            }
16471            /// Consume the handle, returning the underlying bytes buffer.
16472            #[must_use]
16473            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16474                self.0.into_bytes()
16475            }
16476            /// Trigger state and configuration.
16477            ///
16478            /// Field 1: `trigger`
16479            #[must_use]
16480            pub fn trigger(
16481                &self,
16482            ) -> &::buffa::MessageFieldView<
16483                super::super::__buffa::view::TriggerView<'_>,
16484            > {
16485                &self.0.reborrow().trigger
16486            }
16487        }
16488        impl ::core::convert::From<::buffa::OwnedView<GetTriggerResponseView<'static>>>
16489        for GetTriggerResponseOwnedView {
16490            fn from(inner: ::buffa::OwnedView<GetTriggerResponseView<'static>>) -> Self {
16491                GetTriggerResponseOwnedView(inner)
16492            }
16493        }
16494        impl ::core::convert::From<GetTriggerResponseOwnedView>
16495        for ::buffa::OwnedView<GetTriggerResponseView<'static>> {
16496            fn from(wrapper: GetTriggerResponseOwnedView) -> Self {
16497                wrapper.0
16498            }
16499        }
16500        impl ::core::convert::AsRef<::buffa::OwnedView<GetTriggerResponseView<'static>>>
16501        for GetTriggerResponseOwnedView {
16502            fn as_ref(&self) -> &::buffa::OwnedView<GetTriggerResponseView<'static>> {
16503                &self.0
16504            }
16505        }
16506        impl ::buffa::HasMessageView for super::super::GetTriggerResponse {
16507            type View<'a> = GetTriggerResponseView<'a>;
16508            type ViewHandle = GetTriggerResponseOwnedView;
16509        }
16510        impl ::serde::Serialize for GetTriggerResponseOwnedView {
16511            fn serialize<__S: ::serde::Serializer>(
16512                &self,
16513                __s: __S,
16514            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16515                ::serde::Serialize::serialize(&self.0, __s)
16516            }
16517        }
16518        /// =============================================================================
16519        /// List Triggers
16520        /// =============================================================================
16521        ///
16522        /// ListTriggersRequest lists triggers for an account.
16523        #[derive(Clone, Debug, Default)]
16524        pub struct ListTriggersRequestView<'a> {
16525            /// Optional sub-account to list triggers for. When empty or omitted, uses the
16526            /// caller's root account.
16527            ///
16528            /// Field 1: `subaccount_id`
16529            pub subaccount_id: ::core::option::Option<u64>,
16530            /// Optional filter by symbol.
16531            ///
16532            /// Field 2: `symbol`
16533            pub symbol: &'a str,
16534            /// Optional filter by status (can specify multiple).
16535            ///
16536            /// Field 3: `status`
16537            pub status: ::buffa::RepeatedView<
16538                'a,
16539                ::buffa::EnumValue<super::super::TriggerStatus>,
16540            >,
16541            /// Optional filter by type.
16542            ///
16543            /// Field 4: `trigger_type`
16544            pub trigger_type: ::buffa::EnumValue<super::super::TriggerType>,
16545            /// Optional filter by attached parent order ID.
16546            ///
16547            /// Field 5: `parent_order_id`
16548            pub parent_order_id: ::core::option::Option<u64>,
16549            /// Maximum number of triggers to return. Defaults to 100 when omitted;
16550            /// maximum is 1000.
16551            ///
16552            /// Field 10: `limit`
16553            pub limit: u32,
16554            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
16555            /// bound to the authenticated account, sub-account scope, filters, and newest
16556            /// first sort order.
16557            ///
16558            /// Field 12: `page_token`
16559            pub page_token: &'a str,
16560            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16561        }
16562        impl<'a> ::buffa::MessageView<'a> for ListTriggersRequestView<'a> {
16563            type Owned = super::super::ListTriggersRequest;
16564            fn decode_view(
16565                buf: &'a [u8],
16566            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16567                let __limit = ::core::cell::Cell::new(
16568                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16569                );
16570                <Self as ::buffa::MessageView>::decode_view_ctx(
16571                    buf,
16572                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16573                )
16574            }
16575            fn decode_view_with_ctx(
16576                buf: &'a [u8],
16577                ctx: ::buffa::DecodeContext<'_>,
16578            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16579                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16580            }
16581            fn merge_view_field(
16582                &mut self,
16583                tag: ::buffa::encoding::Tag,
16584                cur: &'a [u8],
16585                before_tag: &'a [u8],
16586                ctx: ::buffa::DecodeContext<'_>,
16587            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16588                let _ = ctx;
16589                #[allow(unused_variables)]
16590                let view = self;
16591                let mut cur = cur;
16592                match tag.field_number() {
16593                    1u32 => {
16594                        ::buffa::encoding::check_wire_type(
16595                            tag,
16596                            ::buffa::encoding::WireType::Fixed64,
16597                        )?;
16598                        view.subaccount_id = Some(
16599                            ::buffa::types::decode_fixed64(&mut cur)?,
16600                        );
16601                    }
16602                    2u32 => {
16603                        ::buffa::encoding::check_wire_type(
16604                            tag,
16605                            ::buffa::encoding::WireType::LengthDelimited,
16606                        )?;
16607                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
16608                    }
16609                    4u32 => {
16610                        ::buffa::encoding::check_wire_type(
16611                            tag,
16612                            ::buffa::encoding::WireType::Varint,
16613                        )?;
16614                        view.trigger_type = ::buffa::EnumValue::from(
16615                            ::buffa::types::decode_int32(&mut cur)?,
16616                        );
16617                    }
16618                    5u32 => {
16619                        ::buffa::encoding::check_wire_type(
16620                            tag,
16621                            ::buffa::encoding::WireType::Fixed64,
16622                        )?;
16623                        view.parent_order_id = Some(
16624                            ::buffa::types::decode_fixed64(&mut cur)?,
16625                        );
16626                    }
16627                    10u32 => {
16628                        ::buffa::encoding::check_wire_type(
16629                            tag,
16630                            ::buffa::encoding::WireType::Varint,
16631                        )?;
16632                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
16633                    }
16634                    12u32 => {
16635                        ::buffa::encoding::check_wire_type(
16636                            tag,
16637                            ::buffa::encoding::WireType::LengthDelimited,
16638                        )?;
16639                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
16640                    }
16641                    3u32 => {
16642                        if tag.wire_type()
16643                            == ::buffa::encoding::WireType::LengthDelimited
16644                        {
16645                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16646                            view.status
16647                                .reserve(::buffa::encoding::count_varints(payload));
16648                            let mut pcur: &[u8] = payload;
16649                            while !pcur.is_empty() {
16650                                view.status
16651                                    .push(
16652                                        ::buffa::EnumValue::from(
16653                                            ::buffa::types::decode_int32(&mut pcur)?,
16654                                        ),
16655                                    );
16656                            }
16657                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16658                        {
16659                            view.status
16660                                .push(
16661                                    ::buffa::EnumValue::from(
16662                                        ::buffa::types::decode_int32(&mut cur)?,
16663                                    ),
16664                                );
16665                        } else {
16666                            return Err(
16667                                ::buffa::encoding::wire_type_mismatch(
16668                                    tag,
16669                                    ::buffa::encoding::WireType::LengthDelimited,
16670                                ),
16671                            );
16672                        }
16673                    }
16674                    _ => {
16675                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16676                        let span_len = before_tag.len() - cur.len();
16677                        view.__buffa_unknown_fields
16678                            .push_record(before_tag, span_len, ctx)?;
16679                    }
16680                }
16681                ::core::result::Result::Ok(cur)
16682            }
16683            fn to_owned_message(
16684                &self,
16685            ) -> ::core::result::Result<
16686                super::super::ListTriggersRequest,
16687                ::buffa::DecodeError,
16688            > {
16689                self.to_owned_from_source(None)
16690            }
16691            #[allow(clippy::useless_conversion, clippy::needless_update)]
16692            fn to_owned_from_source(
16693                &self,
16694                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16695            ) -> ::core::result::Result<
16696                super::super::ListTriggersRequest,
16697                ::buffa::DecodeError,
16698            > {
16699                #[allow(unused_imports)]
16700                use ::buffa::alloc::string::ToString as _;
16701                let _ = __buffa_src;
16702                ::core::result::Result::Ok(super::super::ListTriggersRequest {
16703                    subaccount_id: self.subaccount_id,
16704                    symbol: self.symbol.to_string(),
16705                    status: self.status.to_vec(),
16706                    trigger_type: self.trigger_type,
16707                    parent_order_id: self.parent_order_id,
16708                    limit: self.limit,
16709                    page_token: self.page_token.to_string(),
16710                    __buffa_unknown_fields: self
16711                        .__buffa_unknown_fields
16712                        .to_owned()?
16713                        .into(),
16714                    ..::core::default::Default::default()
16715                })
16716            }
16717        }
16718        impl<'a> ::buffa::ViewEncode<'a> for ListTriggersRequestView<'a> {
16719            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16720            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16721                #[allow(unused_imports)]
16722                use ::buffa::Enumeration as _;
16723                let mut size = 0u32;
16724                if self.subaccount_id.is_some() {
16725                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16726                }
16727                if !self.symbol.is_empty() {
16728                    size
16729                        += 1u32
16730                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
16731                }
16732                if !self.status.is_empty() {
16733                    let payload: u32 = self
16734                        .status
16735                        .iter()
16736                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
16737                        .sum::<u32>();
16738                    size
16739                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16740                            + payload;
16741                }
16742                {
16743                    let val = self.trigger_type.to_i32();
16744                    if val != 0 {
16745                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
16746                    }
16747                }
16748                if self.parent_order_id.is_some() {
16749                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16750                }
16751                if self.limit != 0u32 {
16752                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
16753                }
16754                if !self.page_token.is_empty() {
16755                    size
16756                        += 1u32
16757                            + ::buffa::types::string_encoded_len(&self.page_token)
16758                                as u32;
16759                }
16760                size += self.__buffa_unknown_fields.encoded_len() as u32;
16761                size
16762            }
16763            #[allow(clippy::needless_borrow)]
16764            fn write_to(
16765                &self,
16766                _cache: &mut ::buffa::SizeCache,
16767                buf: &mut impl ::buffa::bytes::BufMut,
16768            ) {
16769                #[allow(unused_imports)]
16770                use ::buffa::Enumeration as _;
16771                if let Some(v) = self.subaccount_id {
16772                    ::buffa::types::put_fixed64_field(1u32, v, buf);
16773                }
16774                if !self.symbol.is_empty() {
16775                    ::buffa::types::put_string_field(2u32, &self.symbol, buf);
16776                }
16777                if !self.status.is_empty() {
16778                    let payload: u32 = self
16779                        .status
16780                        .iter()
16781                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
16782                        .sum::<u32>();
16783                    ::buffa::types::put_len_delimited_header(3u32, payload, buf);
16784                    for v in &self.status {
16785                        ::buffa::types::encode_int32(v.to_i32(), buf);
16786                    }
16787                }
16788                {
16789                    let val = self.trigger_type.to_i32();
16790                    if val != 0 {
16791                        ::buffa::types::put_int32_field(4u32, val, buf);
16792                    }
16793                }
16794                if let Some(v) = self.parent_order_id {
16795                    ::buffa::types::put_fixed64_field(5u32, v, buf);
16796                }
16797                if self.limit != 0u32 {
16798                    ::buffa::types::put_uint32_field(10u32, self.limit, buf);
16799                }
16800                if !self.page_token.is_empty() {
16801                    ::buffa::types::put_string_field(12u32, &self.page_token, buf);
16802                }
16803                self.__buffa_unknown_fields.write_to(buf);
16804            }
16805        }
16806        /// Serializes this view as protobuf JSON.
16807        ///
16808        /// Implicit-presence fields with default values are omitted, `required`
16809        /// fields are always emitted, explicit-presence (`optional`) fields are
16810        /// emitted only when set, bytes fields are base64-encoded, and enum
16811        /// values are their proto name strings.
16812        ///
16813        /// This impl uses `serialize_map(None)` because the number of emitted
16814        /// fields depends on default-omission rules; serializers that require
16815        /// known map lengths (e.g. `bincode`) will return a runtime error.
16816        /// Use the owned message type for those formats.
16817        impl<'__a> ::serde::Serialize for ListTriggersRequestView<'__a> {
16818            fn serialize<__S: ::serde::Serializer>(
16819                &self,
16820                __s: __S,
16821            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16822                use ::serde::ser::SerializeMap as _;
16823                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16824                if let ::core::option::Option::Some(__v) = self.subaccount_id {
16825                    __map
16826                        .serialize_entry(
16827                            "subaccountId",
16828                            &::buffa::json_helpers::ProtoJson(&__v),
16829                        )?;
16830                }
16831                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
16832                    __map.serialize_entry("symbol", self.symbol)?;
16833                }
16834                if !self.status.is_empty() {
16835                    __map
16836                        .serialize_entry(
16837                            "status",
16838                            &::buffa::json_helpers::EnumSeqJson(&self.status),
16839                        )?;
16840                }
16841                if !::buffa::json_helpers::skip_if::is_default_enum_value(
16842                    &self.trigger_type,
16843                ) {
16844                    __map.serialize_entry("triggerType", &self.trigger_type)?;
16845                }
16846                if let ::core::option::Option::Some(__v) = self.parent_order_id {
16847                    __map
16848                        .serialize_entry(
16849                            "parentOrderId",
16850                            &::buffa::json_helpers::ProtoJson(&__v),
16851                        )?;
16852                }
16853                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
16854                    __map
16855                        .serialize_entry(
16856                            "limit",
16857                            &::buffa::json_helpers::ProtoJson(&self.limit),
16858                        )?;
16859                }
16860                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
16861                    __map.serialize_entry("pageToken", self.page_token)?;
16862                }
16863                __map.end()
16864            }
16865        }
16866        impl<'a> ::buffa::MessageName for ListTriggersRequestView<'a> {
16867            const PACKAGE: &'static str = "triggers.v1";
16868            const NAME: &'static str = "ListTriggersRequest";
16869            const FULL_NAME: &'static str = "triggers.v1.ListTriggersRequest";
16870            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
16871        }
16872        ::buffa::impl_default_view_instance!(ListTriggersRequestView);
16873        ::buffa::impl_view_reborrow!(ListTriggersRequestView);
16874        /** Self-contained, `'static` owned view of a `ListTriggersRequest` message.
16875
16876 Wraps [`::buffa::OwnedView`]`<`[`ListTriggersRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
16877
16878 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListTriggersRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
16879        #[derive(Clone, Debug)]
16880        pub struct ListTriggersRequestOwnedView(
16881            ::buffa::OwnedView<ListTriggersRequestView<'static>>,
16882        );
16883        impl ListTriggersRequestOwnedView {
16884            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16885            ///
16886            /// The view borrows directly from the buffer's data; the buffer is
16887            /// retained inside the returned handle.
16888            ///
16889            /// # Errors
16890            ///
16891            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16892            /// protobuf data.
16893            pub fn decode(
16894                bytes: ::buffa::bytes::Bytes,
16895            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16896                ::core::result::Result::Ok(
16897                    ListTriggersRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
16898                )
16899            }
16900            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16901            /// max message size).
16902            ///
16903            /// # Errors
16904            ///
16905            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16906            /// exceeds the configured limits.
16907            pub fn decode_with_options(
16908                bytes: ::buffa::bytes::Bytes,
16909                opts: &::buffa::DecodeOptions,
16910            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16911                ::core::result::Result::Ok(
16912                    ListTriggersRequestOwnedView(
16913                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16914                    ),
16915                )
16916            }
16917            /// Build from an owned message via an encode → decode round-trip.
16918            ///
16919            /// # Errors
16920            ///
16921            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16922            /// somehow invalid (should not happen for well-formed messages).
16923            pub fn from_owned(
16924                msg: &super::super::ListTriggersRequest,
16925            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16926                ::core::result::Result::Ok(
16927                    ListTriggersRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
16928                )
16929            }
16930            /// Borrow the full [`ListTriggersRequestView`] with its lifetime tied to `&self`.
16931            #[must_use]
16932            pub fn view(&self) -> &ListTriggersRequestView<'_> {
16933                self.0.reborrow()
16934            }
16935            /// Convert to the owned message type.
16936            ///
16937            /// # Errors
16938            ///
16939            /// Returns an error if re-materializing preserved unknown fields
16940            /// fails (e.g. the unknown-field limit is exceeded).
16941            pub fn to_owned_message(
16942                &self,
16943            ) -> ::core::result::Result<
16944                super::super::ListTriggersRequest,
16945                ::buffa::DecodeError,
16946            > {
16947                self.0.to_owned_message()
16948            }
16949            /// The underlying bytes buffer.
16950            #[must_use]
16951            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16952                self.0.bytes()
16953            }
16954            /// Consume the handle, returning the underlying bytes buffer.
16955            #[must_use]
16956            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16957                self.0.into_bytes()
16958            }
16959            /// Optional sub-account to list triggers for. When empty or omitted, uses the
16960            /// caller's root account.
16961            ///
16962            /// Field 1: `subaccount_id`
16963            #[must_use]
16964            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
16965                self.0.reborrow().subaccount_id
16966            }
16967            /// Optional filter by symbol.
16968            ///
16969            /// Field 2: `symbol`
16970            #[must_use]
16971            pub fn symbol(&self) -> &'_ str {
16972                self.0.reborrow().symbol
16973            }
16974            /// Optional filter by status (can specify multiple).
16975            ///
16976            /// Field 3: `status`
16977            #[must_use]
16978            pub fn status(
16979                &self,
16980            ) -> &::buffa::RepeatedView<
16981                '_,
16982                ::buffa::EnumValue<super::super::TriggerStatus>,
16983            > {
16984                &self.0.reborrow().status
16985            }
16986            /// Optional filter by type.
16987            ///
16988            /// Field 4: `trigger_type`
16989            #[must_use]
16990            pub fn trigger_type(&self) -> ::buffa::EnumValue<super::super::TriggerType> {
16991                self.0.reborrow().trigger_type
16992            }
16993            /// Optional filter by attached parent order ID.
16994            ///
16995            /// Field 5: `parent_order_id`
16996            #[must_use]
16997            pub fn parent_order_id(&self) -> ::core::option::Option<u64> {
16998                self.0.reborrow().parent_order_id
16999            }
17000            /// Maximum number of triggers to return. Defaults to 100 when omitted;
17001            /// maximum is 1000.
17002            ///
17003            /// Field 10: `limit`
17004            #[must_use]
17005            pub fn limit(&self) -> u32 {
17006                self.0.reborrow().limit
17007            }
17008            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17009            /// bound to the authenticated account, sub-account scope, filters, and newest
17010            /// first sort order.
17011            ///
17012            /// Field 12: `page_token`
17013            #[must_use]
17014            pub fn page_token(&self) -> &'_ str {
17015                self.0.reborrow().page_token
17016            }
17017        }
17018        impl ::core::convert::From<::buffa::OwnedView<ListTriggersRequestView<'static>>>
17019        for ListTriggersRequestOwnedView {
17020            fn from(
17021                inner: ::buffa::OwnedView<ListTriggersRequestView<'static>>,
17022            ) -> Self {
17023                ListTriggersRequestOwnedView(inner)
17024            }
17025        }
17026        impl ::core::convert::From<ListTriggersRequestOwnedView>
17027        for ::buffa::OwnedView<ListTriggersRequestView<'static>> {
17028            fn from(wrapper: ListTriggersRequestOwnedView) -> Self {
17029                wrapper.0
17030            }
17031        }
17032        impl ::core::convert::AsRef<::buffa::OwnedView<ListTriggersRequestView<'static>>>
17033        for ListTriggersRequestOwnedView {
17034            fn as_ref(&self) -> &::buffa::OwnedView<ListTriggersRequestView<'static>> {
17035                &self.0
17036            }
17037        }
17038        impl ::buffa::HasMessageView for super::super::ListTriggersRequest {
17039            type View<'a> = ListTriggersRequestView<'a>;
17040            type ViewHandle = ListTriggersRequestOwnedView;
17041        }
17042        impl ::serde::Serialize for ListTriggersRequestOwnedView {
17043            fn serialize<__S: ::serde::Serializer>(
17044                &self,
17045                __s: __S,
17046            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17047                ::serde::Serialize::serialize(&self.0, __s)
17048            }
17049        }
17050        /// ListTriggersResponse returns triggers ordered newest-first.
17051        #[derive(Clone, Debug, Default)]
17052        pub struct ListTriggersResponseView<'a> {
17053            /// Triggers ordered by creation time descending, then trigger ID descending.
17054            ///
17055            /// Field 1: `triggers`
17056            pub triggers: ::buffa::RepeatedView<
17057                'a,
17058                super::super::__buffa::view::TriggerView<'a>,
17059            >,
17060            /// Opaque cursor for the next page. Empty when no more results exist.
17061            ///
17062            /// Field 3: `next_page_token`
17063            pub next_page_token: &'a str,
17064            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17065        }
17066        impl<'a> ::buffa::MessageView<'a> for ListTriggersResponseView<'a> {
17067            type Owned = super::super::ListTriggersResponse;
17068            fn decode_view(
17069                buf: &'a [u8],
17070            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17071                let __limit = ::core::cell::Cell::new(
17072                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17073                );
17074                <Self as ::buffa::MessageView>::decode_view_ctx(
17075                    buf,
17076                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17077                )
17078            }
17079            fn decode_view_with_ctx(
17080                buf: &'a [u8],
17081                ctx: ::buffa::DecodeContext<'_>,
17082            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17083                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17084            }
17085            fn merge_view_field(
17086                &mut self,
17087                tag: ::buffa::encoding::Tag,
17088                cur: &'a [u8],
17089                before_tag: &'a [u8],
17090                ctx: ::buffa::DecodeContext<'_>,
17091            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17092                let _ = ctx;
17093                #[allow(unused_variables)]
17094                let view = self;
17095                let mut cur = cur;
17096                match tag.field_number() {
17097                    3u32 => {
17098                        ::buffa::encoding::check_wire_type(
17099                            tag,
17100                            ::buffa::encoding::WireType::LengthDelimited,
17101                        )?;
17102                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
17103                    }
17104                    1u32 => {
17105                        ::buffa::encoding::check_wire_type(
17106                            tag,
17107                            ::buffa::encoding::WireType::LengthDelimited,
17108                        )?;
17109                        let __sub_ctx = ctx.descend()?;
17110                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
17111                        view.triggers
17112                            .push(
17113                                <super::super::__buffa::view::TriggerView as ::buffa::MessageView>::decode_view_ctx(
17114                                    sub,
17115                                    __sub_ctx,
17116                                )?,
17117                            );
17118                    }
17119                    _ => {
17120                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17121                        let span_len = before_tag.len() - cur.len();
17122                        view.__buffa_unknown_fields
17123                            .push_record(before_tag, span_len, ctx)?;
17124                    }
17125                }
17126                ::core::result::Result::Ok(cur)
17127            }
17128            fn to_owned_message(
17129                &self,
17130            ) -> ::core::result::Result<
17131                super::super::ListTriggersResponse,
17132                ::buffa::DecodeError,
17133            > {
17134                self.to_owned_from_source(None)
17135            }
17136            #[allow(clippy::useless_conversion, clippy::needless_update)]
17137            fn to_owned_from_source(
17138                &self,
17139                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17140            ) -> ::core::result::Result<
17141                super::super::ListTriggersResponse,
17142                ::buffa::DecodeError,
17143            > {
17144                #[allow(unused_imports)]
17145                use ::buffa::alloc::string::ToString as _;
17146                let _ = __buffa_src;
17147                ::core::result::Result::Ok(super::super::ListTriggersResponse {
17148                    triggers: self
17149                        .triggers
17150                        .iter()
17151                        .map(|v| v.to_owned_from_source(__buffa_src))
17152                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
17153                    next_page_token: self.next_page_token.to_string(),
17154                    __buffa_unknown_fields: self
17155                        .__buffa_unknown_fields
17156                        .to_owned()?
17157                        .into(),
17158                    ..::core::default::Default::default()
17159                })
17160            }
17161        }
17162        impl<'a> ::buffa::ViewEncode<'a> for ListTriggersResponseView<'a> {
17163            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17164            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
17165                #[allow(unused_imports)]
17166                use ::buffa::Enumeration as _;
17167                let mut size = 0u32;
17168                for v in &self.triggers {
17169                    let __slot = __cache.reserve();
17170                    let inner_size = v.compute_size(__cache);
17171                    __cache.set(__slot, inner_size);
17172                    size
17173                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
17174                            + inner_size;
17175                }
17176                if !self.next_page_token.is_empty() {
17177                    size
17178                        += 1u32
17179                            + ::buffa::types::string_encoded_len(&self.next_page_token)
17180                                as u32;
17181                }
17182                size += self.__buffa_unknown_fields.encoded_len() as u32;
17183                size
17184            }
17185            #[allow(clippy::needless_borrow)]
17186            fn write_to(
17187                &self,
17188                __cache: &mut ::buffa::SizeCache,
17189                buf: &mut impl ::buffa::bytes::BufMut,
17190            ) {
17191                #[allow(unused_imports)]
17192                use ::buffa::Enumeration as _;
17193                for v in &self.triggers {
17194                    ::buffa::types::put_len_delimited_header(
17195                        1u32,
17196                        __cache.consume_next(),
17197                        buf,
17198                    );
17199                    v.write_to(__cache, buf);
17200                }
17201                if !self.next_page_token.is_empty() {
17202                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
17203                }
17204                self.__buffa_unknown_fields.write_to(buf);
17205            }
17206        }
17207        /// Serializes this view as protobuf JSON.
17208        ///
17209        /// Implicit-presence fields with default values are omitted, `required`
17210        /// fields are always emitted, explicit-presence (`optional`) fields are
17211        /// emitted only when set, bytes fields are base64-encoded, and enum
17212        /// values are their proto name strings.
17213        ///
17214        /// This impl uses `serialize_map(None)` because the number of emitted
17215        /// fields depends on default-omission rules; serializers that require
17216        /// known map lengths (e.g. `bincode`) will return a runtime error.
17217        /// Use the owned message type for those formats.
17218        impl<'__a> ::serde::Serialize for ListTriggersResponseView<'__a> {
17219            fn serialize<__S: ::serde::Serializer>(
17220                &self,
17221                __s: __S,
17222            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17223                use ::serde::ser::SerializeMap as _;
17224                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17225                if !self.triggers.is_empty() {
17226                    __map.serialize_entry("triggers", &*self.triggers)?;
17227                }
17228                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
17229                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
17230                }
17231                __map.end()
17232            }
17233        }
17234        impl<'a> ::buffa::MessageName for ListTriggersResponseView<'a> {
17235            const PACKAGE: &'static str = "triggers.v1";
17236            const NAME: &'static str = "ListTriggersResponse";
17237            const FULL_NAME: &'static str = "triggers.v1.ListTriggersResponse";
17238            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
17239        }
17240        ::buffa::impl_default_view_instance!(ListTriggersResponseView);
17241        ::buffa::impl_view_reborrow!(ListTriggersResponseView);
17242        /** Self-contained, `'static` owned view of a `ListTriggersResponse` message.
17243
17244 Wraps [`::buffa::OwnedView`]`<`[`ListTriggersResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
17245
17246 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListTriggersResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
17247        #[derive(Clone, Debug)]
17248        pub struct ListTriggersResponseOwnedView(
17249            ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17250        );
17251        impl ListTriggersResponseOwnedView {
17252            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17253            ///
17254            /// The view borrows directly from the buffer's data; the buffer is
17255            /// retained inside the returned handle.
17256            ///
17257            /// # Errors
17258            ///
17259            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17260            /// protobuf data.
17261            pub fn decode(
17262                bytes: ::buffa::bytes::Bytes,
17263            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17264                ::core::result::Result::Ok(
17265                    ListTriggersResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
17266                )
17267            }
17268            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17269            /// max message size).
17270            ///
17271            /// # Errors
17272            ///
17273            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17274            /// exceeds the configured limits.
17275            pub fn decode_with_options(
17276                bytes: ::buffa::bytes::Bytes,
17277                opts: &::buffa::DecodeOptions,
17278            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17279                ::core::result::Result::Ok(
17280                    ListTriggersResponseOwnedView(
17281                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17282                    ),
17283                )
17284            }
17285            /// Build from an owned message via an encode → decode round-trip.
17286            ///
17287            /// # Errors
17288            ///
17289            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17290            /// somehow invalid (should not happen for well-formed messages).
17291            pub fn from_owned(
17292                msg: &super::super::ListTriggersResponse,
17293            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17294                ::core::result::Result::Ok(
17295                    ListTriggersResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
17296                )
17297            }
17298            /// Borrow the full [`ListTriggersResponseView`] with its lifetime tied to `&self`.
17299            #[must_use]
17300            pub fn view(&self) -> &ListTriggersResponseView<'_> {
17301                self.0.reborrow()
17302            }
17303            /// Convert to the owned message type.
17304            ///
17305            /// # Errors
17306            ///
17307            /// Returns an error if re-materializing preserved unknown fields
17308            /// fails (e.g. the unknown-field limit is exceeded).
17309            pub fn to_owned_message(
17310                &self,
17311            ) -> ::core::result::Result<
17312                super::super::ListTriggersResponse,
17313                ::buffa::DecodeError,
17314            > {
17315                self.0.to_owned_message()
17316            }
17317            /// The underlying bytes buffer.
17318            #[must_use]
17319            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17320                self.0.bytes()
17321            }
17322            /// Consume the handle, returning the underlying bytes buffer.
17323            #[must_use]
17324            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17325                self.0.into_bytes()
17326            }
17327            /// Triggers ordered by creation time descending, then trigger ID descending.
17328            ///
17329            /// Field 1: `triggers`
17330            #[must_use]
17331            pub fn triggers(
17332                &self,
17333            ) -> &::buffa::RepeatedView<
17334                '_,
17335                super::super::__buffa::view::TriggerView<'_>,
17336            > {
17337                &self.0.reborrow().triggers
17338            }
17339            /// Opaque cursor for the next page. Empty when no more results exist.
17340            ///
17341            /// Field 3: `next_page_token`
17342            #[must_use]
17343            pub fn next_page_token(&self) -> &'_ str {
17344                self.0.reborrow().next_page_token
17345            }
17346        }
17347        impl ::core::convert::From<::buffa::OwnedView<ListTriggersResponseView<'static>>>
17348        for ListTriggersResponseOwnedView {
17349            fn from(
17350                inner: ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17351            ) -> Self {
17352                ListTriggersResponseOwnedView(inner)
17353            }
17354        }
17355        impl ::core::convert::From<ListTriggersResponseOwnedView>
17356        for ::buffa::OwnedView<ListTriggersResponseView<'static>> {
17357            fn from(wrapper: ListTriggersResponseOwnedView) -> Self {
17358                wrapper.0
17359            }
17360        }
17361        impl ::core::convert::AsRef<
17362            ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17363        > for ListTriggersResponseOwnedView {
17364            fn as_ref(&self) -> &::buffa::OwnedView<ListTriggersResponseView<'static>> {
17365                &self.0
17366            }
17367        }
17368        impl ::buffa::HasMessageView for super::super::ListTriggersResponse {
17369            type View<'a> = ListTriggersResponseView<'a>;
17370            type ViewHandle = ListTriggersResponseOwnedView;
17371        }
17372        impl ::serde::Serialize for ListTriggersResponseOwnedView {
17373            fn serialize<__S: ::serde::Serializer>(
17374                &self,
17375                __s: __S,
17376            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17377                ::serde::Serialize::serialize(&self.0, __s)
17378            }
17379        }
17380        /// =============================================================================
17381        /// Trigger Events (History / Audit)
17382        /// =============================================================================
17383        ///
17384        /// ListTriggerEventsRequest lists historical events for one trigger.
17385        #[derive(Clone, Debug, Default)]
17386        pub struct ListTriggerEventsRequestView<'a> {
17387            /// Trigger ID to list events for.
17388            ///
17389            /// Field 1: `trigger_id`
17390            pub trigger_id: u64,
17391            /// Optional sub-account (authorization). When empty or omitted, uses the
17392            /// caller's root account.
17393            ///
17394            /// Field 2: `subaccount_id`
17395            pub subaccount_id: ::core::option::Option<u64>,
17396            /// Maximum number of events to return. Defaults to 100 when omitted; maximum
17397            /// is 1000.
17398            ///
17399            /// Field 3: `limit`
17400            pub limit: u32,
17401            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17402            /// bound to the authenticated account, trigger, sub-account scope, and newest
17403            /// first sort order.
17404            ///
17405            /// Field 5: `page_token`
17406            pub page_token: &'a str,
17407            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17408        }
17409        impl<'a> ::buffa::MessageView<'a> for ListTriggerEventsRequestView<'a> {
17410            type Owned = super::super::ListTriggerEventsRequest;
17411            fn decode_view(
17412                buf: &'a [u8],
17413            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17414                let __limit = ::core::cell::Cell::new(
17415                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17416                );
17417                <Self as ::buffa::MessageView>::decode_view_ctx(
17418                    buf,
17419                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17420                )
17421            }
17422            fn decode_view_with_ctx(
17423                buf: &'a [u8],
17424                ctx: ::buffa::DecodeContext<'_>,
17425            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17426                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17427            }
17428            fn merge_view_field(
17429                &mut self,
17430                tag: ::buffa::encoding::Tag,
17431                cur: &'a [u8],
17432                before_tag: &'a [u8],
17433                ctx: ::buffa::DecodeContext<'_>,
17434            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17435                let _ = ctx;
17436                #[allow(unused_variables)]
17437                let view = self;
17438                let mut cur = cur;
17439                match tag.field_number() {
17440                    1u32 => {
17441                        ::buffa::encoding::check_wire_type(
17442                            tag,
17443                            ::buffa::encoding::WireType::Fixed64,
17444                        )?;
17445                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
17446                    }
17447                    2u32 => {
17448                        ::buffa::encoding::check_wire_type(
17449                            tag,
17450                            ::buffa::encoding::WireType::Fixed64,
17451                        )?;
17452                        view.subaccount_id = Some(
17453                            ::buffa::types::decode_fixed64(&mut cur)?,
17454                        );
17455                    }
17456                    3u32 => {
17457                        ::buffa::encoding::check_wire_type(
17458                            tag,
17459                            ::buffa::encoding::WireType::Varint,
17460                        )?;
17461                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
17462                    }
17463                    5u32 => {
17464                        ::buffa::encoding::check_wire_type(
17465                            tag,
17466                            ::buffa::encoding::WireType::LengthDelimited,
17467                        )?;
17468                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
17469                    }
17470                    _ => {
17471                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17472                        let span_len = before_tag.len() - cur.len();
17473                        view.__buffa_unknown_fields
17474                            .push_record(before_tag, span_len, ctx)?;
17475                    }
17476                }
17477                ::core::result::Result::Ok(cur)
17478            }
17479            fn to_owned_message(
17480                &self,
17481            ) -> ::core::result::Result<
17482                super::super::ListTriggerEventsRequest,
17483                ::buffa::DecodeError,
17484            > {
17485                self.to_owned_from_source(None)
17486            }
17487            #[allow(clippy::useless_conversion, clippy::needless_update)]
17488            fn to_owned_from_source(
17489                &self,
17490                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17491            ) -> ::core::result::Result<
17492                super::super::ListTriggerEventsRequest,
17493                ::buffa::DecodeError,
17494            > {
17495                #[allow(unused_imports)]
17496                use ::buffa::alloc::string::ToString as _;
17497                let _ = __buffa_src;
17498                ::core::result::Result::Ok(super::super::ListTriggerEventsRequest {
17499                    trigger_id: self.trigger_id,
17500                    subaccount_id: self.subaccount_id,
17501                    limit: self.limit,
17502                    page_token: self.page_token.to_string(),
17503                    __buffa_unknown_fields: self
17504                        .__buffa_unknown_fields
17505                        .to_owned()?
17506                        .into(),
17507                    ..::core::default::Default::default()
17508                })
17509            }
17510        }
17511        impl<'a> ::buffa::ViewEncode<'a> for ListTriggerEventsRequestView<'a> {
17512            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17513            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17514                #[allow(unused_imports)]
17515                use ::buffa::Enumeration as _;
17516                let mut size = 0u32;
17517                if self.trigger_id != 0u64 {
17518                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17519                }
17520                if self.subaccount_id.is_some() {
17521                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17522                }
17523                if self.limit != 0u32 {
17524                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
17525                }
17526                if !self.page_token.is_empty() {
17527                    size
17528                        += 1u32
17529                            + ::buffa::types::string_encoded_len(&self.page_token)
17530                                as u32;
17531                }
17532                size += self.__buffa_unknown_fields.encoded_len() as u32;
17533                size
17534            }
17535            #[allow(clippy::needless_borrow)]
17536            fn write_to(
17537                &self,
17538                _cache: &mut ::buffa::SizeCache,
17539                buf: &mut impl ::buffa::bytes::BufMut,
17540            ) {
17541                #[allow(unused_imports)]
17542                use ::buffa::Enumeration as _;
17543                if self.trigger_id != 0u64 {
17544                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
17545                }
17546                if let Some(v) = self.subaccount_id {
17547                    ::buffa::types::put_fixed64_field(2u32, v, buf);
17548                }
17549                if self.limit != 0u32 {
17550                    ::buffa::types::put_uint32_field(3u32, self.limit, buf);
17551                }
17552                if !self.page_token.is_empty() {
17553                    ::buffa::types::put_string_field(5u32, &self.page_token, buf);
17554                }
17555                self.__buffa_unknown_fields.write_to(buf);
17556            }
17557        }
17558        /// Serializes this view as protobuf JSON.
17559        ///
17560        /// Implicit-presence fields with default values are omitted, `required`
17561        /// fields are always emitted, explicit-presence (`optional`) fields are
17562        /// emitted only when set, bytes fields are base64-encoded, and enum
17563        /// values are their proto name strings.
17564        ///
17565        /// This impl uses `serialize_map(None)` because the number of emitted
17566        /// fields depends on default-omission rules; serializers that require
17567        /// known map lengths (e.g. `bincode`) will return a runtime error.
17568        /// Use the owned message type for those formats.
17569        impl<'__a> ::serde::Serialize for ListTriggerEventsRequestView<'__a> {
17570            fn serialize<__S: ::serde::Serializer>(
17571                &self,
17572                __s: __S,
17573            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17574                use ::serde::ser::SerializeMap as _;
17575                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17576                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
17577                    __map
17578                        .serialize_entry(
17579                            "triggerId",
17580                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
17581                        )?;
17582                }
17583                if let ::core::option::Option::Some(__v) = self.subaccount_id {
17584                    __map
17585                        .serialize_entry(
17586                            "subaccountId",
17587                            &::buffa::json_helpers::ProtoJson(&__v),
17588                        )?;
17589                }
17590                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
17591                    __map
17592                        .serialize_entry(
17593                            "limit",
17594                            &::buffa::json_helpers::ProtoJson(&self.limit),
17595                        )?;
17596                }
17597                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
17598                    __map.serialize_entry("pageToken", self.page_token)?;
17599                }
17600                __map.end()
17601            }
17602        }
17603        impl<'a> ::buffa::MessageName for ListTriggerEventsRequestView<'a> {
17604            const PACKAGE: &'static str = "triggers.v1";
17605            const NAME: &'static str = "ListTriggerEventsRequest";
17606            const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsRequest";
17607            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
17608        }
17609        ::buffa::impl_default_view_instance!(ListTriggerEventsRequestView);
17610        ::buffa::impl_view_reborrow!(ListTriggerEventsRequestView);
17611        /** Self-contained, `'static` owned view of a `ListTriggerEventsRequest` message.
17612
17613 Wraps [`::buffa::OwnedView`]`<`[`ListTriggerEventsRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
17614
17615 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListTriggerEventsRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
17616        #[derive(Clone, Debug)]
17617        pub struct ListTriggerEventsRequestOwnedView(
17618            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17619        );
17620        impl ListTriggerEventsRequestOwnedView {
17621            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17622            ///
17623            /// The view borrows directly from the buffer's data; the buffer is
17624            /// retained inside the returned handle.
17625            ///
17626            /// # Errors
17627            ///
17628            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17629            /// protobuf data.
17630            pub fn decode(
17631                bytes: ::buffa::bytes::Bytes,
17632            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17633                ::core::result::Result::Ok(
17634                    ListTriggerEventsRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
17635                )
17636            }
17637            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17638            /// max message size).
17639            ///
17640            /// # Errors
17641            ///
17642            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17643            /// exceeds the configured limits.
17644            pub fn decode_with_options(
17645                bytes: ::buffa::bytes::Bytes,
17646                opts: &::buffa::DecodeOptions,
17647            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17648                ::core::result::Result::Ok(
17649                    ListTriggerEventsRequestOwnedView(
17650                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17651                    ),
17652                )
17653            }
17654            /// Build from an owned message via an encode → decode round-trip.
17655            ///
17656            /// # Errors
17657            ///
17658            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17659            /// somehow invalid (should not happen for well-formed messages).
17660            pub fn from_owned(
17661                msg: &super::super::ListTriggerEventsRequest,
17662            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17663                ::core::result::Result::Ok(
17664                    ListTriggerEventsRequestOwnedView(
17665                        ::buffa::OwnedView::from_owned(msg)?,
17666                    ),
17667                )
17668            }
17669            /// Borrow the full [`ListTriggerEventsRequestView`] with its lifetime tied to `&self`.
17670            #[must_use]
17671            pub fn view(&self) -> &ListTriggerEventsRequestView<'_> {
17672                self.0.reborrow()
17673            }
17674            /// Convert to the owned message type.
17675            ///
17676            /// # Errors
17677            ///
17678            /// Returns an error if re-materializing preserved unknown fields
17679            /// fails (e.g. the unknown-field limit is exceeded).
17680            pub fn to_owned_message(
17681                &self,
17682            ) -> ::core::result::Result<
17683                super::super::ListTriggerEventsRequest,
17684                ::buffa::DecodeError,
17685            > {
17686                self.0.to_owned_message()
17687            }
17688            /// The underlying bytes buffer.
17689            #[must_use]
17690            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17691                self.0.bytes()
17692            }
17693            /// Consume the handle, returning the underlying bytes buffer.
17694            #[must_use]
17695            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17696                self.0.into_bytes()
17697            }
17698            /// Trigger ID to list events for.
17699            ///
17700            /// Field 1: `trigger_id`
17701            #[must_use]
17702            pub fn trigger_id(&self) -> u64 {
17703                self.0.reborrow().trigger_id
17704            }
17705            /// Optional sub-account (authorization). When empty or omitted, uses the
17706            /// caller's root account.
17707            ///
17708            /// Field 2: `subaccount_id`
17709            #[must_use]
17710            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
17711                self.0.reborrow().subaccount_id
17712            }
17713            /// Maximum number of events to return. Defaults to 100 when omitted; maximum
17714            /// is 1000.
17715            ///
17716            /// Field 3: `limit`
17717            #[must_use]
17718            pub fn limit(&self) -> u32 {
17719                self.0.reborrow().limit
17720            }
17721            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17722            /// bound to the authenticated account, trigger, sub-account scope, and newest
17723            /// first sort order.
17724            ///
17725            /// Field 5: `page_token`
17726            #[must_use]
17727            pub fn page_token(&self) -> &'_ str {
17728                self.0.reborrow().page_token
17729            }
17730        }
17731        impl ::core::convert::From<
17732            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17733        > for ListTriggerEventsRequestOwnedView {
17734            fn from(
17735                inner: ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17736            ) -> Self {
17737                ListTriggerEventsRequestOwnedView(inner)
17738            }
17739        }
17740        impl ::core::convert::From<ListTriggerEventsRequestOwnedView>
17741        for ::buffa::OwnedView<ListTriggerEventsRequestView<'static>> {
17742            fn from(wrapper: ListTriggerEventsRequestOwnedView) -> Self {
17743                wrapper.0
17744            }
17745        }
17746        impl ::core::convert::AsRef<
17747            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17748        > for ListTriggerEventsRequestOwnedView {
17749            fn as_ref(
17750                &self,
17751            ) -> &::buffa::OwnedView<ListTriggerEventsRequestView<'static>> {
17752                &self.0
17753            }
17754        }
17755        impl ::buffa::HasMessageView for super::super::ListTriggerEventsRequest {
17756            type View<'a> = ListTriggerEventsRequestView<'a>;
17757            type ViewHandle = ListTriggerEventsRequestOwnedView;
17758        }
17759        impl ::serde::Serialize for ListTriggerEventsRequestOwnedView {
17760            fn serialize<__S: ::serde::Serializer>(
17761                &self,
17762                __s: __S,
17763            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17764                ::serde::Serialize::serialize(&self.0, __s)
17765            }
17766        }
17767        /// TriggerEvent describes one historical trigger lifecycle event.
17768        #[derive(Clone, Debug, Default)]
17769        pub struct TriggerEventView<'a> {
17770            /// Trigger ID associated with the event.
17771            ///
17772            /// Field 1: `trigger_id`
17773            pub trigger_id: u64,
17774            /// Public account or sub-account ID associated with the trigger.
17775            ///
17776            /// Field 2: `subaccount_id`
17777            pub subaccount_id: u64,
17778            /// Trading symbol numeric identifier.
17779            ///
17780            /// Field 3: `symbol_id`
17781            pub symbol_id: u32,
17782            /// Trigger type at the time of the event.
17783            ///
17784            /// Field 4: `trigger_type`
17785            pub trigger_type: ::buffa::EnumValue<super::super::TriggerType>,
17786            /// Event category.
17787            ///
17788            /// Field 5: `event_type`
17789            pub event_type: ::buffa::EnumValue<super::super::TriggerEventType>,
17790            /// Event timestamp in nanoseconds since epoch (UTC).
17791            ///
17792            /// Field 10: `ts_ns`
17793            pub ts_ns: u64,
17794            /// Child sequence number for multi-child trigger strategies.
17795            ///
17796            /// Field 11: `child_seq`
17797            pub child_seq: i32,
17798            /// Child order ID created by this event, if any.
17799            ///
17800            /// Field 12: `child_order_id`
17801            pub child_order_id: u64,
17802            /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
17803            /// when not applicable.
17804            ///
17805            /// Field 13: `fire_price_ticks`
17806            pub fire_price_ticks: i64,
17807            /// Optional cancel reason.
17808            ///
17809            /// Field 20: `reason`
17810            pub reason: &'a str,
17811            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17812        }
17813        impl<'a> ::buffa::MessageView<'a> for TriggerEventView<'a> {
17814            type Owned = super::super::TriggerEvent;
17815            fn decode_view(
17816                buf: &'a [u8],
17817            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17818                let __limit = ::core::cell::Cell::new(
17819                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17820                );
17821                <Self as ::buffa::MessageView>::decode_view_ctx(
17822                    buf,
17823                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17824                )
17825            }
17826            fn decode_view_with_ctx(
17827                buf: &'a [u8],
17828                ctx: ::buffa::DecodeContext<'_>,
17829            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17830                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17831            }
17832            fn merge_view_field(
17833                &mut self,
17834                tag: ::buffa::encoding::Tag,
17835                cur: &'a [u8],
17836                before_tag: &'a [u8],
17837                ctx: ::buffa::DecodeContext<'_>,
17838            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17839                let _ = ctx;
17840                #[allow(unused_variables)]
17841                let view = self;
17842                let mut cur = cur;
17843                match tag.field_number() {
17844                    1u32 => {
17845                        ::buffa::encoding::check_wire_type(
17846                            tag,
17847                            ::buffa::encoding::WireType::Fixed64,
17848                        )?;
17849                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
17850                    }
17851                    2u32 => {
17852                        ::buffa::encoding::check_wire_type(
17853                            tag,
17854                            ::buffa::encoding::WireType::Fixed64,
17855                        )?;
17856                        view.subaccount_id = ::buffa::types::decode_fixed64(&mut cur)?;
17857                    }
17858                    3u32 => {
17859                        ::buffa::encoding::check_wire_type(
17860                            tag,
17861                            ::buffa::encoding::WireType::Varint,
17862                        )?;
17863                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
17864                    }
17865                    4u32 => {
17866                        ::buffa::encoding::check_wire_type(
17867                            tag,
17868                            ::buffa::encoding::WireType::Varint,
17869                        )?;
17870                        view.trigger_type = ::buffa::EnumValue::from(
17871                            ::buffa::types::decode_int32(&mut cur)?,
17872                        );
17873                    }
17874                    5u32 => {
17875                        ::buffa::encoding::check_wire_type(
17876                            tag,
17877                            ::buffa::encoding::WireType::Varint,
17878                        )?;
17879                        view.event_type = ::buffa::EnumValue::from(
17880                            ::buffa::types::decode_int32(&mut cur)?,
17881                        );
17882                    }
17883                    10u32 => {
17884                        ::buffa::encoding::check_wire_type(
17885                            tag,
17886                            ::buffa::encoding::WireType::Varint,
17887                        )?;
17888                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
17889                    }
17890                    11u32 => {
17891                        ::buffa::encoding::check_wire_type(
17892                            tag,
17893                            ::buffa::encoding::WireType::Varint,
17894                        )?;
17895                        view.child_seq = ::buffa::types::decode_int32(&mut cur)?;
17896                    }
17897                    12u32 => {
17898                        ::buffa::encoding::check_wire_type(
17899                            tag,
17900                            ::buffa::encoding::WireType::Fixed64,
17901                        )?;
17902                        view.child_order_id = ::buffa::types::decode_fixed64(&mut cur)?;
17903                    }
17904                    13u32 => {
17905                        ::buffa::encoding::check_wire_type(
17906                            tag,
17907                            ::buffa::encoding::WireType::Varint,
17908                        )?;
17909                        view.fire_price_ticks = ::buffa::types::decode_int64(&mut cur)?;
17910                    }
17911                    20u32 => {
17912                        ::buffa::encoding::check_wire_type(
17913                            tag,
17914                            ::buffa::encoding::WireType::LengthDelimited,
17915                        )?;
17916                        view.reason = ::buffa::types::borrow_str(&mut cur)?;
17917                    }
17918                    _ => {
17919                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17920                        let span_len = before_tag.len() - cur.len();
17921                        view.__buffa_unknown_fields
17922                            .push_record(before_tag, span_len, ctx)?;
17923                    }
17924                }
17925                ::core::result::Result::Ok(cur)
17926            }
17927            fn to_owned_message(
17928                &self,
17929            ) -> ::core::result::Result<
17930                super::super::TriggerEvent,
17931                ::buffa::DecodeError,
17932            > {
17933                self.to_owned_from_source(None)
17934            }
17935            #[allow(clippy::useless_conversion, clippy::needless_update)]
17936            fn to_owned_from_source(
17937                &self,
17938                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17939            ) -> ::core::result::Result<
17940                super::super::TriggerEvent,
17941                ::buffa::DecodeError,
17942            > {
17943                #[allow(unused_imports)]
17944                use ::buffa::alloc::string::ToString as _;
17945                let _ = __buffa_src;
17946                ::core::result::Result::Ok(super::super::TriggerEvent {
17947                    trigger_id: self.trigger_id,
17948                    subaccount_id: self.subaccount_id,
17949                    symbol_id: self.symbol_id,
17950                    trigger_type: self.trigger_type,
17951                    event_type: self.event_type,
17952                    ts_ns: self.ts_ns,
17953                    child_seq: self.child_seq,
17954                    child_order_id: self.child_order_id,
17955                    fire_price_ticks: self.fire_price_ticks,
17956                    reason: self.reason.to_string(),
17957                    __buffa_unknown_fields: self
17958                        .__buffa_unknown_fields
17959                        .to_owned()?
17960                        .into(),
17961                    ..::core::default::Default::default()
17962                })
17963            }
17964        }
17965        impl<'a> ::buffa::ViewEncode<'a> for TriggerEventView<'a> {
17966            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17967            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17968                #[allow(unused_imports)]
17969                use ::buffa::Enumeration as _;
17970                let mut size = 0u32;
17971                if self.trigger_id != 0u64 {
17972                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17973                }
17974                if self.subaccount_id != 0u64 {
17975                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17976                }
17977                if self.symbol_id != 0u32 {
17978                    size
17979                        += 1u32
17980                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
17981                }
17982                {
17983                    let val = self.trigger_type.to_i32();
17984                    if val != 0 {
17985                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
17986                    }
17987                }
17988                {
17989                    let val = self.event_type.to_i32();
17990                    if val != 0 {
17991                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
17992                    }
17993                }
17994                if self.ts_ns != 0u64 {
17995                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
17996                }
17997                if self.child_seq != 0i32 {
17998                    size
17999                        += 1u32
18000                            + ::buffa::types::int32_encoded_len(self.child_seq) as u32;
18001                }
18002                if self.child_order_id != 0u64 {
18003                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18004                }
18005                if self.fire_price_ticks != 0i64 {
18006                    size
18007                        += 1u32
18008                            + ::buffa::types::int64_encoded_len(self.fire_price_ticks)
18009                                as u32;
18010                }
18011                if !self.reason.is_empty() {
18012                    size
18013                        += 2u32
18014                            + ::buffa::types::string_encoded_len(&self.reason) as u32;
18015                }
18016                size += self.__buffa_unknown_fields.encoded_len() as u32;
18017                size
18018            }
18019            #[allow(clippy::needless_borrow)]
18020            fn write_to(
18021                &self,
18022                _cache: &mut ::buffa::SizeCache,
18023                buf: &mut impl ::buffa::bytes::BufMut,
18024            ) {
18025                #[allow(unused_imports)]
18026                use ::buffa::Enumeration as _;
18027                if self.trigger_id != 0u64 {
18028                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
18029                }
18030                if self.subaccount_id != 0u64 {
18031                    ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
18032                }
18033                if self.symbol_id != 0u32 {
18034                    ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
18035                }
18036                {
18037                    let val = self.trigger_type.to_i32();
18038                    if val != 0 {
18039                        ::buffa::types::put_int32_field(4u32, val, buf);
18040                    }
18041                }
18042                {
18043                    let val = self.event_type.to_i32();
18044                    if val != 0 {
18045                        ::buffa::types::put_int32_field(5u32, val, buf);
18046                    }
18047                }
18048                if self.ts_ns != 0u64 {
18049                    ::buffa::types::put_uint64_field(10u32, self.ts_ns, buf);
18050                }
18051                if self.child_seq != 0i32 {
18052                    ::buffa::types::put_int32_field(11u32, self.child_seq, buf);
18053                }
18054                if self.child_order_id != 0u64 {
18055                    ::buffa::types::put_fixed64_field(12u32, self.child_order_id, buf);
18056                }
18057                if self.fire_price_ticks != 0i64 {
18058                    ::buffa::types::put_int64_field(13u32, self.fire_price_ticks, buf);
18059                }
18060                if !self.reason.is_empty() {
18061                    ::buffa::types::put_string_field(20u32, &self.reason, buf);
18062                }
18063                self.__buffa_unknown_fields.write_to(buf);
18064            }
18065        }
18066        /// Serializes this view as protobuf JSON.
18067        ///
18068        /// Implicit-presence fields with default values are omitted, `required`
18069        /// fields are always emitted, explicit-presence (`optional`) fields are
18070        /// emitted only when set, bytes fields are base64-encoded, and enum
18071        /// values are their proto name strings.
18072        ///
18073        /// This impl uses `serialize_map(None)` because the number of emitted
18074        /// fields depends on default-omission rules; serializers that require
18075        /// known map lengths (e.g. `bincode`) will return a runtime error.
18076        /// Use the owned message type for those formats.
18077        impl<'__a> ::serde::Serialize for TriggerEventView<'__a> {
18078            fn serialize<__S: ::serde::Serializer>(
18079                &self,
18080                __s: __S,
18081            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18082                use ::serde::ser::SerializeMap as _;
18083                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18084                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
18085                    __map
18086                        .serialize_entry(
18087                            "triggerId",
18088                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
18089                        )?;
18090                }
18091                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
18092                    __map
18093                        .serialize_entry(
18094                            "subaccountId",
18095                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
18096                        )?;
18097                }
18098                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
18099                    __map
18100                        .serialize_entry(
18101                            "symbolId",
18102                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
18103                        )?;
18104                }
18105                if !::buffa::json_helpers::skip_if::is_default_enum_value(
18106                    &self.trigger_type,
18107                ) {
18108                    __map.serialize_entry("triggerType", &self.trigger_type)?;
18109                }
18110                if !::buffa::json_helpers::skip_if::is_default_enum_value(
18111                    &self.event_type,
18112                ) {
18113                    __map.serialize_entry("eventType", &self.event_type)?;
18114                }
18115                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
18116                    __map
18117                        .serialize_entry(
18118                            "tsNs",
18119                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
18120                        )?;
18121                }
18122                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.child_seq) {
18123                    __map
18124                        .serialize_entry(
18125                            "childSeq",
18126                            &::buffa::json_helpers::ProtoJson(&self.child_seq),
18127                        )?;
18128                }
18129                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.child_order_id) {
18130                    __map
18131                        .serialize_entry(
18132                            "childOrderId",
18133                            &::buffa::json_helpers::ProtoJson(&self.child_order_id),
18134                        )?;
18135                }
18136                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.fire_price_ticks) {
18137                    __map
18138                        .serialize_entry(
18139                            "firePriceTicks",
18140                            &::buffa::json_helpers::ProtoJson(&self.fire_price_ticks),
18141                        )?;
18142                }
18143                if !::buffa::json_helpers::skip_if::is_empty_str(self.reason) {
18144                    __map.serialize_entry("reason", self.reason)?;
18145                }
18146                __map.end()
18147            }
18148        }
18149        impl<'a> ::buffa::MessageName for TriggerEventView<'a> {
18150            const PACKAGE: &'static str = "triggers.v1";
18151            const NAME: &'static str = "TriggerEvent";
18152            const FULL_NAME: &'static str = "triggers.v1.TriggerEvent";
18153            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
18154        }
18155        ::buffa::impl_default_view_instance!(TriggerEventView);
18156        ::buffa::impl_view_reborrow!(TriggerEventView);
18157        /** Self-contained, `'static` owned view of a `TriggerEvent` message.
18158
18159 Wraps [`::buffa::OwnedView`]`<`[`TriggerEventView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
18160
18161 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerEventView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
18162        #[derive(Clone, Debug)]
18163        pub struct TriggerEventOwnedView(::buffa::OwnedView<TriggerEventView<'static>>);
18164        impl TriggerEventOwnedView {
18165            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18166            ///
18167            /// The view borrows directly from the buffer's data; the buffer is
18168            /// retained inside the returned handle.
18169            ///
18170            /// # Errors
18171            ///
18172            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18173            /// protobuf data.
18174            pub fn decode(
18175                bytes: ::buffa::bytes::Bytes,
18176            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18177                ::core::result::Result::Ok(
18178                    TriggerEventOwnedView(::buffa::OwnedView::decode(bytes)?),
18179                )
18180            }
18181            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18182            /// max message size).
18183            ///
18184            /// # Errors
18185            ///
18186            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18187            /// exceeds the configured limits.
18188            pub fn decode_with_options(
18189                bytes: ::buffa::bytes::Bytes,
18190                opts: &::buffa::DecodeOptions,
18191            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18192                ::core::result::Result::Ok(
18193                    TriggerEventOwnedView(
18194                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18195                    ),
18196                )
18197            }
18198            /// Build from an owned message via an encode → decode round-trip.
18199            ///
18200            /// # Errors
18201            ///
18202            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18203            /// somehow invalid (should not happen for well-formed messages).
18204            pub fn from_owned(
18205                msg: &super::super::TriggerEvent,
18206            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18207                ::core::result::Result::Ok(
18208                    TriggerEventOwnedView(::buffa::OwnedView::from_owned(msg)?),
18209                )
18210            }
18211            /// Borrow the full [`TriggerEventView`] with its lifetime tied to `&self`.
18212            #[must_use]
18213            pub fn view(&self) -> &TriggerEventView<'_> {
18214                self.0.reborrow()
18215            }
18216            /// Convert to the owned message type.
18217            ///
18218            /// # Errors
18219            ///
18220            /// Returns an error if re-materializing preserved unknown fields
18221            /// fails (e.g. the unknown-field limit is exceeded).
18222            pub fn to_owned_message(
18223                &self,
18224            ) -> ::core::result::Result<
18225                super::super::TriggerEvent,
18226                ::buffa::DecodeError,
18227            > {
18228                self.0.to_owned_message()
18229            }
18230            /// The underlying bytes buffer.
18231            #[must_use]
18232            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18233                self.0.bytes()
18234            }
18235            /// Consume the handle, returning the underlying bytes buffer.
18236            #[must_use]
18237            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18238                self.0.into_bytes()
18239            }
18240            /// Trigger ID associated with the event.
18241            ///
18242            /// Field 1: `trigger_id`
18243            #[must_use]
18244            pub fn trigger_id(&self) -> u64 {
18245                self.0.reborrow().trigger_id
18246            }
18247            /// Public account or sub-account ID associated with the trigger.
18248            ///
18249            /// Field 2: `subaccount_id`
18250            #[must_use]
18251            pub fn subaccount_id(&self) -> u64 {
18252                self.0.reborrow().subaccount_id
18253            }
18254            /// Trading symbol numeric identifier.
18255            ///
18256            /// Field 3: `symbol_id`
18257            #[must_use]
18258            pub fn symbol_id(&self) -> u32 {
18259                self.0.reborrow().symbol_id
18260            }
18261            /// Trigger type at the time of the event.
18262            ///
18263            /// Field 4: `trigger_type`
18264            #[must_use]
18265            pub fn trigger_type(&self) -> ::buffa::EnumValue<super::super::TriggerType> {
18266                self.0.reborrow().trigger_type
18267            }
18268            /// Event category.
18269            ///
18270            /// Field 5: `event_type`
18271            #[must_use]
18272            pub fn event_type(
18273                &self,
18274            ) -> ::buffa::EnumValue<super::super::TriggerEventType> {
18275                self.0.reborrow().event_type
18276            }
18277            /// Event timestamp in nanoseconds since epoch (UTC).
18278            ///
18279            /// Field 10: `ts_ns`
18280            #[must_use]
18281            pub fn ts_ns(&self) -> u64 {
18282                self.0.reborrow().ts_ns
18283            }
18284            /// Child sequence number for multi-child trigger strategies.
18285            ///
18286            /// Field 11: `child_seq`
18287            #[must_use]
18288            pub fn child_seq(&self) -> i32 {
18289                self.0.reborrow().child_seq
18290            }
18291            /// Child order ID created by this event, if any.
18292            ///
18293            /// Field 12: `child_order_id`
18294            #[must_use]
18295            pub fn child_order_id(&self) -> u64 {
18296                self.0.reborrow().child_order_id
18297            }
18298            /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
18299            /// when not applicable.
18300            ///
18301            /// Field 13: `fire_price_ticks`
18302            #[must_use]
18303            pub fn fire_price_ticks(&self) -> i64 {
18304                self.0.reborrow().fire_price_ticks
18305            }
18306            /// Optional cancel reason.
18307            ///
18308            /// Field 20: `reason`
18309            #[must_use]
18310            pub fn reason(&self) -> &'_ str {
18311                self.0.reborrow().reason
18312            }
18313        }
18314        impl ::core::convert::From<::buffa::OwnedView<TriggerEventView<'static>>>
18315        for TriggerEventOwnedView {
18316            fn from(inner: ::buffa::OwnedView<TriggerEventView<'static>>) -> Self {
18317                TriggerEventOwnedView(inner)
18318            }
18319        }
18320        impl ::core::convert::From<TriggerEventOwnedView>
18321        for ::buffa::OwnedView<TriggerEventView<'static>> {
18322            fn from(wrapper: TriggerEventOwnedView) -> Self {
18323                wrapper.0
18324            }
18325        }
18326        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerEventView<'static>>>
18327        for TriggerEventOwnedView {
18328            fn as_ref(&self) -> &::buffa::OwnedView<TriggerEventView<'static>> {
18329                &self.0
18330            }
18331        }
18332        impl ::buffa::HasMessageView for super::super::TriggerEvent {
18333            type View<'a> = TriggerEventView<'a>;
18334            type ViewHandle = TriggerEventOwnedView;
18335        }
18336        impl ::serde::Serialize for TriggerEventOwnedView {
18337            fn serialize<__S: ::serde::Serializer>(
18338                &self,
18339                __s: __S,
18340            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18341                ::serde::Serialize::serialize(&self.0, __s)
18342            }
18343        }
18344        /// ListTriggerEventsResponse returns historical events ordered newest-first.
18345        #[derive(Clone, Debug, Default)]
18346        pub struct ListTriggerEventsResponseView<'a> {
18347            /// Events ordered by event time descending, child sequence descending, and
18348            /// stable event tie-breakers descending.
18349            ///
18350            /// Field 1: `events`
18351            pub events: ::buffa::RepeatedView<
18352                'a,
18353                super::super::__buffa::view::TriggerEventView<'a>,
18354            >,
18355            /// Opaque cursor for the next page. Empty when no more results exist.
18356            ///
18357            /// Field 3: `next_page_token`
18358            pub next_page_token: &'a str,
18359            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18360        }
18361        impl<'a> ::buffa::MessageView<'a> for ListTriggerEventsResponseView<'a> {
18362            type Owned = super::super::ListTriggerEventsResponse;
18363            fn decode_view(
18364                buf: &'a [u8],
18365            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18366                let __limit = ::core::cell::Cell::new(
18367                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18368                );
18369                <Self as ::buffa::MessageView>::decode_view_ctx(
18370                    buf,
18371                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18372                )
18373            }
18374            fn decode_view_with_ctx(
18375                buf: &'a [u8],
18376                ctx: ::buffa::DecodeContext<'_>,
18377            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18378                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18379            }
18380            fn merge_view_field(
18381                &mut self,
18382                tag: ::buffa::encoding::Tag,
18383                cur: &'a [u8],
18384                before_tag: &'a [u8],
18385                ctx: ::buffa::DecodeContext<'_>,
18386            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18387                let _ = ctx;
18388                #[allow(unused_variables)]
18389                let view = self;
18390                let mut cur = cur;
18391                match tag.field_number() {
18392                    3u32 => {
18393                        ::buffa::encoding::check_wire_type(
18394                            tag,
18395                            ::buffa::encoding::WireType::LengthDelimited,
18396                        )?;
18397                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
18398                    }
18399                    1u32 => {
18400                        ::buffa::encoding::check_wire_type(
18401                            tag,
18402                            ::buffa::encoding::WireType::LengthDelimited,
18403                        )?;
18404                        let __sub_ctx = ctx.descend()?;
18405                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
18406                        view.events
18407                            .push(
18408                                <super::super::__buffa::view::TriggerEventView as ::buffa::MessageView>::decode_view_ctx(
18409                                    sub,
18410                                    __sub_ctx,
18411                                )?,
18412                            );
18413                    }
18414                    _ => {
18415                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18416                        let span_len = before_tag.len() - cur.len();
18417                        view.__buffa_unknown_fields
18418                            .push_record(before_tag, span_len, ctx)?;
18419                    }
18420                }
18421                ::core::result::Result::Ok(cur)
18422            }
18423            fn to_owned_message(
18424                &self,
18425            ) -> ::core::result::Result<
18426                super::super::ListTriggerEventsResponse,
18427                ::buffa::DecodeError,
18428            > {
18429                self.to_owned_from_source(None)
18430            }
18431            #[allow(clippy::useless_conversion, clippy::needless_update)]
18432            fn to_owned_from_source(
18433                &self,
18434                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18435            ) -> ::core::result::Result<
18436                super::super::ListTriggerEventsResponse,
18437                ::buffa::DecodeError,
18438            > {
18439                #[allow(unused_imports)]
18440                use ::buffa::alloc::string::ToString as _;
18441                let _ = __buffa_src;
18442                ::core::result::Result::Ok(super::super::ListTriggerEventsResponse {
18443                    events: self
18444                        .events
18445                        .iter()
18446                        .map(|v| v.to_owned_from_source(__buffa_src))
18447                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
18448                    next_page_token: self.next_page_token.to_string(),
18449                    __buffa_unknown_fields: self
18450                        .__buffa_unknown_fields
18451                        .to_owned()?
18452                        .into(),
18453                    ..::core::default::Default::default()
18454                })
18455            }
18456        }
18457        impl<'a> ::buffa::ViewEncode<'a> for ListTriggerEventsResponseView<'a> {
18458            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18459            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
18460                #[allow(unused_imports)]
18461                use ::buffa::Enumeration as _;
18462                let mut size = 0u32;
18463                for v in &self.events {
18464                    let __slot = __cache.reserve();
18465                    let inner_size = v.compute_size(__cache);
18466                    __cache.set(__slot, inner_size);
18467                    size
18468                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18469                            + inner_size;
18470                }
18471                if !self.next_page_token.is_empty() {
18472                    size
18473                        += 1u32
18474                            + ::buffa::types::string_encoded_len(&self.next_page_token)
18475                                as u32;
18476                }
18477                size += self.__buffa_unknown_fields.encoded_len() as u32;
18478                size
18479            }
18480            #[allow(clippy::needless_borrow)]
18481            fn write_to(
18482                &self,
18483                __cache: &mut ::buffa::SizeCache,
18484                buf: &mut impl ::buffa::bytes::BufMut,
18485            ) {
18486                #[allow(unused_imports)]
18487                use ::buffa::Enumeration as _;
18488                for v in &self.events {
18489                    ::buffa::types::put_len_delimited_header(
18490                        1u32,
18491                        __cache.consume_next(),
18492                        buf,
18493                    );
18494                    v.write_to(__cache, buf);
18495                }
18496                if !self.next_page_token.is_empty() {
18497                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
18498                }
18499                self.__buffa_unknown_fields.write_to(buf);
18500            }
18501        }
18502        /// Serializes this view as protobuf JSON.
18503        ///
18504        /// Implicit-presence fields with default values are omitted, `required`
18505        /// fields are always emitted, explicit-presence (`optional`) fields are
18506        /// emitted only when set, bytes fields are base64-encoded, and enum
18507        /// values are their proto name strings.
18508        ///
18509        /// This impl uses `serialize_map(None)` because the number of emitted
18510        /// fields depends on default-omission rules; serializers that require
18511        /// known map lengths (e.g. `bincode`) will return a runtime error.
18512        /// Use the owned message type for those formats.
18513        impl<'__a> ::serde::Serialize for ListTriggerEventsResponseView<'__a> {
18514            fn serialize<__S: ::serde::Serializer>(
18515                &self,
18516                __s: __S,
18517            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18518                use ::serde::ser::SerializeMap as _;
18519                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18520                if !self.events.is_empty() {
18521                    __map.serialize_entry("events", &*self.events)?;
18522                }
18523                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
18524                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
18525                }
18526                __map.end()
18527            }
18528        }
18529        impl<'a> ::buffa::MessageName for ListTriggerEventsResponseView<'a> {
18530            const PACKAGE: &'static str = "triggers.v1";
18531            const NAME: &'static str = "ListTriggerEventsResponse";
18532            const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsResponse";
18533            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
18534        }
18535        ::buffa::impl_default_view_instance!(ListTriggerEventsResponseView);
18536        ::buffa::impl_view_reborrow!(ListTriggerEventsResponseView);
18537        /** Self-contained, `'static` owned view of a `ListTriggerEventsResponse` message.
18538
18539 Wraps [`::buffa::OwnedView`]`<`[`ListTriggerEventsResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
18540
18541 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ListTriggerEventsResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
18542        #[derive(Clone, Debug)]
18543        pub struct ListTriggerEventsResponseOwnedView(
18544            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18545        );
18546        impl ListTriggerEventsResponseOwnedView {
18547            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18548            ///
18549            /// The view borrows directly from the buffer's data; the buffer is
18550            /// retained inside the returned handle.
18551            ///
18552            /// # Errors
18553            ///
18554            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18555            /// protobuf data.
18556            pub fn decode(
18557                bytes: ::buffa::bytes::Bytes,
18558            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18559                ::core::result::Result::Ok(
18560                    ListTriggerEventsResponseOwnedView(
18561                        ::buffa::OwnedView::decode(bytes)?,
18562                    ),
18563                )
18564            }
18565            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18566            /// max message size).
18567            ///
18568            /// # Errors
18569            ///
18570            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18571            /// exceeds the configured limits.
18572            pub fn decode_with_options(
18573                bytes: ::buffa::bytes::Bytes,
18574                opts: &::buffa::DecodeOptions,
18575            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18576                ::core::result::Result::Ok(
18577                    ListTriggerEventsResponseOwnedView(
18578                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18579                    ),
18580                )
18581            }
18582            /// Build from an owned message via an encode → decode round-trip.
18583            ///
18584            /// # Errors
18585            ///
18586            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18587            /// somehow invalid (should not happen for well-formed messages).
18588            pub fn from_owned(
18589                msg: &super::super::ListTriggerEventsResponse,
18590            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18591                ::core::result::Result::Ok(
18592                    ListTriggerEventsResponseOwnedView(
18593                        ::buffa::OwnedView::from_owned(msg)?,
18594                    ),
18595                )
18596            }
18597            /// Borrow the full [`ListTriggerEventsResponseView`] with its lifetime tied to `&self`.
18598            #[must_use]
18599            pub fn view(&self) -> &ListTriggerEventsResponseView<'_> {
18600                self.0.reborrow()
18601            }
18602            /// Convert to the owned message type.
18603            ///
18604            /// # Errors
18605            ///
18606            /// Returns an error if re-materializing preserved unknown fields
18607            /// fails (e.g. the unknown-field limit is exceeded).
18608            pub fn to_owned_message(
18609                &self,
18610            ) -> ::core::result::Result<
18611                super::super::ListTriggerEventsResponse,
18612                ::buffa::DecodeError,
18613            > {
18614                self.0.to_owned_message()
18615            }
18616            /// The underlying bytes buffer.
18617            #[must_use]
18618            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18619                self.0.bytes()
18620            }
18621            /// Consume the handle, returning the underlying bytes buffer.
18622            #[must_use]
18623            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18624                self.0.into_bytes()
18625            }
18626            /// Events ordered by event time descending, child sequence descending, and
18627            /// stable event tie-breakers descending.
18628            ///
18629            /// Field 1: `events`
18630            #[must_use]
18631            pub fn events(
18632                &self,
18633            ) -> &::buffa::RepeatedView<
18634                '_,
18635                super::super::__buffa::view::TriggerEventView<'_>,
18636            > {
18637                &self.0.reborrow().events
18638            }
18639            /// Opaque cursor for the next page. Empty when no more results exist.
18640            ///
18641            /// Field 3: `next_page_token`
18642            #[must_use]
18643            pub fn next_page_token(&self) -> &'_ str {
18644                self.0.reborrow().next_page_token
18645            }
18646        }
18647        impl ::core::convert::From<
18648            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18649        > for ListTriggerEventsResponseOwnedView {
18650            fn from(
18651                inner: ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18652            ) -> Self {
18653                ListTriggerEventsResponseOwnedView(inner)
18654            }
18655        }
18656        impl ::core::convert::From<ListTriggerEventsResponseOwnedView>
18657        for ::buffa::OwnedView<ListTriggerEventsResponseView<'static>> {
18658            fn from(wrapper: ListTriggerEventsResponseOwnedView) -> Self {
18659                wrapper.0
18660            }
18661        }
18662        impl ::core::convert::AsRef<
18663            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18664        > for ListTriggerEventsResponseOwnedView {
18665            fn as_ref(
18666                &self,
18667            ) -> &::buffa::OwnedView<ListTriggerEventsResponseView<'static>> {
18668                &self.0
18669            }
18670        }
18671        impl ::buffa::HasMessageView for super::super::ListTriggerEventsResponse {
18672            type View<'a> = ListTriggerEventsResponseView<'a>;
18673            type ViewHandle = ListTriggerEventsResponseOwnedView;
18674        }
18675        impl ::serde::Serialize for ListTriggerEventsResponseOwnedView {
18676            fn serialize<__S: ::serde::Serializer>(
18677                &self,
18678                __s: __S,
18679            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18680                ::serde::Serialize::serialize(&self.0, __s)
18681            }
18682        }
18683        /// =============================================================================
18684        /// Cancel Trigger
18685        /// =============================================================================
18686        ///
18687        /// CancelTriggerRequest cancels an active trigger by ID.
18688        #[derive(Clone, Debug, Default)]
18689        pub struct CancelTriggerRequestView<'a> {
18690            /// Trigger ID to cancel.
18691            ///
18692            /// Field 1: `trigger_id`
18693            pub trigger_id: u64,
18694            /// Optional sub-account for authorization.
18695            ///
18696            /// Field 2: `subaccount_id`
18697            pub subaccount_id: ::core::option::Option<u64>,
18698            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18699        }
18700        impl<'a> ::buffa::MessageView<'a> for CancelTriggerRequestView<'a> {
18701            type Owned = super::super::CancelTriggerRequest;
18702            fn decode_view(
18703                buf: &'a [u8],
18704            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18705                let __limit = ::core::cell::Cell::new(
18706                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18707                );
18708                <Self as ::buffa::MessageView>::decode_view_ctx(
18709                    buf,
18710                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18711                )
18712            }
18713            fn decode_view_with_ctx(
18714                buf: &'a [u8],
18715                ctx: ::buffa::DecodeContext<'_>,
18716            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18717                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18718            }
18719            fn merge_view_field(
18720                &mut self,
18721                tag: ::buffa::encoding::Tag,
18722                cur: &'a [u8],
18723                before_tag: &'a [u8],
18724                ctx: ::buffa::DecodeContext<'_>,
18725            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18726                let _ = ctx;
18727                #[allow(unused_variables)]
18728                let view = self;
18729                let mut cur = cur;
18730                match tag.field_number() {
18731                    1u32 => {
18732                        ::buffa::encoding::check_wire_type(
18733                            tag,
18734                            ::buffa::encoding::WireType::Fixed64,
18735                        )?;
18736                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
18737                    }
18738                    2u32 => {
18739                        ::buffa::encoding::check_wire_type(
18740                            tag,
18741                            ::buffa::encoding::WireType::Fixed64,
18742                        )?;
18743                        view.subaccount_id = Some(
18744                            ::buffa::types::decode_fixed64(&mut cur)?,
18745                        );
18746                    }
18747                    _ => {
18748                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18749                        let span_len = before_tag.len() - cur.len();
18750                        view.__buffa_unknown_fields
18751                            .push_record(before_tag, span_len, ctx)?;
18752                    }
18753                }
18754                ::core::result::Result::Ok(cur)
18755            }
18756            fn to_owned_message(
18757                &self,
18758            ) -> ::core::result::Result<
18759                super::super::CancelTriggerRequest,
18760                ::buffa::DecodeError,
18761            > {
18762                self.to_owned_from_source(None)
18763            }
18764            #[allow(clippy::useless_conversion, clippy::needless_update)]
18765            fn to_owned_from_source(
18766                &self,
18767                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18768            ) -> ::core::result::Result<
18769                super::super::CancelTriggerRequest,
18770                ::buffa::DecodeError,
18771            > {
18772                #[allow(unused_imports)]
18773                use ::buffa::alloc::string::ToString as _;
18774                let _ = __buffa_src;
18775                ::core::result::Result::Ok(super::super::CancelTriggerRequest {
18776                    trigger_id: self.trigger_id,
18777                    subaccount_id: self.subaccount_id,
18778                    __buffa_unknown_fields: self
18779                        .__buffa_unknown_fields
18780                        .to_owned()?
18781                        .into(),
18782                    ..::core::default::Default::default()
18783                })
18784            }
18785        }
18786        impl<'a> ::buffa::ViewEncode<'a> for CancelTriggerRequestView<'a> {
18787            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18788            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
18789                #[allow(unused_imports)]
18790                use ::buffa::Enumeration as _;
18791                let mut size = 0u32;
18792                if self.trigger_id != 0u64 {
18793                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18794                }
18795                if self.subaccount_id.is_some() {
18796                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18797                }
18798                size += self.__buffa_unknown_fields.encoded_len() as u32;
18799                size
18800            }
18801            #[allow(clippy::needless_borrow)]
18802            fn write_to(
18803                &self,
18804                _cache: &mut ::buffa::SizeCache,
18805                buf: &mut impl ::buffa::bytes::BufMut,
18806            ) {
18807                #[allow(unused_imports)]
18808                use ::buffa::Enumeration as _;
18809                if self.trigger_id != 0u64 {
18810                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
18811                }
18812                if let Some(v) = self.subaccount_id {
18813                    ::buffa::types::put_fixed64_field(2u32, v, buf);
18814                }
18815                self.__buffa_unknown_fields.write_to(buf);
18816            }
18817        }
18818        /// Serializes this view as protobuf JSON.
18819        ///
18820        /// Implicit-presence fields with default values are omitted, `required`
18821        /// fields are always emitted, explicit-presence (`optional`) fields are
18822        /// emitted only when set, bytes fields are base64-encoded, and enum
18823        /// values are their proto name strings.
18824        ///
18825        /// This impl uses `serialize_map(None)` because the number of emitted
18826        /// fields depends on default-omission rules; serializers that require
18827        /// known map lengths (e.g. `bincode`) will return a runtime error.
18828        /// Use the owned message type for those formats.
18829        impl<'__a> ::serde::Serialize for CancelTriggerRequestView<'__a> {
18830            fn serialize<__S: ::serde::Serializer>(
18831                &self,
18832                __s: __S,
18833            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18834                use ::serde::ser::SerializeMap as _;
18835                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18836                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
18837                    __map
18838                        .serialize_entry(
18839                            "triggerId",
18840                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
18841                        )?;
18842                }
18843                if let ::core::option::Option::Some(__v) = self.subaccount_id {
18844                    __map
18845                        .serialize_entry(
18846                            "subaccountId",
18847                            &::buffa::json_helpers::ProtoJson(&__v),
18848                        )?;
18849                }
18850                __map.end()
18851            }
18852        }
18853        impl<'a> ::buffa::MessageName for CancelTriggerRequestView<'a> {
18854            const PACKAGE: &'static str = "triggers.v1";
18855            const NAME: &'static str = "CancelTriggerRequest";
18856            const FULL_NAME: &'static str = "triggers.v1.CancelTriggerRequest";
18857            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
18858        }
18859        ::buffa::impl_default_view_instance!(CancelTriggerRequestView);
18860        ::buffa::impl_view_reborrow!(CancelTriggerRequestView);
18861        /** Self-contained, `'static` owned view of a `CancelTriggerRequest` message.
18862
18863 Wraps [`::buffa::OwnedView`]`<`[`CancelTriggerRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
18864
18865 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CancelTriggerRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
18866        #[derive(Clone, Debug)]
18867        pub struct CancelTriggerRequestOwnedView(
18868            ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
18869        );
18870        impl CancelTriggerRequestOwnedView {
18871            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18872            ///
18873            /// The view borrows directly from the buffer's data; the buffer is
18874            /// retained inside the returned handle.
18875            ///
18876            /// # Errors
18877            ///
18878            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18879            /// protobuf data.
18880            pub fn decode(
18881                bytes: ::buffa::bytes::Bytes,
18882            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18883                ::core::result::Result::Ok(
18884                    CancelTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
18885                )
18886            }
18887            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18888            /// max message size).
18889            ///
18890            /// # Errors
18891            ///
18892            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18893            /// exceeds the configured limits.
18894            pub fn decode_with_options(
18895                bytes: ::buffa::bytes::Bytes,
18896                opts: &::buffa::DecodeOptions,
18897            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18898                ::core::result::Result::Ok(
18899                    CancelTriggerRequestOwnedView(
18900                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18901                    ),
18902                )
18903            }
18904            /// Build from an owned message via an encode → decode round-trip.
18905            ///
18906            /// # Errors
18907            ///
18908            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18909            /// somehow invalid (should not happen for well-formed messages).
18910            pub fn from_owned(
18911                msg: &super::super::CancelTriggerRequest,
18912            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18913                ::core::result::Result::Ok(
18914                    CancelTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
18915                )
18916            }
18917            /// Borrow the full [`CancelTriggerRequestView`] with its lifetime tied to `&self`.
18918            #[must_use]
18919            pub fn view(&self) -> &CancelTriggerRequestView<'_> {
18920                self.0.reborrow()
18921            }
18922            /// Convert to the owned message type.
18923            ///
18924            /// # Errors
18925            ///
18926            /// Returns an error if re-materializing preserved unknown fields
18927            /// fails (e.g. the unknown-field limit is exceeded).
18928            pub fn to_owned_message(
18929                &self,
18930            ) -> ::core::result::Result<
18931                super::super::CancelTriggerRequest,
18932                ::buffa::DecodeError,
18933            > {
18934                self.0.to_owned_message()
18935            }
18936            /// The underlying bytes buffer.
18937            #[must_use]
18938            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18939                self.0.bytes()
18940            }
18941            /// Consume the handle, returning the underlying bytes buffer.
18942            #[must_use]
18943            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18944                self.0.into_bytes()
18945            }
18946            /// Trigger ID to cancel.
18947            ///
18948            /// Field 1: `trigger_id`
18949            #[must_use]
18950            pub fn trigger_id(&self) -> u64 {
18951                self.0.reborrow().trigger_id
18952            }
18953            /// Optional sub-account for authorization.
18954            ///
18955            /// Field 2: `subaccount_id`
18956            #[must_use]
18957            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
18958                self.0.reborrow().subaccount_id
18959            }
18960        }
18961        impl ::core::convert::From<::buffa::OwnedView<CancelTriggerRequestView<'static>>>
18962        for CancelTriggerRequestOwnedView {
18963            fn from(
18964                inner: ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
18965            ) -> Self {
18966                CancelTriggerRequestOwnedView(inner)
18967            }
18968        }
18969        impl ::core::convert::From<CancelTriggerRequestOwnedView>
18970        for ::buffa::OwnedView<CancelTriggerRequestView<'static>> {
18971            fn from(wrapper: CancelTriggerRequestOwnedView) -> Self {
18972                wrapper.0
18973            }
18974        }
18975        impl ::core::convert::AsRef<
18976            ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
18977        > for CancelTriggerRequestOwnedView {
18978            fn as_ref(&self) -> &::buffa::OwnedView<CancelTriggerRequestView<'static>> {
18979                &self.0
18980            }
18981        }
18982        impl ::buffa::HasMessageView for super::super::CancelTriggerRequest {
18983            type View<'a> = CancelTriggerRequestView<'a>;
18984            type ViewHandle = CancelTriggerRequestOwnedView;
18985        }
18986        impl ::serde::Serialize for CancelTriggerRequestOwnedView {
18987            fn serialize<__S: ::serde::Serializer>(
18988                &self,
18989                __s: __S,
18990            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18991                ::serde::Serialize::serialize(&self.0, __s)
18992            }
18993        }
18994        /// CancelTriggerResponse returns the final status after cancellation.
18995        #[derive(Clone, Debug, Default)]
18996        pub struct CancelTriggerResponseView<'a> {
18997            /// Trigger ID that was canceled.
18998            ///
18999            /// Field 1: `trigger_id`
19000            pub trigger_id: u64,
19001            /// Final status (should be STATUS_CANCELED).
19002            ///
19003            /// Field 2: `status`
19004            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
19005            /// Server timestamp.
19006            ///
19007            /// Field 3: `ts`
19008            pub ts: ::buffa::MessageFieldView<
19009                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
19010            >,
19011            /// Server timestamp in nanoseconds since epoch (UTC).
19012            ///
19013            /// Field 4: `ts_ns`
19014            pub ts_ns: u64,
19015            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19016        }
19017        impl<'a> ::buffa::MessageView<'a> for CancelTriggerResponseView<'a> {
19018            type Owned = super::super::CancelTriggerResponse;
19019            fn decode_view(
19020                buf: &'a [u8],
19021            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19022                let __limit = ::core::cell::Cell::new(
19023                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19024                );
19025                <Self as ::buffa::MessageView>::decode_view_ctx(
19026                    buf,
19027                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19028                )
19029            }
19030            fn decode_view_with_ctx(
19031                buf: &'a [u8],
19032                ctx: ::buffa::DecodeContext<'_>,
19033            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19034                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19035            }
19036            fn merge_view_field(
19037                &mut self,
19038                tag: ::buffa::encoding::Tag,
19039                cur: &'a [u8],
19040                before_tag: &'a [u8],
19041                ctx: ::buffa::DecodeContext<'_>,
19042            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19043                let _ = ctx;
19044                #[allow(unused_variables)]
19045                let view = self;
19046                let mut cur = cur;
19047                match tag.field_number() {
19048                    1u32 => {
19049                        ::buffa::encoding::check_wire_type(
19050                            tag,
19051                            ::buffa::encoding::WireType::Fixed64,
19052                        )?;
19053                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
19054                    }
19055                    2u32 => {
19056                        ::buffa::encoding::check_wire_type(
19057                            tag,
19058                            ::buffa::encoding::WireType::Varint,
19059                        )?;
19060                        view.status = ::buffa::EnumValue::from(
19061                            ::buffa::types::decode_int32(&mut cur)?,
19062                        );
19063                    }
19064                    3u32 => {
19065                        ::buffa::encoding::check_wire_type(
19066                            tag,
19067                            ::buffa::encoding::WireType::LengthDelimited,
19068                        )?;
19069                        let __sub_ctx = ctx.descend()?;
19070                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
19071                        match view.ts.as_mut() {
19072                            Some(existing) => {
19073                                ::buffa::MessageView::merge_into_view(
19074                                    existing,
19075                                    sub,
19076                                    __sub_ctx,
19077                                )?
19078                            }
19079                            None => {
19080                                view.ts = ::buffa::MessageFieldView::set(
19081                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
19082                                        sub,
19083                                        __sub_ctx,
19084                                    )?,
19085                                );
19086                            }
19087                        }
19088                    }
19089                    4u32 => {
19090                        ::buffa::encoding::check_wire_type(
19091                            tag,
19092                            ::buffa::encoding::WireType::Varint,
19093                        )?;
19094                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
19095                    }
19096                    _ => {
19097                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19098                        let span_len = before_tag.len() - cur.len();
19099                        view.__buffa_unknown_fields
19100                            .push_record(before_tag, span_len, ctx)?;
19101                    }
19102                }
19103                ::core::result::Result::Ok(cur)
19104            }
19105            fn to_owned_message(
19106                &self,
19107            ) -> ::core::result::Result<
19108                super::super::CancelTriggerResponse,
19109                ::buffa::DecodeError,
19110            > {
19111                self.to_owned_from_source(None)
19112            }
19113            #[allow(clippy::useless_conversion, clippy::needless_update)]
19114            fn to_owned_from_source(
19115                &self,
19116                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19117            ) -> ::core::result::Result<
19118                super::super::CancelTriggerResponse,
19119                ::buffa::DecodeError,
19120            > {
19121                #[allow(unused_imports)]
19122                use ::buffa::alloc::string::ToString as _;
19123                let _ = __buffa_src;
19124                ::core::result::Result::Ok(super::super::CancelTriggerResponse {
19125                    trigger_id: self.trigger_id,
19126                    status: self.status,
19127                    ts: match self.ts.as_option() {
19128                        Some(v) => {
19129                            ::buffa::MessageField::<
19130                                ::buffa_types::google::protobuf::Timestamp,
19131                            >::some(v.to_owned_from_source(__buffa_src)?)
19132                        }
19133                        None => ::buffa::MessageField::none(),
19134                    },
19135                    ts_ns: self.ts_ns,
19136                    __buffa_unknown_fields: self
19137                        .__buffa_unknown_fields
19138                        .to_owned()?
19139                        .into(),
19140                    ..::core::default::Default::default()
19141                })
19142            }
19143        }
19144        impl<'a> ::buffa::ViewEncode<'a> for CancelTriggerResponseView<'a> {
19145            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19146            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
19147                #[allow(unused_imports)]
19148                use ::buffa::Enumeration as _;
19149                let mut size = 0u32;
19150                if self.trigger_id != 0u64 {
19151                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19152                }
19153                {
19154                    let val = self.status.to_i32();
19155                    if val != 0 {
19156                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
19157                    }
19158                }
19159                if self.ts.is_set() {
19160                    let __slot = __cache.reserve();
19161                    let inner_size = self.ts.compute_size(__cache);
19162                    __cache.set(__slot, inner_size);
19163                    size
19164                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19165                            + inner_size;
19166                }
19167                if self.ts_ns != 0u64 {
19168                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
19169                }
19170                size += self.__buffa_unknown_fields.encoded_len() as u32;
19171                size
19172            }
19173            #[allow(clippy::needless_borrow)]
19174            fn write_to(
19175                &self,
19176                __cache: &mut ::buffa::SizeCache,
19177                buf: &mut impl ::buffa::bytes::BufMut,
19178            ) {
19179                #[allow(unused_imports)]
19180                use ::buffa::Enumeration as _;
19181                if self.trigger_id != 0u64 {
19182                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
19183                }
19184                {
19185                    let val = self.status.to_i32();
19186                    if val != 0 {
19187                        ::buffa::types::put_int32_field(2u32, val, buf);
19188                    }
19189                }
19190                if self.ts.is_set() {
19191                    ::buffa::types::put_len_delimited_header(
19192                        3u32,
19193                        __cache.consume_next(),
19194                        buf,
19195                    );
19196                    self.ts.write_to(__cache, buf);
19197                }
19198                if self.ts_ns != 0u64 {
19199                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
19200                }
19201                self.__buffa_unknown_fields.write_to(buf);
19202            }
19203        }
19204        /// Serializes this view as protobuf JSON.
19205        ///
19206        /// Implicit-presence fields with default values are omitted, `required`
19207        /// fields are always emitted, explicit-presence (`optional`) fields are
19208        /// emitted only when set, bytes fields are base64-encoded, and enum
19209        /// values are their proto name strings.
19210        ///
19211        /// This impl uses `serialize_map(None)` because the number of emitted
19212        /// fields depends on default-omission rules; serializers that require
19213        /// known map lengths (e.g. `bincode`) will return a runtime error.
19214        /// Use the owned message type for those formats.
19215        impl<'__a> ::serde::Serialize for CancelTriggerResponseView<'__a> {
19216            fn serialize<__S: ::serde::Serializer>(
19217                &self,
19218                __s: __S,
19219            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19220                use ::serde::ser::SerializeMap as _;
19221                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19222                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
19223                    __map
19224                        .serialize_entry(
19225                            "triggerId",
19226                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
19227                        )?;
19228                }
19229                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
19230                    __map.serialize_entry("status", &self.status)?;
19231                }
19232                {
19233                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
19234                        __map.serialize_entry("ts", __v)?;
19235                    }
19236                }
19237                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
19238                    __map
19239                        .serialize_entry(
19240                            "tsNs",
19241                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
19242                        )?;
19243                }
19244                __map.end()
19245            }
19246        }
19247        impl<'a> ::buffa::MessageName for CancelTriggerResponseView<'a> {
19248            const PACKAGE: &'static str = "triggers.v1";
19249            const NAME: &'static str = "CancelTriggerResponse";
19250            const FULL_NAME: &'static str = "triggers.v1.CancelTriggerResponse";
19251            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
19252        }
19253        ::buffa::impl_default_view_instance!(CancelTriggerResponseView);
19254        ::buffa::impl_view_reborrow!(CancelTriggerResponseView);
19255        /** Self-contained, `'static` owned view of a `CancelTriggerResponse` message.
19256
19257 Wraps [`::buffa::OwnedView`]`<`[`CancelTriggerResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
19258
19259 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CancelTriggerResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
19260        #[derive(Clone, Debug)]
19261        pub struct CancelTriggerResponseOwnedView(
19262            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19263        );
19264        impl CancelTriggerResponseOwnedView {
19265            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19266            ///
19267            /// The view borrows directly from the buffer's data; the buffer is
19268            /// retained inside the returned handle.
19269            ///
19270            /// # Errors
19271            ///
19272            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19273            /// protobuf data.
19274            pub fn decode(
19275                bytes: ::buffa::bytes::Bytes,
19276            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19277                ::core::result::Result::Ok(
19278                    CancelTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
19279                )
19280            }
19281            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19282            /// max message size).
19283            ///
19284            /// # Errors
19285            ///
19286            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19287            /// exceeds the configured limits.
19288            pub fn decode_with_options(
19289                bytes: ::buffa::bytes::Bytes,
19290                opts: &::buffa::DecodeOptions,
19291            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19292                ::core::result::Result::Ok(
19293                    CancelTriggerResponseOwnedView(
19294                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19295                    ),
19296                )
19297            }
19298            /// Build from an owned message via an encode → decode round-trip.
19299            ///
19300            /// # Errors
19301            ///
19302            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19303            /// somehow invalid (should not happen for well-formed messages).
19304            pub fn from_owned(
19305                msg: &super::super::CancelTriggerResponse,
19306            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19307                ::core::result::Result::Ok(
19308                    CancelTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
19309                )
19310            }
19311            /// Borrow the full [`CancelTriggerResponseView`] with its lifetime tied to `&self`.
19312            #[must_use]
19313            pub fn view(&self) -> &CancelTriggerResponseView<'_> {
19314                self.0.reborrow()
19315            }
19316            /// Convert to the owned message type.
19317            ///
19318            /// # Errors
19319            ///
19320            /// Returns an error if re-materializing preserved unknown fields
19321            /// fails (e.g. the unknown-field limit is exceeded).
19322            pub fn to_owned_message(
19323                &self,
19324            ) -> ::core::result::Result<
19325                super::super::CancelTriggerResponse,
19326                ::buffa::DecodeError,
19327            > {
19328                self.0.to_owned_message()
19329            }
19330            /// The underlying bytes buffer.
19331            #[must_use]
19332            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19333                self.0.bytes()
19334            }
19335            /// Consume the handle, returning the underlying bytes buffer.
19336            #[must_use]
19337            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19338                self.0.into_bytes()
19339            }
19340            /// Trigger ID that was canceled.
19341            ///
19342            /// Field 1: `trigger_id`
19343            #[must_use]
19344            pub fn trigger_id(&self) -> u64 {
19345                self.0.reborrow().trigger_id
19346            }
19347            /// Final status (should be STATUS_CANCELED).
19348            ///
19349            /// Field 2: `status`
19350            #[must_use]
19351            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
19352                self.0.reborrow().status
19353            }
19354            /// Server timestamp.
19355            ///
19356            /// Field 3: `ts`
19357            #[must_use]
19358            pub fn ts(
19359                &self,
19360            ) -> &::buffa::MessageFieldView<
19361                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
19362            > {
19363                &self.0.reborrow().ts
19364            }
19365            /// Server timestamp in nanoseconds since epoch (UTC).
19366            ///
19367            /// Field 4: `ts_ns`
19368            #[must_use]
19369            pub fn ts_ns(&self) -> u64 {
19370                self.0.reborrow().ts_ns
19371            }
19372        }
19373        impl ::core::convert::From<
19374            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19375        > for CancelTriggerResponseOwnedView {
19376            fn from(
19377                inner: ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19378            ) -> Self {
19379                CancelTriggerResponseOwnedView(inner)
19380            }
19381        }
19382        impl ::core::convert::From<CancelTriggerResponseOwnedView>
19383        for ::buffa::OwnedView<CancelTriggerResponseView<'static>> {
19384            fn from(wrapper: CancelTriggerResponseOwnedView) -> Self {
19385                wrapper.0
19386            }
19387        }
19388        impl ::core::convert::AsRef<
19389            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19390        > for CancelTriggerResponseOwnedView {
19391            fn as_ref(&self) -> &::buffa::OwnedView<CancelTriggerResponseView<'static>> {
19392                &self.0
19393            }
19394        }
19395        impl ::buffa::HasMessageView for super::super::CancelTriggerResponse {
19396            type View<'a> = CancelTriggerResponseView<'a>;
19397            type ViewHandle = CancelTriggerResponseOwnedView;
19398        }
19399        impl ::serde::Serialize for CancelTriggerResponseOwnedView {
19400            fn serialize<__S: ::serde::Serializer>(
19401                &self,
19402                __s: __S,
19403            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19404                ::serde::Serialize::serialize(&self.0, __s)
19405            }
19406        }
19407        /// =============================================================================
19408        /// Modify / Pause / Resume Trigger
19409        /// =============================================================================
19410        ///
19411        /// ModifyTriggerRequest applies a limited patch to an existing trigger.
19412        #[derive(Clone, Debug, Default)]
19413        pub struct ModifyTriggerRequestView<'a> {
19414            /// Trigger ID to modify.
19415            ///
19416            /// Field 1: `trigger_id`
19417            pub trigger_id: u64,
19418            /// Optional sub-account for authorization.
19419            ///
19420            /// Field 2: `subaccount_id`
19421            pub subaccount_id: ::core::option::Option<u64>,
19422            /// Patch fields for safe price, trailing-distance, and slippage edits.
19423            /// For stop/take-profit:
19424            /// Updated trigger price in quote units scaled by 1e6.
19425            ///
19426            /// Field 10: `trigger_price_ticks`
19427            pub trigger_price_ticks: ::core::option::Option<i64>,
19428            /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
19429            ///
19430            /// Field 11: `limit_price_ticks`
19431            pub limit_price_ticks: ::core::option::Option<i64>,
19432            /// Updated activation price in quote units scaled by 1e6.
19433            ///
19434            /// Field 14: `activation_price_ticks`
19435            pub activation_price_ticks: ::core::option::Option<i64>,
19436            pub trailing_distance: ::core::option::Option<
19437                super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance,
19438            >,
19439            pub max_slippage: ::core::option::Option<
19440                super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage,
19441            >,
19442            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19443        }
19444        impl<'a> ::buffa::MessageView<'a> for ModifyTriggerRequestView<'a> {
19445            type Owned = super::super::ModifyTriggerRequest;
19446            fn decode_view(
19447                buf: &'a [u8],
19448            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19449                let __limit = ::core::cell::Cell::new(
19450                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19451                );
19452                <Self as ::buffa::MessageView>::decode_view_ctx(
19453                    buf,
19454                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19455                )
19456            }
19457            fn decode_view_with_ctx(
19458                buf: &'a [u8],
19459                ctx: ::buffa::DecodeContext<'_>,
19460            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19461                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19462            }
19463            fn merge_view_field(
19464                &mut self,
19465                tag: ::buffa::encoding::Tag,
19466                cur: &'a [u8],
19467                before_tag: &'a [u8],
19468                ctx: ::buffa::DecodeContext<'_>,
19469            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19470                let _ = ctx;
19471                #[allow(unused_variables)]
19472                let view = self;
19473                let mut cur = cur;
19474                match tag.field_number() {
19475                    1u32 => {
19476                        ::buffa::encoding::check_wire_type(
19477                            tag,
19478                            ::buffa::encoding::WireType::Fixed64,
19479                        )?;
19480                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
19481                    }
19482                    2u32 => {
19483                        ::buffa::encoding::check_wire_type(
19484                            tag,
19485                            ::buffa::encoding::WireType::Fixed64,
19486                        )?;
19487                        view.subaccount_id = Some(
19488                            ::buffa::types::decode_fixed64(&mut cur)?,
19489                        );
19490                    }
19491                    10u32 => {
19492                        ::buffa::encoding::check_wire_type(
19493                            tag,
19494                            ::buffa::encoding::WireType::Varint,
19495                        )?;
19496                        view.trigger_price_ticks = Some(
19497                            ::buffa::types::decode_int64(&mut cur)?,
19498                        );
19499                    }
19500                    11u32 => {
19501                        ::buffa::encoding::check_wire_type(
19502                            tag,
19503                            ::buffa::encoding::WireType::Varint,
19504                        )?;
19505                        view.limit_price_ticks = Some(
19506                            ::buffa::types::decode_int64(&mut cur)?,
19507                        );
19508                    }
19509                    14u32 => {
19510                        ::buffa::encoding::check_wire_type(
19511                            tag,
19512                            ::buffa::encoding::WireType::Varint,
19513                        )?;
19514                        view.activation_price_ticks = Some(
19515                            ::buffa::types::decode_int64(&mut cur)?,
19516                        );
19517                    }
19518                    12u32 => {
19519                        ::buffa::encoding::check_wire_type(
19520                            tag,
19521                            ::buffa::encoding::WireType::Varint,
19522                        )?;
19523                        view.trailing_distance = Some(
19524                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19525                                ::buffa::types::decode_int64(&mut cur)?,
19526                            ),
19527                        );
19528                    }
19529                    13u32 => {
19530                        ::buffa::encoding::check_wire_type(
19531                            tag,
19532                            ::buffa::encoding::WireType::Varint,
19533                        )?;
19534                        view.trailing_distance = Some(
19535                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19536                                ::buffa::types::decode_int32(&mut cur)?,
19537                            ),
19538                        );
19539                    }
19540                    15u32 => {
19541                        ::buffa::encoding::check_wire_type(
19542                            tag,
19543                            ::buffa::encoding::WireType::Varint,
19544                        )?;
19545                        view.max_slippage = Some(
19546                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19547                                ::buffa::types::decode_int32(&mut cur)?,
19548                            ),
19549                        );
19550                    }
19551                    16u32 => {
19552                        ::buffa::encoding::check_wire_type(
19553                            tag,
19554                            ::buffa::encoding::WireType::Varint,
19555                        )?;
19556                        view.max_slippage = Some(
19557                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19558                                ::buffa::types::decode_int32(&mut cur)?,
19559                            ),
19560                        );
19561                    }
19562                    _ => {
19563                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19564                        let span_len = before_tag.len() - cur.len();
19565                        view.__buffa_unknown_fields
19566                            .push_record(before_tag, span_len, ctx)?;
19567                    }
19568                }
19569                ::core::result::Result::Ok(cur)
19570            }
19571            fn to_owned_message(
19572                &self,
19573            ) -> ::core::result::Result<
19574                super::super::ModifyTriggerRequest,
19575                ::buffa::DecodeError,
19576            > {
19577                self.to_owned_from_source(None)
19578            }
19579            #[allow(clippy::useless_conversion, clippy::needless_update)]
19580            fn to_owned_from_source(
19581                &self,
19582                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19583            ) -> ::core::result::Result<
19584                super::super::ModifyTriggerRequest,
19585                ::buffa::DecodeError,
19586            > {
19587                #[allow(unused_imports)]
19588                use ::buffa::alloc::string::ToString as _;
19589                let _ = __buffa_src;
19590                ::core::result::Result::Ok(super::super::ModifyTriggerRequest {
19591                    trigger_id: self.trigger_id,
19592                    subaccount_id: self.subaccount_id,
19593                    trigger_price_ticks: self.trigger_price_ticks,
19594                    limit_price_ticks: self.limit_price_ticks,
19595                    activation_price_ticks: self.activation_price_ticks,
19596                    trailing_distance: self
19597                        .trailing_distance
19598                        .as_ref()
19599                        .map(|v| match v {
19600                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19601                                v,
19602                            ) => {
19603                                super::super::__buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19604                                    *v,
19605                                )
19606                            }
19607                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19608                                v,
19609                            ) => {
19610                                super::super::__buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19611                                    *v,
19612                                )
19613                            }
19614                        }),
19615                    max_slippage: self
19616                        .max_slippage
19617                        .as_ref()
19618                        .map(|v| match v {
19619                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19620                                v,
19621                            ) => {
19622                                super::super::__buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19623                                    *v,
19624                                )
19625                            }
19626                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19627                                v,
19628                            ) => {
19629                                super::super::__buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19630                                    *v,
19631                                )
19632                            }
19633                        }),
19634                    __buffa_unknown_fields: self
19635                        .__buffa_unknown_fields
19636                        .to_owned()?
19637                        .into(),
19638                    ..::core::default::Default::default()
19639                })
19640            }
19641        }
19642        impl<'a> ::buffa::ViewEncode<'a> for ModifyTriggerRequestView<'a> {
19643            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19644            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
19645                #[allow(unused_imports)]
19646                use ::buffa::Enumeration as _;
19647                let mut size = 0u32;
19648                if self.trigger_id != 0u64 {
19649                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19650                }
19651                if self.subaccount_id.is_some() {
19652                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19653                }
19654                if let Some(v) = self.trigger_price_ticks {
19655                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19656                }
19657                if let Some(v) = self.limit_price_ticks {
19658                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19659                }
19660                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
19661                    match v {
19662                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19663                            v,
19664                        ) => {
19665                            size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
19666                        }
19667                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19668                            v,
19669                        ) => {
19670                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19671                        }
19672                    }
19673                }
19674                if let Some(v) = self.activation_price_ticks {
19675                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19676                }
19677                if let ::core::option::Option::Some(ref v) = self.max_slippage {
19678                    match v {
19679                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19680                            v,
19681                        ) => {
19682                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19683                        }
19684                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19685                            v,
19686                        ) => {
19687                            size += 2u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19688                        }
19689                    }
19690                }
19691                size += self.__buffa_unknown_fields.encoded_len() as u32;
19692                size
19693            }
19694            #[allow(clippy::needless_borrow)]
19695            fn write_to(
19696                &self,
19697                _cache: &mut ::buffa::SizeCache,
19698                buf: &mut impl ::buffa::bytes::BufMut,
19699            ) {
19700                #[allow(unused_imports)]
19701                use ::buffa::Enumeration as _;
19702                if self.trigger_id != 0u64 {
19703                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
19704                }
19705                if let Some(v) = self.subaccount_id {
19706                    ::buffa::types::put_fixed64_field(2u32, v, buf);
19707                }
19708                if let Some(v) = self.trigger_price_ticks {
19709                    ::buffa::types::put_int64_field(10u32, v, buf);
19710                }
19711                if let Some(v) = self.limit_price_ticks {
19712                    ::buffa::types::put_int64_field(11u32, v, buf);
19713                }
19714                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
19715                    match v {
19716                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19717                            x,
19718                        ) => {
19719                            ::buffa::types::put_int64_field(12u32, *x, buf);
19720                        }
19721                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19722                            x,
19723                        ) => {
19724                            ::buffa::types::put_int32_field(13u32, *x, buf);
19725                        }
19726                    }
19727                }
19728                if let Some(v) = self.activation_price_ticks {
19729                    ::buffa::types::put_int64_field(14u32, v, buf);
19730                }
19731                if let ::core::option::Option::Some(ref v) = self.max_slippage {
19732                    match v {
19733                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19734                            x,
19735                        ) => {
19736                            ::buffa::types::put_int32_field(15u32, *x, buf);
19737                        }
19738                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19739                            x,
19740                        ) => {
19741                            ::buffa::types::put_int32_field(16u32, *x, buf);
19742                        }
19743                    }
19744                }
19745                self.__buffa_unknown_fields.write_to(buf);
19746            }
19747        }
19748        /// Serializes this view as protobuf JSON.
19749        ///
19750        /// Implicit-presence fields with default values are omitted, `required`
19751        /// fields are always emitted, explicit-presence (`optional`) fields are
19752        /// emitted only when set, bytes fields are base64-encoded, and enum
19753        /// values are their proto name strings.
19754        ///
19755        /// This impl uses `serialize_map(None)` because the number of emitted
19756        /// fields depends on default-omission rules; serializers that require
19757        /// known map lengths (e.g. `bincode`) will return a runtime error.
19758        /// Use the owned message type for those formats.
19759        impl<'__a> ::serde::Serialize for ModifyTriggerRequestView<'__a> {
19760            fn serialize<__S: ::serde::Serializer>(
19761                &self,
19762                __s: __S,
19763            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19764                use ::serde::ser::SerializeMap as _;
19765                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19766                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
19767                    __map
19768                        .serialize_entry(
19769                            "triggerId",
19770                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
19771                        )?;
19772                }
19773                if let ::core::option::Option::Some(__v) = self.subaccount_id {
19774                    __map
19775                        .serialize_entry(
19776                            "subaccountId",
19777                            &::buffa::json_helpers::ProtoJson(&__v),
19778                        )?;
19779                }
19780                if let ::core::option::Option::Some(__v) = self.trigger_price_ticks {
19781                    __map
19782                        .serialize_entry(
19783                            "triggerPriceTicks",
19784                            &::buffa::json_helpers::ProtoJson(&__v),
19785                        )?;
19786                }
19787                if let ::core::option::Option::Some(__v) = self.limit_price_ticks {
19788                    __map
19789                        .serialize_entry(
19790                            "limitPriceTicks",
19791                            &::buffa::json_helpers::ProtoJson(&__v),
19792                        )?;
19793                }
19794                if let ::core::option::Option::Some(__v) = self.activation_price_ticks {
19795                    __map
19796                        .serialize_entry(
19797                            "activationPriceTicks",
19798                            &::buffa::json_helpers::ProtoJson(&__v),
19799                        )?;
19800                }
19801                if let ::core::option::Option::Some(ref __ov) = self.trailing_distance {
19802                    match __ov {
19803                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19804                            v,
19805                        ) => {
19806                            __map
19807                                .serialize_entry(
19808                                    "trailingDistanceTicks",
19809                                    &::buffa::json_helpers::ProtoJson(v),
19810                                )?;
19811                        }
19812                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19813                            v,
19814                        ) => {
19815                            __map
19816                                .serialize_entry(
19817                                    "trailingDistanceBps",
19818                                    &::buffa::json_helpers::ProtoJson(v),
19819                                )?;
19820                        }
19821                    }
19822                }
19823                if let ::core::option::Option::Some(ref __ov) = self.max_slippage {
19824                    match __ov {
19825                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19826                            v,
19827                        ) => {
19828                            __map
19829                                .serialize_entry(
19830                                    "maxSlippageTicks",
19831                                    &::buffa::json_helpers::ProtoJson(v),
19832                                )?;
19833                        }
19834                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19835                            v,
19836                        ) => {
19837                            __map
19838                                .serialize_entry(
19839                                    "maxSlippageBps",
19840                                    &::buffa::json_helpers::ProtoJson(v),
19841                                )?;
19842                        }
19843                    }
19844                }
19845                __map.end()
19846            }
19847        }
19848        impl<'a> ::buffa::MessageName for ModifyTriggerRequestView<'a> {
19849            const PACKAGE: &'static str = "triggers.v1";
19850            const NAME: &'static str = "ModifyTriggerRequest";
19851            const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerRequest";
19852            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
19853        }
19854        ::buffa::impl_default_view_instance!(ModifyTriggerRequestView);
19855        ::buffa::impl_view_reborrow!(ModifyTriggerRequestView);
19856        /** Self-contained, `'static` owned view of a `ModifyTriggerRequest` message.
19857
19858 Wraps [`::buffa::OwnedView`]`<`[`ModifyTriggerRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
19859
19860 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ModifyTriggerRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
19861        #[derive(Clone, Debug)]
19862        pub struct ModifyTriggerRequestOwnedView(
19863            ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
19864        );
19865        impl ModifyTriggerRequestOwnedView {
19866            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19867            ///
19868            /// The view borrows directly from the buffer's data; the buffer is
19869            /// retained inside the returned handle.
19870            ///
19871            /// # Errors
19872            ///
19873            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19874            /// protobuf data.
19875            pub fn decode(
19876                bytes: ::buffa::bytes::Bytes,
19877            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19878                ::core::result::Result::Ok(
19879                    ModifyTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
19880                )
19881            }
19882            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19883            /// max message size).
19884            ///
19885            /// # Errors
19886            ///
19887            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19888            /// exceeds the configured limits.
19889            pub fn decode_with_options(
19890                bytes: ::buffa::bytes::Bytes,
19891                opts: &::buffa::DecodeOptions,
19892            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19893                ::core::result::Result::Ok(
19894                    ModifyTriggerRequestOwnedView(
19895                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19896                    ),
19897                )
19898            }
19899            /// Build from an owned message via an encode → decode round-trip.
19900            ///
19901            /// # Errors
19902            ///
19903            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19904            /// somehow invalid (should not happen for well-formed messages).
19905            pub fn from_owned(
19906                msg: &super::super::ModifyTriggerRequest,
19907            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19908                ::core::result::Result::Ok(
19909                    ModifyTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
19910                )
19911            }
19912            /// Borrow the full [`ModifyTriggerRequestView`] with its lifetime tied to `&self`.
19913            #[must_use]
19914            pub fn view(&self) -> &ModifyTriggerRequestView<'_> {
19915                self.0.reborrow()
19916            }
19917            /// Convert to the owned message type.
19918            ///
19919            /// # Errors
19920            ///
19921            /// Returns an error if re-materializing preserved unknown fields
19922            /// fails (e.g. the unknown-field limit is exceeded).
19923            pub fn to_owned_message(
19924                &self,
19925            ) -> ::core::result::Result<
19926                super::super::ModifyTriggerRequest,
19927                ::buffa::DecodeError,
19928            > {
19929                self.0.to_owned_message()
19930            }
19931            /// The underlying bytes buffer.
19932            #[must_use]
19933            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19934                self.0.bytes()
19935            }
19936            /// Consume the handle, returning the underlying bytes buffer.
19937            #[must_use]
19938            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19939                self.0.into_bytes()
19940            }
19941            /// Trigger ID to modify.
19942            ///
19943            /// Field 1: `trigger_id`
19944            #[must_use]
19945            pub fn trigger_id(&self) -> u64 {
19946                self.0.reborrow().trigger_id
19947            }
19948            /// Optional sub-account for authorization.
19949            ///
19950            /// Field 2: `subaccount_id`
19951            #[must_use]
19952            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
19953                self.0.reborrow().subaccount_id
19954            }
19955            /// Patch fields for safe price, trailing-distance, and slippage edits.
19956            /// For stop/take-profit:
19957            /// Updated trigger price in quote units scaled by 1e6.
19958            ///
19959            /// Field 10: `trigger_price_ticks`
19960            #[must_use]
19961            pub fn trigger_price_ticks(&self) -> ::core::option::Option<i64> {
19962                self.0.reborrow().trigger_price_ticks
19963            }
19964            /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
19965            ///
19966            /// Field 11: `limit_price_ticks`
19967            #[must_use]
19968            pub fn limit_price_ticks(&self) -> ::core::option::Option<i64> {
19969                self.0.reborrow().limit_price_ticks
19970            }
19971            /// Updated activation price in quote units scaled by 1e6.
19972            ///
19973            /// Field 14: `activation_price_ticks`
19974            #[must_use]
19975            pub fn activation_price_ticks(&self) -> ::core::option::Option<i64> {
19976                self.0.reborrow().activation_price_ticks
19977            }
19978            /// Oneof `trailing_distance`.
19979            #[must_use]
19980            pub fn trailing_distance(
19981                &self,
19982            ) -> ::core::option::Option<
19983                &super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance,
19984            > {
19985                self.0.reborrow().trailing_distance.as_ref()
19986            }
19987            /// Oneof `max_slippage`.
19988            #[must_use]
19989            pub fn max_slippage(
19990                &self,
19991            ) -> ::core::option::Option<
19992                &super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage,
19993            > {
19994                self.0.reborrow().max_slippage.as_ref()
19995            }
19996        }
19997        impl ::core::convert::From<::buffa::OwnedView<ModifyTriggerRequestView<'static>>>
19998        for ModifyTriggerRequestOwnedView {
19999            fn from(
20000                inner: ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
20001            ) -> Self {
20002                ModifyTriggerRequestOwnedView(inner)
20003            }
20004        }
20005        impl ::core::convert::From<ModifyTriggerRequestOwnedView>
20006        for ::buffa::OwnedView<ModifyTriggerRequestView<'static>> {
20007            fn from(wrapper: ModifyTriggerRequestOwnedView) -> Self {
20008                wrapper.0
20009            }
20010        }
20011        impl ::core::convert::AsRef<
20012            ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
20013        > for ModifyTriggerRequestOwnedView {
20014            fn as_ref(&self) -> &::buffa::OwnedView<ModifyTriggerRequestView<'static>> {
20015                &self.0
20016            }
20017        }
20018        impl ::buffa::HasMessageView for super::super::ModifyTriggerRequest {
20019            type View<'a> = ModifyTriggerRequestView<'a>;
20020            type ViewHandle = ModifyTriggerRequestOwnedView;
20021        }
20022        impl ::serde::Serialize for ModifyTriggerRequestOwnedView {
20023            fn serialize<__S: ::serde::Serializer>(
20024                &self,
20025                __s: __S,
20026            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20027                ::serde::Serialize::serialize(&self.0, __s)
20028            }
20029        }
20030        /// ModifyTriggerResponse returns the trigger status after modification.
20031        #[derive(Clone, Debug, Default)]
20032        pub struct ModifyTriggerResponseView<'a> {
20033            /// Modified trigger ID.
20034            ///
20035            /// Field 1: `trigger_id`
20036            pub trigger_id: u64,
20037            /// Current trigger status after modification.
20038            ///
20039            /// Field 2: `status`
20040            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
20041            /// Server timestamp.
20042            ///
20043            /// Field 3: `ts`
20044            pub ts: ::buffa::MessageFieldView<
20045                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
20046            >,
20047            /// Server timestamp in nanoseconds since epoch (UTC).
20048            ///
20049            /// Field 4: `ts_ns`
20050            pub ts_ns: u64,
20051            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20052        }
20053        impl<'a> ::buffa::MessageView<'a> for ModifyTriggerResponseView<'a> {
20054            type Owned = super::super::ModifyTriggerResponse;
20055            fn decode_view(
20056                buf: &'a [u8],
20057            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20058                let __limit = ::core::cell::Cell::new(
20059                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20060                );
20061                <Self as ::buffa::MessageView>::decode_view_ctx(
20062                    buf,
20063                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20064                )
20065            }
20066            fn decode_view_with_ctx(
20067                buf: &'a [u8],
20068                ctx: ::buffa::DecodeContext<'_>,
20069            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20070                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20071            }
20072            fn merge_view_field(
20073                &mut self,
20074                tag: ::buffa::encoding::Tag,
20075                cur: &'a [u8],
20076                before_tag: &'a [u8],
20077                ctx: ::buffa::DecodeContext<'_>,
20078            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20079                let _ = ctx;
20080                #[allow(unused_variables)]
20081                let view = self;
20082                let mut cur = cur;
20083                match tag.field_number() {
20084                    1u32 => {
20085                        ::buffa::encoding::check_wire_type(
20086                            tag,
20087                            ::buffa::encoding::WireType::Fixed64,
20088                        )?;
20089                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20090                    }
20091                    2u32 => {
20092                        ::buffa::encoding::check_wire_type(
20093                            tag,
20094                            ::buffa::encoding::WireType::Varint,
20095                        )?;
20096                        view.status = ::buffa::EnumValue::from(
20097                            ::buffa::types::decode_int32(&mut cur)?,
20098                        );
20099                    }
20100                    3u32 => {
20101                        ::buffa::encoding::check_wire_type(
20102                            tag,
20103                            ::buffa::encoding::WireType::LengthDelimited,
20104                        )?;
20105                        let __sub_ctx = ctx.descend()?;
20106                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
20107                        match view.ts.as_mut() {
20108                            Some(existing) => {
20109                                ::buffa::MessageView::merge_into_view(
20110                                    existing,
20111                                    sub,
20112                                    __sub_ctx,
20113                                )?
20114                            }
20115                            None => {
20116                                view.ts = ::buffa::MessageFieldView::set(
20117                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
20118                                        sub,
20119                                        __sub_ctx,
20120                                    )?,
20121                                );
20122                            }
20123                        }
20124                    }
20125                    4u32 => {
20126                        ::buffa::encoding::check_wire_type(
20127                            tag,
20128                            ::buffa::encoding::WireType::Varint,
20129                        )?;
20130                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
20131                    }
20132                    _ => {
20133                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20134                        let span_len = before_tag.len() - cur.len();
20135                        view.__buffa_unknown_fields
20136                            .push_record(before_tag, span_len, ctx)?;
20137                    }
20138                }
20139                ::core::result::Result::Ok(cur)
20140            }
20141            fn to_owned_message(
20142                &self,
20143            ) -> ::core::result::Result<
20144                super::super::ModifyTriggerResponse,
20145                ::buffa::DecodeError,
20146            > {
20147                self.to_owned_from_source(None)
20148            }
20149            #[allow(clippy::useless_conversion, clippy::needless_update)]
20150            fn to_owned_from_source(
20151                &self,
20152                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20153            ) -> ::core::result::Result<
20154                super::super::ModifyTriggerResponse,
20155                ::buffa::DecodeError,
20156            > {
20157                #[allow(unused_imports)]
20158                use ::buffa::alloc::string::ToString as _;
20159                let _ = __buffa_src;
20160                ::core::result::Result::Ok(super::super::ModifyTriggerResponse {
20161                    trigger_id: self.trigger_id,
20162                    status: self.status,
20163                    ts: match self.ts.as_option() {
20164                        Some(v) => {
20165                            ::buffa::MessageField::<
20166                                ::buffa_types::google::protobuf::Timestamp,
20167                            >::some(v.to_owned_from_source(__buffa_src)?)
20168                        }
20169                        None => ::buffa::MessageField::none(),
20170                    },
20171                    ts_ns: self.ts_ns,
20172                    __buffa_unknown_fields: self
20173                        .__buffa_unknown_fields
20174                        .to_owned()?
20175                        .into(),
20176                    ..::core::default::Default::default()
20177                })
20178            }
20179        }
20180        impl<'a> ::buffa::ViewEncode<'a> for ModifyTriggerResponseView<'a> {
20181            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20182            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
20183                #[allow(unused_imports)]
20184                use ::buffa::Enumeration as _;
20185                let mut size = 0u32;
20186                if self.trigger_id != 0u64 {
20187                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20188                }
20189                {
20190                    let val = self.status.to_i32();
20191                    if val != 0 {
20192                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
20193                    }
20194                }
20195                if self.ts.is_set() {
20196                    let __slot = __cache.reserve();
20197                    let inner_size = self.ts.compute_size(__cache);
20198                    __cache.set(__slot, inner_size);
20199                    size
20200                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
20201                            + inner_size;
20202                }
20203                if self.ts_ns != 0u64 {
20204                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
20205                }
20206                size += self.__buffa_unknown_fields.encoded_len() as u32;
20207                size
20208            }
20209            #[allow(clippy::needless_borrow)]
20210            fn write_to(
20211                &self,
20212                __cache: &mut ::buffa::SizeCache,
20213                buf: &mut impl ::buffa::bytes::BufMut,
20214            ) {
20215                #[allow(unused_imports)]
20216                use ::buffa::Enumeration as _;
20217                if self.trigger_id != 0u64 {
20218                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20219                }
20220                {
20221                    let val = self.status.to_i32();
20222                    if val != 0 {
20223                        ::buffa::types::put_int32_field(2u32, val, buf);
20224                    }
20225                }
20226                if self.ts.is_set() {
20227                    ::buffa::types::put_len_delimited_header(
20228                        3u32,
20229                        __cache.consume_next(),
20230                        buf,
20231                    );
20232                    self.ts.write_to(__cache, buf);
20233                }
20234                if self.ts_ns != 0u64 {
20235                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
20236                }
20237                self.__buffa_unknown_fields.write_to(buf);
20238            }
20239        }
20240        /// Serializes this view as protobuf JSON.
20241        ///
20242        /// Implicit-presence fields with default values are omitted, `required`
20243        /// fields are always emitted, explicit-presence (`optional`) fields are
20244        /// emitted only when set, bytes fields are base64-encoded, and enum
20245        /// values are their proto name strings.
20246        ///
20247        /// This impl uses `serialize_map(None)` because the number of emitted
20248        /// fields depends on default-omission rules; serializers that require
20249        /// known map lengths (e.g. `bincode`) will return a runtime error.
20250        /// Use the owned message type for those formats.
20251        impl<'__a> ::serde::Serialize for ModifyTriggerResponseView<'__a> {
20252            fn serialize<__S: ::serde::Serializer>(
20253                &self,
20254                __s: __S,
20255            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20256                use ::serde::ser::SerializeMap as _;
20257                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20258                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20259                    __map
20260                        .serialize_entry(
20261                            "triggerId",
20262                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20263                        )?;
20264                }
20265                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
20266                    __map.serialize_entry("status", &self.status)?;
20267                }
20268                {
20269                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
20270                        __map.serialize_entry("ts", __v)?;
20271                    }
20272                }
20273                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
20274                    __map
20275                        .serialize_entry(
20276                            "tsNs",
20277                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
20278                        )?;
20279                }
20280                __map.end()
20281            }
20282        }
20283        impl<'a> ::buffa::MessageName for ModifyTriggerResponseView<'a> {
20284            const PACKAGE: &'static str = "triggers.v1";
20285            const NAME: &'static str = "ModifyTriggerResponse";
20286            const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerResponse";
20287            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
20288        }
20289        ::buffa::impl_default_view_instance!(ModifyTriggerResponseView);
20290        ::buffa::impl_view_reborrow!(ModifyTriggerResponseView);
20291        /** Self-contained, `'static` owned view of a `ModifyTriggerResponse` message.
20292
20293 Wraps [`::buffa::OwnedView`]`<`[`ModifyTriggerResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
20294
20295 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ModifyTriggerResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
20296        #[derive(Clone, Debug)]
20297        pub struct ModifyTriggerResponseOwnedView(
20298            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20299        );
20300        impl ModifyTriggerResponseOwnedView {
20301            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20302            ///
20303            /// The view borrows directly from the buffer's data; the buffer is
20304            /// retained inside the returned handle.
20305            ///
20306            /// # Errors
20307            ///
20308            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20309            /// protobuf data.
20310            pub fn decode(
20311                bytes: ::buffa::bytes::Bytes,
20312            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20313                ::core::result::Result::Ok(
20314                    ModifyTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
20315                )
20316            }
20317            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20318            /// max message size).
20319            ///
20320            /// # Errors
20321            ///
20322            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20323            /// exceeds the configured limits.
20324            pub fn decode_with_options(
20325                bytes: ::buffa::bytes::Bytes,
20326                opts: &::buffa::DecodeOptions,
20327            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20328                ::core::result::Result::Ok(
20329                    ModifyTriggerResponseOwnedView(
20330                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20331                    ),
20332                )
20333            }
20334            /// Build from an owned message via an encode → decode round-trip.
20335            ///
20336            /// # Errors
20337            ///
20338            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20339            /// somehow invalid (should not happen for well-formed messages).
20340            pub fn from_owned(
20341                msg: &super::super::ModifyTriggerResponse,
20342            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20343                ::core::result::Result::Ok(
20344                    ModifyTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
20345                )
20346            }
20347            /// Borrow the full [`ModifyTriggerResponseView`] with its lifetime tied to `&self`.
20348            #[must_use]
20349            pub fn view(&self) -> &ModifyTriggerResponseView<'_> {
20350                self.0.reborrow()
20351            }
20352            /// Convert to the owned message type.
20353            ///
20354            /// # Errors
20355            ///
20356            /// Returns an error if re-materializing preserved unknown fields
20357            /// fails (e.g. the unknown-field limit is exceeded).
20358            pub fn to_owned_message(
20359                &self,
20360            ) -> ::core::result::Result<
20361                super::super::ModifyTriggerResponse,
20362                ::buffa::DecodeError,
20363            > {
20364                self.0.to_owned_message()
20365            }
20366            /// The underlying bytes buffer.
20367            #[must_use]
20368            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20369                self.0.bytes()
20370            }
20371            /// Consume the handle, returning the underlying bytes buffer.
20372            #[must_use]
20373            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20374                self.0.into_bytes()
20375            }
20376            /// Modified trigger ID.
20377            ///
20378            /// Field 1: `trigger_id`
20379            #[must_use]
20380            pub fn trigger_id(&self) -> u64 {
20381                self.0.reborrow().trigger_id
20382            }
20383            /// Current trigger status after modification.
20384            ///
20385            /// Field 2: `status`
20386            #[must_use]
20387            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
20388                self.0.reborrow().status
20389            }
20390            /// Server timestamp.
20391            ///
20392            /// Field 3: `ts`
20393            #[must_use]
20394            pub fn ts(
20395                &self,
20396            ) -> &::buffa::MessageFieldView<
20397                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
20398            > {
20399                &self.0.reborrow().ts
20400            }
20401            /// Server timestamp in nanoseconds since epoch (UTC).
20402            ///
20403            /// Field 4: `ts_ns`
20404            #[must_use]
20405            pub fn ts_ns(&self) -> u64 {
20406                self.0.reborrow().ts_ns
20407            }
20408        }
20409        impl ::core::convert::From<
20410            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20411        > for ModifyTriggerResponseOwnedView {
20412            fn from(
20413                inner: ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20414            ) -> Self {
20415                ModifyTriggerResponseOwnedView(inner)
20416            }
20417        }
20418        impl ::core::convert::From<ModifyTriggerResponseOwnedView>
20419        for ::buffa::OwnedView<ModifyTriggerResponseView<'static>> {
20420            fn from(wrapper: ModifyTriggerResponseOwnedView) -> Self {
20421                wrapper.0
20422            }
20423        }
20424        impl ::core::convert::AsRef<
20425            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20426        > for ModifyTriggerResponseOwnedView {
20427            fn as_ref(&self) -> &::buffa::OwnedView<ModifyTriggerResponseView<'static>> {
20428                &self.0
20429            }
20430        }
20431        impl ::buffa::HasMessageView for super::super::ModifyTriggerResponse {
20432            type View<'a> = ModifyTriggerResponseView<'a>;
20433            type ViewHandle = ModifyTriggerResponseOwnedView;
20434        }
20435        impl ::serde::Serialize for ModifyTriggerResponseOwnedView {
20436            fn serialize<__S: ::serde::Serializer>(
20437                &self,
20438                __s: __S,
20439            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20440                ::serde::Serialize::serialize(&self.0, __s)
20441            }
20442        }
20443        /// PauseTriggerRequest pauses an active trigger by ID.
20444        #[derive(Clone, Debug, Default)]
20445        pub struct PauseTriggerRequestView<'a> {
20446            /// Trigger ID to pause.
20447            ///
20448            /// Field 1: `trigger_id`
20449            pub trigger_id: u64,
20450            /// Optional sub-account for authorization.
20451            ///
20452            /// Field 2: `subaccount_id`
20453            pub subaccount_id: ::core::option::Option<u64>,
20454            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20455        }
20456        impl<'a> ::buffa::MessageView<'a> for PauseTriggerRequestView<'a> {
20457            type Owned = super::super::PauseTriggerRequest;
20458            fn decode_view(
20459                buf: &'a [u8],
20460            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20461                let __limit = ::core::cell::Cell::new(
20462                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20463                );
20464                <Self as ::buffa::MessageView>::decode_view_ctx(
20465                    buf,
20466                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20467                )
20468            }
20469            fn decode_view_with_ctx(
20470                buf: &'a [u8],
20471                ctx: ::buffa::DecodeContext<'_>,
20472            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20473                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20474            }
20475            fn merge_view_field(
20476                &mut self,
20477                tag: ::buffa::encoding::Tag,
20478                cur: &'a [u8],
20479                before_tag: &'a [u8],
20480                ctx: ::buffa::DecodeContext<'_>,
20481            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20482                let _ = ctx;
20483                #[allow(unused_variables)]
20484                let view = self;
20485                let mut cur = cur;
20486                match tag.field_number() {
20487                    1u32 => {
20488                        ::buffa::encoding::check_wire_type(
20489                            tag,
20490                            ::buffa::encoding::WireType::Fixed64,
20491                        )?;
20492                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20493                    }
20494                    2u32 => {
20495                        ::buffa::encoding::check_wire_type(
20496                            tag,
20497                            ::buffa::encoding::WireType::Fixed64,
20498                        )?;
20499                        view.subaccount_id = Some(
20500                            ::buffa::types::decode_fixed64(&mut cur)?,
20501                        );
20502                    }
20503                    _ => {
20504                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20505                        let span_len = before_tag.len() - cur.len();
20506                        view.__buffa_unknown_fields
20507                            .push_record(before_tag, span_len, ctx)?;
20508                    }
20509                }
20510                ::core::result::Result::Ok(cur)
20511            }
20512            fn to_owned_message(
20513                &self,
20514            ) -> ::core::result::Result<
20515                super::super::PauseTriggerRequest,
20516                ::buffa::DecodeError,
20517            > {
20518                self.to_owned_from_source(None)
20519            }
20520            #[allow(clippy::useless_conversion, clippy::needless_update)]
20521            fn to_owned_from_source(
20522                &self,
20523                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20524            ) -> ::core::result::Result<
20525                super::super::PauseTriggerRequest,
20526                ::buffa::DecodeError,
20527            > {
20528                #[allow(unused_imports)]
20529                use ::buffa::alloc::string::ToString as _;
20530                let _ = __buffa_src;
20531                ::core::result::Result::Ok(super::super::PauseTriggerRequest {
20532                    trigger_id: self.trigger_id,
20533                    subaccount_id: self.subaccount_id,
20534                    __buffa_unknown_fields: self
20535                        .__buffa_unknown_fields
20536                        .to_owned()?
20537                        .into(),
20538                    ..::core::default::Default::default()
20539                })
20540            }
20541        }
20542        impl<'a> ::buffa::ViewEncode<'a> for PauseTriggerRequestView<'a> {
20543            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20544            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
20545                #[allow(unused_imports)]
20546                use ::buffa::Enumeration as _;
20547                let mut size = 0u32;
20548                if self.trigger_id != 0u64 {
20549                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20550                }
20551                if self.subaccount_id.is_some() {
20552                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20553                }
20554                size += self.__buffa_unknown_fields.encoded_len() as u32;
20555                size
20556            }
20557            #[allow(clippy::needless_borrow)]
20558            fn write_to(
20559                &self,
20560                _cache: &mut ::buffa::SizeCache,
20561                buf: &mut impl ::buffa::bytes::BufMut,
20562            ) {
20563                #[allow(unused_imports)]
20564                use ::buffa::Enumeration as _;
20565                if self.trigger_id != 0u64 {
20566                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20567                }
20568                if let Some(v) = self.subaccount_id {
20569                    ::buffa::types::put_fixed64_field(2u32, v, buf);
20570                }
20571                self.__buffa_unknown_fields.write_to(buf);
20572            }
20573        }
20574        /// Serializes this view as protobuf JSON.
20575        ///
20576        /// Implicit-presence fields with default values are omitted, `required`
20577        /// fields are always emitted, explicit-presence (`optional`) fields are
20578        /// emitted only when set, bytes fields are base64-encoded, and enum
20579        /// values are their proto name strings.
20580        ///
20581        /// This impl uses `serialize_map(None)` because the number of emitted
20582        /// fields depends on default-omission rules; serializers that require
20583        /// known map lengths (e.g. `bincode`) will return a runtime error.
20584        /// Use the owned message type for those formats.
20585        impl<'__a> ::serde::Serialize for PauseTriggerRequestView<'__a> {
20586            fn serialize<__S: ::serde::Serializer>(
20587                &self,
20588                __s: __S,
20589            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20590                use ::serde::ser::SerializeMap as _;
20591                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20592                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20593                    __map
20594                        .serialize_entry(
20595                            "triggerId",
20596                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20597                        )?;
20598                }
20599                if let ::core::option::Option::Some(__v) = self.subaccount_id {
20600                    __map
20601                        .serialize_entry(
20602                            "subaccountId",
20603                            &::buffa::json_helpers::ProtoJson(&__v),
20604                        )?;
20605                }
20606                __map.end()
20607            }
20608        }
20609        impl<'a> ::buffa::MessageName for PauseTriggerRequestView<'a> {
20610            const PACKAGE: &'static str = "triggers.v1";
20611            const NAME: &'static str = "PauseTriggerRequest";
20612            const FULL_NAME: &'static str = "triggers.v1.PauseTriggerRequest";
20613            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
20614        }
20615        ::buffa::impl_default_view_instance!(PauseTriggerRequestView);
20616        ::buffa::impl_view_reborrow!(PauseTriggerRequestView);
20617        /** Self-contained, `'static` owned view of a `PauseTriggerRequest` message.
20618
20619 Wraps [`::buffa::OwnedView`]`<`[`PauseTriggerRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
20620
20621 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PauseTriggerRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
20622        #[derive(Clone, Debug)]
20623        pub struct PauseTriggerRequestOwnedView(
20624            ::buffa::OwnedView<PauseTriggerRequestView<'static>>,
20625        );
20626        impl PauseTriggerRequestOwnedView {
20627            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20628            ///
20629            /// The view borrows directly from the buffer's data; the buffer is
20630            /// retained inside the returned handle.
20631            ///
20632            /// # Errors
20633            ///
20634            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20635            /// protobuf data.
20636            pub fn decode(
20637                bytes: ::buffa::bytes::Bytes,
20638            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20639                ::core::result::Result::Ok(
20640                    PauseTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
20641                )
20642            }
20643            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20644            /// max message size).
20645            ///
20646            /// # Errors
20647            ///
20648            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20649            /// exceeds the configured limits.
20650            pub fn decode_with_options(
20651                bytes: ::buffa::bytes::Bytes,
20652                opts: &::buffa::DecodeOptions,
20653            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20654                ::core::result::Result::Ok(
20655                    PauseTriggerRequestOwnedView(
20656                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20657                    ),
20658                )
20659            }
20660            /// Build from an owned message via an encode → decode round-trip.
20661            ///
20662            /// # Errors
20663            ///
20664            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20665            /// somehow invalid (should not happen for well-formed messages).
20666            pub fn from_owned(
20667                msg: &super::super::PauseTriggerRequest,
20668            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20669                ::core::result::Result::Ok(
20670                    PauseTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
20671                )
20672            }
20673            /// Borrow the full [`PauseTriggerRequestView`] with its lifetime tied to `&self`.
20674            #[must_use]
20675            pub fn view(&self) -> &PauseTriggerRequestView<'_> {
20676                self.0.reborrow()
20677            }
20678            /// Convert to the owned message type.
20679            ///
20680            /// # Errors
20681            ///
20682            /// Returns an error if re-materializing preserved unknown fields
20683            /// fails (e.g. the unknown-field limit is exceeded).
20684            pub fn to_owned_message(
20685                &self,
20686            ) -> ::core::result::Result<
20687                super::super::PauseTriggerRequest,
20688                ::buffa::DecodeError,
20689            > {
20690                self.0.to_owned_message()
20691            }
20692            /// The underlying bytes buffer.
20693            #[must_use]
20694            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20695                self.0.bytes()
20696            }
20697            /// Consume the handle, returning the underlying bytes buffer.
20698            #[must_use]
20699            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20700                self.0.into_bytes()
20701            }
20702            /// Trigger ID to pause.
20703            ///
20704            /// Field 1: `trigger_id`
20705            #[must_use]
20706            pub fn trigger_id(&self) -> u64 {
20707                self.0.reborrow().trigger_id
20708            }
20709            /// Optional sub-account for authorization.
20710            ///
20711            /// Field 2: `subaccount_id`
20712            #[must_use]
20713            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
20714                self.0.reborrow().subaccount_id
20715            }
20716        }
20717        impl ::core::convert::From<::buffa::OwnedView<PauseTriggerRequestView<'static>>>
20718        for PauseTriggerRequestOwnedView {
20719            fn from(
20720                inner: ::buffa::OwnedView<PauseTriggerRequestView<'static>>,
20721            ) -> Self {
20722                PauseTriggerRequestOwnedView(inner)
20723            }
20724        }
20725        impl ::core::convert::From<PauseTriggerRequestOwnedView>
20726        for ::buffa::OwnedView<PauseTriggerRequestView<'static>> {
20727            fn from(wrapper: PauseTriggerRequestOwnedView) -> Self {
20728                wrapper.0
20729            }
20730        }
20731        impl ::core::convert::AsRef<::buffa::OwnedView<PauseTriggerRequestView<'static>>>
20732        for PauseTriggerRequestOwnedView {
20733            fn as_ref(&self) -> &::buffa::OwnedView<PauseTriggerRequestView<'static>> {
20734                &self.0
20735            }
20736        }
20737        impl ::buffa::HasMessageView for super::super::PauseTriggerRequest {
20738            type View<'a> = PauseTriggerRequestView<'a>;
20739            type ViewHandle = PauseTriggerRequestOwnedView;
20740        }
20741        impl ::serde::Serialize for PauseTriggerRequestOwnedView {
20742            fn serialize<__S: ::serde::Serializer>(
20743                &self,
20744                __s: __S,
20745            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20746                ::serde::Serialize::serialize(&self.0, __s)
20747            }
20748        }
20749        /// PauseTriggerResponse returns the trigger status after pausing.
20750        #[derive(Clone, Debug, Default)]
20751        pub struct PauseTriggerResponseView<'a> {
20752            /// Paused trigger ID.
20753            ///
20754            /// Field 1: `trigger_id`
20755            pub trigger_id: u64,
20756            /// Current trigger status after pausing.
20757            ///
20758            /// Field 2: `status`
20759            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
20760            /// Server timestamp.
20761            ///
20762            /// Field 3: `ts`
20763            pub ts: ::buffa::MessageFieldView<
20764                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
20765            >,
20766            /// Server timestamp in nanoseconds since epoch (UTC).
20767            ///
20768            /// Field 4: `ts_ns`
20769            pub ts_ns: u64,
20770            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20771        }
20772        impl<'a> ::buffa::MessageView<'a> for PauseTriggerResponseView<'a> {
20773            type Owned = super::super::PauseTriggerResponse;
20774            fn decode_view(
20775                buf: &'a [u8],
20776            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20777                let __limit = ::core::cell::Cell::new(
20778                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20779                );
20780                <Self as ::buffa::MessageView>::decode_view_ctx(
20781                    buf,
20782                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20783                )
20784            }
20785            fn decode_view_with_ctx(
20786                buf: &'a [u8],
20787                ctx: ::buffa::DecodeContext<'_>,
20788            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20789                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20790            }
20791            fn merge_view_field(
20792                &mut self,
20793                tag: ::buffa::encoding::Tag,
20794                cur: &'a [u8],
20795                before_tag: &'a [u8],
20796                ctx: ::buffa::DecodeContext<'_>,
20797            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20798                let _ = ctx;
20799                #[allow(unused_variables)]
20800                let view = self;
20801                let mut cur = cur;
20802                match tag.field_number() {
20803                    1u32 => {
20804                        ::buffa::encoding::check_wire_type(
20805                            tag,
20806                            ::buffa::encoding::WireType::Fixed64,
20807                        )?;
20808                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20809                    }
20810                    2u32 => {
20811                        ::buffa::encoding::check_wire_type(
20812                            tag,
20813                            ::buffa::encoding::WireType::Varint,
20814                        )?;
20815                        view.status = ::buffa::EnumValue::from(
20816                            ::buffa::types::decode_int32(&mut cur)?,
20817                        );
20818                    }
20819                    3u32 => {
20820                        ::buffa::encoding::check_wire_type(
20821                            tag,
20822                            ::buffa::encoding::WireType::LengthDelimited,
20823                        )?;
20824                        let __sub_ctx = ctx.descend()?;
20825                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
20826                        match view.ts.as_mut() {
20827                            Some(existing) => {
20828                                ::buffa::MessageView::merge_into_view(
20829                                    existing,
20830                                    sub,
20831                                    __sub_ctx,
20832                                )?
20833                            }
20834                            None => {
20835                                view.ts = ::buffa::MessageFieldView::set(
20836                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
20837                                        sub,
20838                                        __sub_ctx,
20839                                    )?,
20840                                );
20841                            }
20842                        }
20843                    }
20844                    4u32 => {
20845                        ::buffa::encoding::check_wire_type(
20846                            tag,
20847                            ::buffa::encoding::WireType::Varint,
20848                        )?;
20849                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
20850                    }
20851                    _ => {
20852                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20853                        let span_len = before_tag.len() - cur.len();
20854                        view.__buffa_unknown_fields
20855                            .push_record(before_tag, span_len, ctx)?;
20856                    }
20857                }
20858                ::core::result::Result::Ok(cur)
20859            }
20860            fn to_owned_message(
20861                &self,
20862            ) -> ::core::result::Result<
20863                super::super::PauseTriggerResponse,
20864                ::buffa::DecodeError,
20865            > {
20866                self.to_owned_from_source(None)
20867            }
20868            #[allow(clippy::useless_conversion, clippy::needless_update)]
20869            fn to_owned_from_source(
20870                &self,
20871                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20872            ) -> ::core::result::Result<
20873                super::super::PauseTriggerResponse,
20874                ::buffa::DecodeError,
20875            > {
20876                #[allow(unused_imports)]
20877                use ::buffa::alloc::string::ToString as _;
20878                let _ = __buffa_src;
20879                ::core::result::Result::Ok(super::super::PauseTriggerResponse {
20880                    trigger_id: self.trigger_id,
20881                    status: self.status,
20882                    ts: match self.ts.as_option() {
20883                        Some(v) => {
20884                            ::buffa::MessageField::<
20885                                ::buffa_types::google::protobuf::Timestamp,
20886                            >::some(v.to_owned_from_source(__buffa_src)?)
20887                        }
20888                        None => ::buffa::MessageField::none(),
20889                    },
20890                    ts_ns: self.ts_ns,
20891                    __buffa_unknown_fields: self
20892                        .__buffa_unknown_fields
20893                        .to_owned()?
20894                        .into(),
20895                    ..::core::default::Default::default()
20896                })
20897            }
20898        }
20899        impl<'a> ::buffa::ViewEncode<'a> for PauseTriggerResponseView<'a> {
20900            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20901            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
20902                #[allow(unused_imports)]
20903                use ::buffa::Enumeration as _;
20904                let mut size = 0u32;
20905                if self.trigger_id != 0u64 {
20906                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20907                }
20908                {
20909                    let val = self.status.to_i32();
20910                    if val != 0 {
20911                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
20912                    }
20913                }
20914                if self.ts.is_set() {
20915                    let __slot = __cache.reserve();
20916                    let inner_size = self.ts.compute_size(__cache);
20917                    __cache.set(__slot, inner_size);
20918                    size
20919                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
20920                            + inner_size;
20921                }
20922                if self.ts_ns != 0u64 {
20923                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
20924                }
20925                size += self.__buffa_unknown_fields.encoded_len() as u32;
20926                size
20927            }
20928            #[allow(clippy::needless_borrow)]
20929            fn write_to(
20930                &self,
20931                __cache: &mut ::buffa::SizeCache,
20932                buf: &mut impl ::buffa::bytes::BufMut,
20933            ) {
20934                #[allow(unused_imports)]
20935                use ::buffa::Enumeration as _;
20936                if self.trigger_id != 0u64 {
20937                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20938                }
20939                {
20940                    let val = self.status.to_i32();
20941                    if val != 0 {
20942                        ::buffa::types::put_int32_field(2u32, val, buf);
20943                    }
20944                }
20945                if self.ts.is_set() {
20946                    ::buffa::types::put_len_delimited_header(
20947                        3u32,
20948                        __cache.consume_next(),
20949                        buf,
20950                    );
20951                    self.ts.write_to(__cache, buf);
20952                }
20953                if self.ts_ns != 0u64 {
20954                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
20955                }
20956                self.__buffa_unknown_fields.write_to(buf);
20957            }
20958        }
20959        /// Serializes this view as protobuf JSON.
20960        ///
20961        /// Implicit-presence fields with default values are omitted, `required`
20962        /// fields are always emitted, explicit-presence (`optional`) fields are
20963        /// emitted only when set, bytes fields are base64-encoded, and enum
20964        /// values are their proto name strings.
20965        ///
20966        /// This impl uses `serialize_map(None)` because the number of emitted
20967        /// fields depends on default-omission rules; serializers that require
20968        /// known map lengths (e.g. `bincode`) will return a runtime error.
20969        /// Use the owned message type for those formats.
20970        impl<'__a> ::serde::Serialize for PauseTriggerResponseView<'__a> {
20971            fn serialize<__S: ::serde::Serializer>(
20972                &self,
20973                __s: __S,
20974            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20975                use ::serde::ser::SerializeMap as _;
20976                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20977                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20978                    __map
20979                        .serialize_entry(
20980                            "triggerId",
20981                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20982                        )?;
20983                }
20984                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
20985                    __map.serialize_entry("status", &self.status)?;
20986                }
20987                {
20988                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
20989                        __map.serialize_entry("ts", __v)?;
20990                    }
20991                }
20992                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
20993                    __map
20994                        .serialize_entry(
20995                            "tsNs",
20996                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
20997                        )?;
20998                }
20999                __map.end()
21000            }
21001        }
21002        impl<'a> ::buffa::MessageName for PauseTriggerResponseView<'a> {
21003            const PACKAGE: &'static str = "triggers.v1";
21004            const NAME: &'static str = "PauseTriggerResponse";
21005            const FULL_NAME: &'static str = "triggers.v1.PauseTriggerResponse";
21006            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
21007        }
21008        ::buffa::impl_default_view_instance!(PauseTriggerResponseView);
21009        ::buffa::impl_view_reborrow!(PauseTriggerResponseView);
21010        /** Self-contained, `'static` owned view of a `PauseTriggerResponse` message.
21011
21012 Wraps [`::buffa::OwnedView`]`<`[`PauseTriggerResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
21013
21014 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PauseTriggerResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
21015        #[derive(Clone, Debug)]
21016        pub struct PauseTriggerResponseOwnedView(
21017            ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21018        );
21019        impl PauseTriggerResponseOwnedView {
21020            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21021            ///
21022            /// The view borrows directly from the buffer's data; the buffer is
21023            /// retained inside the returned handle.
21024            ///
21025            /// # Errors
21026            ///
21027            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21028            /// protobuf data.
21029            pub fn decode(
21030                bytes: ::buffa::bytes::Bytes,
21031            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21032                ::core::result::Result::Ok(
21033                    PauseTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
21034                )
21035            }
21036            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21037            /// max message size).
21038            ///
21039            /// # Errors
21040            ///
21041            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21042            /// exceeds the configured limits.
21043            pub fn decode_with_options(
21044                bytes: ::buffa::bytes::Bytes,
21045                opts: &::buffa::DecodeOptions,
21046            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21047                ::core::result::Result::Ok(
21048                    PauseTriggerResponseOwnedView(
21049                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21050                    ),
21051                )
21052            }
21053            /// Build from an owned message via an encode → decode round-trip.
21054            ///
21055            /// # Errors
21056            ///
21057            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21058            /// somehow invalid (should not happen for well-formed messages).
21059            pub fn from_owned(
21060                msg: &super::super::PauseTriggerResponse,
21061            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21062                ::core::result::Result::Ok(
21063                    PauseTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
21064                )
21065            }
21066            /// Borrow the full [`PauseTriggerResponseView`] with its lifetime tied to `&self`.
21067            #[must_use]
21068            pub fn view(&self) -> &PauseTriggerResponseView<'_> {
21069                self.0.reborrow()
21070            }
21071            /// Convert to the owned message type.
21072            ///
21073            /// # Errors
21074            ///
21075            /// Returns an error if re-materializing preserved unknown fields
21076            /// fails (e.g. the unknown-field limit is exceeded).
21077            pub fn to_owned_message(
21078                &self,
21079            ) -> ::core::result::Result<
21080                super::super::PauseTriggerResponse,
21081                ::buffa::DecodeError,
21082            > {
21083                self.0.to_owned_message()
21084            }
21085            /// The underlying bytes buffer.
21086            #[must_use]
21087            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21088                self.0.bytes()
21089            }
21090            /// Consume the handle, returning the underlying bytes buffer.
21091            #[must_use]
21092            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21093                self.0.into_bytes()
21094            }
21095            /// Paused trigger ID.
21096            ///
21097            /// Field 1: `trigger_id`
21098            #[must_use]
21099            pub fn trigger_id(&self) -> u64 {
21100                self.0.reborrow().trigger_id
21101            }
21102            /// Current trigger status after pausing.
21103            ///
21104            /// Field 2: `status`
21105            #[must_use]
21106            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
21107                self.0.reborrow().status
21108            }
21109            /// Server timestamp.
21110            ///
21111            /// Field 3: `ts`
21112            #[must_use]
21113            pub fn ts(
21114                &self,
21115            ) -> &::buffa::MessageFieldView<
21116                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
21117            > {
21118                &self.0.reborrow().ts
21119            }
21120            /// Server timestamp in nanoseconds since epoch (UTC).
21121            ///
21122            /// Field 4: `ts_ns`
21123            #[must_use]
21124            pub fn ts_ns(&self) -> u64 {
21125                self.0.reborrow().ts_ns
21126            }
21127        }
21128        impl ::core::convert::From<::buffa::OwnedView<PauseTriggerResponseView<'static>>>
21129        for PauseTriggerResponseOwnedView {
21130            fn from(
21131                inner: ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21132            ) -> Self {
21133                PauseTriggerResponseOwnedView(inner)
21134            }
21135        }
21136        impl ::core::convert::From<PauseTriggerResponseOwnedView>
21137        for ::buffa::OwnedView<PauseTriggerResponseView<'static>> {
21138            fn from(wrapper: PauseTriggerResponseOwnedView) -> Self {
21139                wrapper.0
21140            }
21141        }
21142        impl ::core::convert::AsRef<
21143            ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21144        > for PauseTriggerResponseOwnedView {
21145            fn as_ref(&self) -> &::buffa::OwnedView<PauseTriggerResponseView<'static>> {
21146                &self.0
21147            }
21148        }
21149        impl ::buffa::HasMessageView for super::super::PauseTriggerResponse {
21150            type View<'a> = PauseTriggerResponseView<'a>;
21151            type ViewHandle = PauseTriggerResponseOwnedView;
21152        }
21153        impl ::serde::Serialize for PauseTriggerResponseOwnedView {
21154            fn serialize<__S: ::serde::Serializer>(
21155                &self,
21156                __s: __S,
21157            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21158                ::serde::Serialize::serialize(&self.0, __s)
21159            }
21160        }
21161        /// ResumeTriggerRequest resumes a paused trigger by ID.
21162        #[derive(Clone, Debug, Default)]
21163        pub struct ResumeTriggerRequestView<'a> {
21164            /// Trigger ID to resume.
21165            ///
21166            /// Field 1: `trigger_id`
21167            pub trigger_id: u64,
21168            /// Optional sub-account for authorization.
21169            ///
21170            /// Field 2: `subaccount_id`
21171            pub subaccount_id: ::core::option::Option<u64>,
21172            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21173        }
21174        impl<'a> ::buffa::MessageView<'a> for ResumeTriggerRequestView<'a> {
21175            type Owned = super::super::ResumeTriggerRequest;
21176            fn decode_view(
21177                buf: &'a [u8],
21178            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21179                let __limit = ::core::cell::Cell::new(
21180                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21181                );
21182                <Self as ::buffa::MessageView>::decode_view_ctx(
21183                    buf,
21184                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21185                )
21186            }
21187            fn decode_view_with_ctx(
21188                buf: &'a [u8],
21189                ctx: ::buffa::DecodeContext<'_>,
21190            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21191                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21192            }
21193            fn merge_view_field(
21194                &mut self,
21195                tag: ::buffa::encoding::Tag,
21196                cur: &'a [u8],
21197                before_tag: &'a [u8],
21198                ctx: ::buffa::DecodeContext<'_>,
21199            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21200                let _ = ctx;
21201                #[allow(unused_variables)]
21202                let view = self;
21203                let mut cur = cur;
21204                match tag.field_number() {
21205                    1u32 => {
21206                        ::buffa::encoding::check_wire_type(
21207                            tag,
21208                            ::buffa::encoding::WireType::Fixed64,
21209                        )?;
21210                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
21211                    }
21212                    2u32 => {
21213                        ::buffa::encoding::check_wire_type(
21214                            tag,
21215                            ::buffa::encoding::WireType::Fixed64,
21216                        )?;
21217                        view.subaccount_id = Some(
21218                            ::buffa::types::decode_fixed64(&mut cur)?,
21219                        );
21220                    }
21221                    _ => {
21222                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21223                        let span_len = before_tag.len() - cur.len();
21224                        view.__buffa_unknown_fields
21225                            .push_record(before_tag, span_len, ctx)?;
21226                    }
21227                }
21228                ::core::result::Result::Ok(cur)
21229            }
21230            fn to_owned_message(
21231                &self,
21232            ) -> ::core::result::Result<
21233                super::super::ResumeTriggerRequest,
21234                ::buffa::DecodeError,
21235            > {
21236                self.to_owned_from_source(None)
21237            }
21238            #[allow(clippy::useless_conversion, clippy::needless_update)]
21239            fn to_owned_from_source(
21240                &self,
21241                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21242            ) -> ::core::result::Result<
21243                super::super::ResumeTriggerRequest,
21244                ::buffa::DecodeError,
21245            > {
21246                #[allow(unused_imports)]
21247                use ::buffa::alloc::string::ToString as _;
21248                let _ = __buffa_src;
21249                ::core::result::Result::Ok(super::super::ResumeTriggerRequest {
21250                    trigger_id: self.trigger_id,
21251                    subaccount_id: self.subaccount_id,
21252                    __buffa_unknown_fields: self
21253                        .__buffa_unknown_fields
21254                        .to_owned()?
21255                        .into(),
21256                    ..::core::default::Default::default()
21257                })
21258            }
21259        }
21260        impl<'a> ::buffa::ViewEncode<'a> for ResumeTriggerRequestView<'a> {
21261            #[allow(clippy::needless_borrow, clippy::let_and_return)]
21262            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
21263                #[allow(unused_imports)]
21264                use ::buffa::Enumeration as _;
21265                let mut size = 0u32;
21266                if self.trigger_id != 0u64 {
21267                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21268                }
21269                if self.subaccount_id.is_some() {
21270                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21271                }
21272                size += self.__buffa_unknown_fields.encoded_len() as u32;
21273                size
21274            }
21275            #[allow(clippy::needless_borrow)]
21276            fn write_to(
21277                &self,
21278                _cache: &mut ::buffa::SizeCache,
21279                buf: &mut impl ::buffa::bytes::BufMut,
21280            ) {
21281                #[allow(unused_imports)]
21282                use ::buffa::Enumeration as _;
21283                if self.trigger_id != 0u64 {
21284                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21285                }
21286                if let Some(v) = self.subaccount_id {
21287                    ::buffa::types::put_fixed64_field(2u32, v, buf);
21288                }
21289                self.__buffa_unknown_fields.write_to(buf);
21290            }
21291        }
21292        /// Serializes this view as protobuf JSON.
21293        ///
21294        /// Implicit-presence fields with default values are omitted, `required`
21295        /// fields are always emitted, explicit-presence (`optional`) fields are
21296        /// emitted only when set, bytes fields are base64-encoded, and enum
21297        /// values are their proto name strings.
21298        ///
21299        /// This impl uses `serialize_map(None)` because the number of emitted
21300        /// fields depends on default-omission rules; serializers that require
21301        /// known map lengths (e.g. `bincode`) will return a runtime error.
21302        /// Use the owned message type for those formats.
21303        impl<'__a> ::serde::Serialize for ResumeTriggerRequestView<'__a> {
21304            fn serialize<__S: ::serde::Serializer>(
21305                &self,
21306                __s: __S,
21307            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21308                use ::serde::ser::SerializeMap as _;
21309                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21310                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21311                    __map
21312                        .serialize_entry(
21313                            "triggerId",
21314                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21315                        )?;
21316                }
21317                if let ::core::option::Option::Some(__v) = self.subaccount_id {
21318                    __map
21319                        .serialize_entry(
21320                            "subaccountId",
21321                            &::buffa::json_helpers::ProtoJson(&__v),
21322                        )?;
21323                }
21324                __map.end()
21325            }
21326        }
21327        impl<'a> ::buffa::MessageName for ResumeTriggerRequestView<'a> {
21328            const PACKAGE: &'static str = "triggers.v1";
21329            const NAME: &'static str = "ResumeTriggerRequest";
21330            const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerRequest";
21331            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
21332        }
21333        ::buffa::impl_default_view_instance!(ResumeTriggerRequestView);
21334        ::buffa::impl_view_reborrow!(ResumeTriggerRequestView);
21335        /** Self-contained, `'static` owned view of a `ResumeTriggerRequest` message.
21336
21337 Wraps [`::buffa::OwnedView`]`<`[`ResumeTriggerRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
21338
21339 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ResumeTriggerRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
21340        #[derive(Clone, Debug)]
21341        pub struct ResumeTriggerRequestOwnedView(
21342            ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21343        );
21344        impl ResumeTriggerRequestOwnedView {
21345            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21346            ///
21347            /// The view borrows directly from the buffer's data; the buffer is
21348            /// retained inside the returned handle.
21349            ///
21350            /// # Errors
21351            ///
21352            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21353            /// protobuf data.
21354            pub fn decode(
21355                bytes: ::buffa::bytes::Bytes,
21356            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21357                ::core::result::Result::Ok(
21358                    ResumeTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
21359                )
21360            }
21361            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21362            /// max message size).
21363            ///
21364            /// # Errors
21365            ///
21366            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21367            /// exceeds the configured limits.
21368            pub fn decode_with_options(
21369                bytes: ::buffa::bytes::Bytes,
21370                opts: &::buffa::DecodeOptions,
21371            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21372                ::core::result::Result::Ok(
21373                    ResumeTriggerRequestOwnedView(
21374                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21375                    ),
21376                )
21377            }
21378            /// Build from an owned message via an encode → decode round-trip.
21379            ///
21380            /// # Errors
21381            ///
21382            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21383            /// somehow invalid (should not happen for well-formed messages).
21384            pub fn from_owned(
21385                msg: &super::super::ResumeTriggerRequest,
21386            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21387                ::core::result::Result::Ok(
21388                    ResumeTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
21389                )
21390            }
21391            /// Borrow the full [`ResumeTriggerRequestView`] with its lifetime tied to `&self`.
21392            #[must_use]
21393            pub fn view(&self) -> &ResumeTriggerRequestView<'_> {
21394                self.0.reborrow()
21395            }
21396            /// Convert to the owned message type.
21397            ///
21398            /// # Errors
21399            ///
21400            /// Returns an error if re-materializing preserved unknown fields
21401            /// fails (e.g. the unknown-field limit is exceeded).
21402            pub fn to_owned_message(
21403                &self,
21404            ) -> ::core::result::Result<
21405                super::super::ResumeTriggerRequest,
21406                ::buffa::DecodeError,
21407            > {
21408                self.0.to_owned_message()
21409            }
21410            /// The underlying bytes buffer.
21411            #[must_use]
21412            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21413                self.0.bytes()
21414            }
21415            /// Consume the handle, returning the underlying bytes buffer.
21416            #[must_use]
21417            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21418                self.0.into_bytes()
21419            }
21420            /// Trigger ID to resume.
21421            ///
21422            /// Field 1: `trigger_id`
21423            #[must_use]
21424            pub fn trigger_id(&self) -> u64 {
21425                self.0.reborrow().trigger_id
21426            }
21427            /// Optional sub-account for authorization.
21428            ///
21429            /// Field 2: `subaccount_id`
21430            #[must_use]
21431            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
21432                self.0.reborrow().subaccount_id
21433            }
21434        }
21435        impl ::core::convert::From<::buffa::OwnedView<ResumeTriggerRequestView<'static>>>
21436        for ResumeTriggerRequestOwnedView {
21437            fn from(
21438                inner: ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21439            ) -> Self {
21440                ResumeTriggerRequestOwnedView(inner)
21441            }
21442        }
21443        impl ::core::convert::From<ResumeTriggerRequestOwnedView>
21444        for ::buffa::OwnedView<ResumeTriggerRequestView<'static>> {
21445            fn from(wrapper: ResumeTriggerRequestOwnedView) -> Self {
21446                wrapper.0
21447            }
21448        }
21449        impl ::core::convert::AsRef<
21450            ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21451        > for ResumeTriggerRequestOwnedView {
21452            fn as_ref(&self) -> &::buffa::OwnedView<ResumeTriggerRequestView<'static>> {
21453                &self.0
21454            }
21455        }
21456        impl ::buffa::HasMessageView for super::super::ResumeTriggerRequest {
21457            type View<'a> = ResumeTriggerRequestView<'a>;
21458            type ViewHandle = ResumeTriggerRequestOwnedView;
21459        }
21460        impl ::serde::Serialize for ResumeTriggerRequestOwnedView {
21461            fn serialize<__S: ::serde::Serializer>(
21462                &self,
21463                __s: __S,
21464            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21465                ::serde::Serialize::serialize(&self.0, __s)
21466            }
21467        }
21468        /// ResumeTriggerResponse returns the trigger status after resuming.
21469        #[derive(Clone, Debug, Default)]
21470        pub struct ResumeTriggerResponseView<'a> {
21471            /// Resumed trigger ID.
21472            ///
21473            /// Field 1: `trigger_id`
21474            pub trigger_id: u64,
21475            /// Current trigger status after resuming.
21476            ///
21477            /// Field 2: `status`
21478            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
21479            /// Server timestamp.
21480            ///
21481            /// Field 3: `ts`
21482            pub ts: ::buffa::MessageFieldView<
21483                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
21484            >,
21485            /// Server timestamp in nanoseconds since epoch (UTC).
21486            ///
21487            /// Field 4: `ts_ns`
21488            pub ts_ns: u64,
21489            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21490        }
21491        impl<'a> ::buffa::MessageView<'a> for ResumeTriggerResponseView<'a> {
21492            type Owned = super::super::ResumeTriggerResponse;
21493            fn decode_view(
21494                buf: &'a [u8],
21495            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21496                let __limit = ::core::cell::Cell::new(
21497                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21498                );
21499                <Self as ::buffa::MessageView>::decode_view_ctx(
21500                    buf,
21501                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21502                )
21503            }
21504            fn decode_view_with_ctx(
21505                buf: &'a [u8],
21506                ctx: ::buffa::DecodeContext<'_>,
21507            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21508                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21509            }
21510            fn merge_view_field(
21511                &mut self,
21512                tag: ::buffa::encoding::Tag,
21513                cur: &'a [u8],
21514                before_tag: &'a [u8],
21515                ctx: ::buffa::DecodeContext<'_>,
21516            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21517                let _ = ctx;
21518                #[allow(unused_variables)]
21519                let view = self;
21520                let mut cur = cur;
21521                match tag.field_number() {
21522                    1u32 => {
21523                        ::buffa::encoding::check_wire_type(
21524                            tag,
21525                            ::buffa::encoding::WireType::Fixed64,
21526                        )?;
21527                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
21528                    }
21529                    2u32 => {
21530                        ::buffa::encoding::check_wire_type(
21531                            tag,
21532                            ::buffa::encoding::WireType::Varint,
21533                        )?;
21534                        view.status = ::buffa::EnumValue::from(
21535                            ::buffa::types::decode_int32(&mut cur)?,
21536                        );
21537                    }
21538                    3u32 => {
21539                        ::buffa::encoding::check_wire_type(
21540                            tag,
21541                            ::buffa::encoding::WireType::LengthDelimited,
21542                        )?;
21543                        let __sub_ctx = ctx.descend()?;
21544                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
21545                        match view.ts.as_mut() {
21546                            Some(existing) => {
21547                                ::buffa::MessageView::merge_into_view(
21548                                    existing,
21549                                    sub,
21550                                    __sub_ctx,
21551                                )?
21552                            }
21553                            None => {
21554                                view.ts = ::buffa::MessageFieldView::set(
21555                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
21556                                        sub,
21557                                        __sub_ctx,
21558                                    )?,
21559                                );
21560                            }
21561                        }
21562                    }
21563                    4u32 => {
21564                        ::buffa::encoding::check_wire_type(
21565                            tag,
21566                            ::buffa::encoding::WireType::Varint,
21567                        )?;
21568                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
21569                    }
21570                    _ => {
21571                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21572                        let span_len = before_tag.len() - cur.len();
21573                        view.__buffa_unknown_fields
21574                            .push_record(before_tag, span_len, ctx)?;
21575                    }
21576                }
21577                ::core::result::Result::Ok(cur)
21578            }
21579            fn to_owned_message(
21580                &self,
21581            ) -> ::core::result::Result<
21582                super::super::ResumeTriggerResponse,
21583                ::buffa::DecodeError,
21584            > {
21585                self.to_owned_from_source(None)
21586            }
21587            #[allow(clippy::useless_conversion, clippy::needless_update)]
21588            fn to_owned_from_source(
21589                &self,
21590                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21591            ) -> ::core::result::Result<
21592                super::super::ResumeTriggerResponse,
21593                ::buffa::DecodeError,
21594            > {
21595                #[allow(unused_imports)]
21596                use ::buffa::alloc::string::ToString as _;
21597                let _ = __buffa_src;
21598                ::core::result::Result::Ok(super::super::ResumeTriggerResponse {
21599                    trigger_id: self.trigger_id,
21600                    status: self.status,
21601                    ts: match self.ts.as_option() {
21602                        Some(v) => {
21603                            ::buffa::MessageField::<
21604                                ::buffa_types::google::protobuf::Timestamp,
21605                            >::some(v.to_owned_from_source(__buffa_src)?)
21606                        }
21607                        None => ::buffa::MessageField::none(),
21608                    },
21609                    ts_ns: self.ts_ns,
21610                    __buffa_unknown_fields: self
21611                        .__buffa_unknown_fields
21612                        .to_owned()?
21613                        .into(),
21614                    ..::core::default::Default::default()
21615                })
21616            }
21617        }
21618        impl<'a> ::buffa::ViewEncode<'a> for ResumeTriggerResponseView<'a> {
21619            #[allow(clippy::needless_borrow, clippy::let_and_return)]
21620            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
21621                #[allow(unused_imports)]
21622                use ::buffa::Enumeration as _;
21623                let mut size = 0u32;
21624                if self.trigger_id != 0u64 {
21625                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21626                }
21627                {
21628                    let val = self.status.to_i32();
21629                    if val != 0 {
21630                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
21631                    }
21632                }
21633                if self.ts.is_set() {
21634                    let __slot = __cache.reserve();
21635                    let inner_size = self.ts.compute_size(__cache);
21636                    __cache.set(__slot, inner_size);
21637                    size
21638                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
21639                            + inner_size;
21640                }
21641                if self.ts_ns != 0u64 {
21642                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
21643                }
21644                size += self.__buffa_unknown_fields.encoded_len() as u32;
21645                size
21646            }
21647            #[allow(clippy::needless_borrow)]
21648            fn write_to(
21649                &self,
21650                __cache: &mut ::buffa::SizeCache,
21651                buf: &mut impl ::buffa::bytes::BufMut,
21652            ) {
21653                #[allow(unused_imports)]
21654                use ::buffa::Enumeration as _;
21655                if self.trigger_id != 0u64 {
21656                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21657                }
21658                {
21659                    let val = self.status.to_i32();
21660                    if val != 0 {
21661                        ::buffa::types::put_int32_field(2u32, val, buf);
21662                    }
21663                }
21664                if self.ts.is_set() {
21665                    ::buffa::types::put_len_delimited_header(
21666                        3u32,
21667                        __cache.consume_next(),
21668                        buf,
21669                    );
21670                    self.ts.write_to(__cache, buf);
21671                }
21672                if self.ts_ns != 0u64 {
21673                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
21674                }
21675                self.__buffa_unknown_fields.write_to(buf);
21676            }
21677        }
21678        /// Serializes this view as protobuf JSON.
21679        ///
21680        /// Implicit-presence fields with default values are omitted, `required`
21681        /// fields are always emitted, explicit-presence (`optional`) fields are
21682        /// emitted only when set, bytes fields are base64-encoded, and enum
21683        /// values are their proto name strings.
21684        ///
21685        /// This impl uses `serialize_map(None)` because the number of emitted
21686        /// fields depends on default-omission rules; serializers that require
21687        /// known map lengths (e.g. `bincode`) will return a runtime error.
21688        /// Use the owned message type for those formats.
21689        impl<'__a> ::serde::Serialize for ResumeTriggerResponseView<'__a> {
21690            fn serialize<__S: ::serde::Serializer>(
21691                &self,
21692                __s: __S,
21693            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21694                use ::serde::ser::SerializeMap as _;
21695                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21696                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21697                    __map
21698                        .serialize_entry(
21699                            "triggerId",
21700                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21701                        )?;
21702                }
21703                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
21704                    __map.serialize_entry("status", &self.status)?;
21705                }
21706                {
21707                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
21708                        __map.serialize_entry("ts", __v)?;
21709                    }
21710                }
21711                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
21712                    __map
21713                        .serialize_entry(
21714                            "tsNs",
21715                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
21716                        )?;
21717                }
21718                __map.end()
21719            }
21720        }
21721        impl<'a> ::buffa::MessageName for ResumeTriggerResponseView<'a> {
21722            const PACKAGE: &'static str = "triggers.v1";
21723            const NAME: &'static str = "ResumeTriggerResponse";
21724            const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerResponse";
21725            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
21726        }
21727        ::buffa::impl_default_view_instance!(ResumeTriggerResponseView);
21728        ::buffa::impl_view_reborrow!(ResumeTriggerResponseView);
21729        /** Self-contained, `'static` owned view of a `ResumeTriggerResponse` message.
21730
21731 Wraps [`::buffa::OwnedView`]`<`[`ResumeTriggerResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
21732
21733 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`ResumeTriggerResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
21734        #[derive(Clone, Debug)]
21735        pub struct ResumeTriggerResponseOwnedView(
21736            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21737        );
21738        impl ResumeTriggerResponseOwnedView {
21739            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21740            ///
21741            /// The view borrows directly from the buffer's data; the buffer is
21742            /// retained inside the returned handle.
21743            ///
21744            /// # Errors
21745            ///
21746            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21747            /// protobuf data.
21748            pub fn decode(
21749                bytes: ::buffa::bytes::Bytes,
21750            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21751                ::core::result::Result::Ok(
21752                    ResumeTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
21753                )
21754            }
21755            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21756            /// max message size).
21757            ///
21758            /// # Errors
21759            ///
21760            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21761            /// exceeds the configured limits.
21762            pub fn decode_with_options(
21763                bytes: ::buffa::bytes::Bytes,
21764                opts: &::buffa::DecodeOptions,
21765            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21766                ::core::result::Result::Ok(
21767                    ResumeTriggerResponseOwnedView(
21768                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21769                    ),
21770                )
21771            }
21772            /// Build from an owned message via an encode → decode round-trip.
21773            ///
21774            /// # Errors
21775            ///
21776            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21777            /// somehow invalid (should not happen for well-formed messages).
21778            pub fn from_owned(
21779                msg: &super::super::ResumeTriggerResponse,
21780            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21781                ::core::result::Result::Ok(
21782                    ResumeTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
21783                )
21784            }
21785            /// Borrow the full [`ResumeTriggerResponseView`] with its lifetime tied to `&self`.
21786            #[must_use]
21787            pub fn view(&self) -> &ResumeTriggerResponseView<'_> {
21788                self.0.reborrow()
21789            }
21790            /// Convert to the owned message type.
21791            ///
21792            /// # Errors
21793            ///
21794            /// Returns an error if re-materializing preserved unknown fields
21795            /// fails (e.g. the unknown-field limit is exceeded).
21796            pub fn to_owned_message(
21797                &self,
21798            ) -> ::core::result::Result<
21799                super::super::ResumeTriggerResponse,
21800                ::buffa::DecodeError,
21801            > {
21802                self.0.to_owned_message()
21803            }
21804            /// The underlying bytes buffer.
21805            #[must_use]
21806            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21807                self.0.bytes()
21808            }
21809            /// Consume the handle, returning the underlying bytes buffer.
21810            #[must_use]
21811            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21812                self.0.into_bytes()
21813            }
21814            /// Resumed trigger ID.
21815            ///
21816            /// Field 1: `trigger_id`
21817            #[must_use]
21818            pub fn trigger_id(&self) -> u64 {
21819                self.0.reborrow().trigger_id
21820            }
21821            /// Current trigger status after resuming.
21822            ///
21823            /// Field 2: `status`
21824            #[must_use]
21825            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
21826                self.0.reborrow().status
21827            }
21828            /// Server timestamp.
21829            ///
21830            /// Field 3: `ts`
21831            #[must_use]
21832            pub fn ts(
21833                &self,
21834            ) -> &::buffa::MessageFieldView<
21835                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
21836            > {
21837                &self.0.reborrow().ts
21838            }
21839            /// Server timestamp in nanoseconds since epoch (UTC).
21840            ///
21841            /// Field 4: `ts_ns`
21842            #[must_use]
21843            pub fn ts_ns(&self) -> u64 {
21844                self.0.reborrow().ts_ns
21845            }
21846        }
21847        impl ::core::convert::From<
21848            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21849        > for ResumeTriggerResponseOwnedView {
21850            fn from(
21851                inner: ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21852            ) -> Self {
21853                ResumeTriggerResponseOwnedView(inner)
21854            }
21855        }
21856        impl ::core::convert::From<ResumeTriggerResponseOwnedView>
21857        for ::buffa::OwnedView<ResumeTriggerResponseView<'static>> {
21858            fn from(wrapper: ResumeTriggerResponseOwnedView) -> Self {
21859                wrapper.0
21860            }
21861        }
21862        impl ::core::convert::AsRef<
21863            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21864        > for ResumeTriggerResponseOwnedView {
21865            fn as_ref(&self) -> &::buffa::OwnedView<ResumeTriggerResponseView<'static>> {
21866                &self.0
21867            }
21868        }
21869        impl ::buffa::HasMessageView for super::super::ResumeTriggerResponse {
21870            type View<'a> = ResumeTriggerResponseView<'a>;
21871            type ViewHandle = ResumeTriggerResponseOwnedView;
21872        }
21873        impl ::serde::Serialize for ResumeTriggerResponseOwnedView {
21874            fn serialize<__S: ::serde::Serializer>(
21875                &self,
21876                __s: __S,
21877            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21878                ::serde::Serialize::serialize(&self.0, __s)
21879            }
21880        }
21881        /// =============================================================================
21882        /// Trigger Model
21883        /// =============================================================================
21884        ///
21885        /// StopDetails contains configuration for STOP_LOSS and TAKE_PROFIT triggers.
21886        #[derive(Clone, Debug, Default)]
21887        pub struct StopDetailsView<'a> {
21888            /// Trigger threshold price in quote units scaled by 1e6.
21889            ///
21890            /// Field 1: `trigger_price_ticks`
21891            pub trigger_price_ticks: i64,
21892            /// Price source used for trigger evaluation.
21893            ///
21894            /// Field 2: `trigger_price_source`
21895            pub trigger_price_source: ::buffa::EnumValue<
21896                super::super::super::super::orders::v1::TriggerPriceSource,
21897            >,
21898            /// Direction the price must cross to fire the trigger.
21899            ///
21900            /// Field 3: `trigger_direction`
21901            pub trigger_direction: ::buffa::EnumValue<
21902                super::super::super::super::orders::v1::TriggerDirection,
21903            >,
21904            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21905        }
21906        impl<'a> ::buffa::MessageView<'a> for StopDetailsView<'a> {
21907            type Owned = super::super::StopDetails;
21908            fn decode_view(
21909                buf: &'a [u8],
21910            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21911                let __limit = ::core::cell::Cell::new(
21912                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21913                );
21914                <Self as ::buffa::MessageView>::decode_view_ctx(
21915                    buf,
21916                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21917                )
21918            }
21919            fn decode_view_with_ctx(
21920                buf: &'a [u8],
21921                ctx: ::buffa::DecodeContext<'_>,
21922            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21923                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21924            }
21925            fn merge_view_field(
21926                &mut self,
21927                tag: ::buffa::encoding::Tag,
21928                cur: &'a [u8],
21929                before_tag: &'a [u8],
21930                ctx: ::buffa::DecodeContext<'_>,
21931            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21932                let _ = ctx;
21933                #[allow(unused_variables)]
21934                let view = self;
21935                let mut cur = cur;
21936                match tag.field_number() {
21937                    1u32 => {
21938                        ::buffa::encoding::check_wire_type(
21939                            tag,
21940                            ::buffa::encoding::WireType::Varint,
21941                        )?;
21942                        view.trigger_price_ticks = ::buffa::types::decode_int64(
21943                            &mut cur,
21944                        )?;
21945                    }
21946                    2u32 => {
21947                        ::buffa::encoding::check_wire_type(
21948                            tag,
21949                            ::buffa::encoding::WireType::Varint,
21950                        )?;
21951                        view.trigger_price_source = ::buffa::EnumValue::from(
21952                            ::buffa::types::decode_int32(&mut cur)?,
21953                        );
21954                    }
21955                    3u32 => {
21956                        ::buffa::encoding::check_wire_type(
21957                            tag,
21958                            ::buffa::encoding::WireType::Varint,
21959                        )?;
21960                        view.trigger_direction = ::buffa::EnumValue::from(
21961                            ::buffa::types::decode_int32(&mut cur)?,
21962                        );
21963                    }
21964                    _ => {
21965                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21966                        let span_len = before_tag.len() - cur.len();
21967                        view.__buffa_unknown_fields
21968                            .push_record(before_tag, span_len, ctx)?;
21969                    }
21970                }
21971                ::core::result::Result::Ok(cur)
21972            }
21973            fn to_owned_message(
21974                &self,
21975            ) -> ::core::result::Result<
21976                super::super::StopDetails,
21977                ::buffa::DecodeError,
21978            > {
21979                self.to_owned_from_source(None)
21980            }
21981            #[allow(clippy::useless_conversion, clippy::needless_update)]
21982            fn to_owned_from_source(
21983                &self,
21984                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21985            ) -> ::core::result::Result<
21986                super::super::StopDetails,
21987                ::buffa::DecodeError,
21988            > {
21989                #[allow(unused_imports)]
21990                use ::buffa::alloc::string::ToString as _;
21991                let _ = __buffa_src;
21992                ::core::result::Result::Ok(super::super::StopDetails {
21993                    trigger_price_ticks: self.trigger_price_ticks,
21994                    trigger_price_source: self.trigger_price_source,
21995                    trigger_direction: self.trigger_direction,
21996                    __buffa_unknown_fields: self
21997                        .__buffa_unknown_fields
21998                        .to_owned()?
21999                        .into(),
22000                    ..::core::default::Default::default()
22001                })
22002            }
22003        }
22004        impl<'a> ::buffa::ViewEncode<'a> for StopDetailsView<'a> {
22005            #[allow(clippy::needless_borrow, clippy::let_and_return)]
22006            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
22007                #[allow(unused_imports)]
22008                use ::buffa::Enumeration as _;
22009                let mut size = 0u32;
22010                if self.trigger_price_ticks != 0i64 {
22011                    size
22012                        += 1u32
22013                            + ::buffa::types::int64_encoded_len(self.trigger_price_ticks)
22014                                as u32;
22015                }
22016                {
22017                    let val = self.trigger_price_source.to_i32();
22018                    if val != 0 {
22019                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22020                    }
22021                }
22022                {
22023                    let val = self.trigger_direction.to_i32();
22024                    if val != 0 {
22025                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22026                    }
22027                }
22028                size += self.__buffa_unknown_fields.encoded_len() as u32;
22029                size
22030            }
22031            #[allow(clippy::needless_borrow)]
22032            fn write_to(
22033                &self,
22034                _cache: &mut ::buffa::SizeCache,
22035                buf: &mut impl ::buffa::bytes::BufMut,
22036            ) {
22037                #[allow(unused_imports)]
22038                use ::buffa::Enumeration as _;
22039                if self.trigger_price_ticks != 0i64 {
22040                    ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
22041                }
22042                {
22043                    let val = self.trigger_price_source.to_i32();
22044                    if val != 0 {
22045                        ::buffa::types::put_int32_field(2u32, val, buf);
22046                    }
22047                }
22048                {
22049                    let val = self.trigger_direction.to_i32();
22050                    if val != 0 {
22051                        ::buffa::types::put_int32_field(3u32, val, buf);
22052                    }
22053                }
22054                self.__buffa_unknown_fields.write_to(buf);
22055            }
22056        }
22057        /// Serializes this view as protobuf JSON.
22058        ///
22059        /// Implicit-presence fields with default values are omitted, `required`
22060        /// fields are always emitted, explicit-presence (`optional`) fields are
22061        /// emitted only when set, bytes fields are base64-encoded, and enum
22062        /// values are their proto name strings.
22063        ///
22064        /// This impl uses `serialize_map(None)` because the number of emitted
22065        /// fields depends on default-omission rules; serializers that require
22066        /// known map lengths (e.g. `bincode`) will return a runtime error.
22067        /// Use the owned message type for those formats.
22068        impl<'__a> ::serde::Serialize for StopDetailsView<'__a> {
22069            fn serialize<__S: ::serde::Serializer>(
22070                &self,
22071                __s: __S,
22072            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22073                use ::serde::ser::SerializeMap as _;
22074                let mut __map = __s.serialize_map(::core::option::Option::None)?;
22075                if !::buffa::json_helpers::skip_if::is_zero_i64(
22076                    &self.trigger_price_ticks,
22077                ) {
22078                    __map
22079                        .serialize_entry(
22080                            "triggerPriceTicks",
22081                            &::buffa::json_helpers::ProtoJson(&self.trigger_price_ticks),
22082                        )?;
22083                }
22084                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22085                    &self.trigger_price_source,
22086                ) {
22087                    __map
22088                        .serialize_entry(
22089                            "triggerPriceSource",
22090                            &self.trigger_price_source,
22091                        )?;
22092                }
22093                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22094                    &self.trigger_direction,
22095                ) {
22096                    __map.serialize_entry("triggerDirection", &self.trigger_direction)?;
22097                }
22098                __map.end()
22099            }
22100        }
22101        impl<'a> ::buffa::MessageName for StopDetailsView<'a> {
22102            const PACKAGE: &'static str = "triggers.v1";
22103            const NAME: &'static str = "StopDetails";
22104            const FULL_NAME: &'static str = "triggers.v1.StopDetails";
22105            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
22106        }
22107        ::buffa::impl_default_view_instance!(StopDetailsView);
22108        ::buffa::impl_view_reborrow!(StopDetailsView);
22109        /** Self-contained, `'static` owned view of a `StopDetails` message.
22110
22111 Wraps [`::buffa::OwnedView`]`<`[`StopDetailsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
22112
22113 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`StopDetailsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
22114        #[derive(Clone, Debug)]
22115        pub struct StopDetailsOwnedView(::buffa::OwnedView<StopDetailsView<'static>>);
22116        impl StopDetailsOwnedView {
22117            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
22118            ///
22119            /// The view borrows directly from the buffer's data; the buffer is
22120            /// retained inside the returned handle.
22121            ///
22122            /// # Errors
22123            ///
22124            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
22125            /// protobuf data.
22126            pub fn decode(
22127                bytes: ::buffa::bytes::Bytes,
22128            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22129                ::core::result::Result::Ok(
22130                    StopDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
22131                )
22132            }
22133            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
22134            /// max message size).
22135            ///
22136            /// # Errors
22137            ///
22138            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
22139            /// exceeds the configured limits.
22140            pub fn decode_with_options(
22141                bytes: ::buffa::bytes::Bytes,
22142                opts: &::buffa::DecodeOptions,
22143            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22144                ::core::result::Result::Ok(
22145                    StopDetailsOwnedView(
22146                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
22147                    ),
22148                )
22149            }
22150            /// Build from an owned message via an encode → decode round-trip.
22151            ///
22152            /// # Errors
22153            ///
22154            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
22155            /// somehow invalid (should not happen for well-formed messages).
22156            pub fn from_owned(
22157                msg: &super::super::StopDetails,
22158            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22159                ::core::result::Result::Ok(
22160                    StopDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
22161                )
22162            }
22163            /// Borrow the full [`StopDetailsView`] with its lifetime tied to `&self`.
22164            #[must_use]
22165            pub fn view(&self) -> &StopDetailsView<'_> {
22166                self.0.reborrow()
22167            }
22168            /// Convert to the owned message type.
22169            ///
22170            /// # Errors
22171            ///
22172            /// Returns an error if re-materializing preserved unknown fields
22173            /// fails (e.g. the unknown-field limit is exceeded).
22174            pub fn to_owned_message(
22175                &self,
22176            ) -> ::core::result::Result<
22177                super::super::StopDetails,
22178                ::buffa::DecodeError,
22179            > {
22180                self.0.to_owned_message()
22181            }
22182            /// The underlying bytes buffer.
22183            #[must_use]
22184            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
22185                self.0.bytes()
22186            }
22187            /// Consume the handle, returning the underlying bytes buffer.
22188            #[must_use]
22189            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
22190                self.0.into_bytes()
22191            }
22192            /// Trigger threshold price in quote units scaled by 1e6.
22193            ///
22194            /// Field 1: `trigger_price_ticks`
22195            #[must_use]
22196            pub fn trigger_price_ticks(&self) -> i64 {
22197                self.0.reborrow().trigger_price_ticks
22198            }
22199            /// Price source used for trigger evaluation.
22200            ///
22201            /// Field 2: `trigger_price_source`
22202            #[must_use]
22203            pub fn trigger_price_source(
22204                &self,
22205            ) -> ::buffa::EnumValue<
22206                super::super::super::super::orders::v1::TriggerPriceSource,
22207            > {
22208                self.0.reborrow().trigger_price_source
22209            }
22210            /// Direction the price must cross to fire the trigger.
22211            ///
22212            /// Field 3: `trigger_direction`
22213            #[must_use]
22214            pub fn trigger_direction(
22215                &self,
22216            ) -> ::buffa::EnumValue<
22217                super::super::super::super::orders::v1::TriggerDirection,
22218            > {
22219                self.0.reborrow().trigger_direction
22220            }
22221        }
22222        impl ::core::convert::From<::buffa::OwnedView<StopDetailsView<'static>>>
22223        for StopDetailsOwnedView {
22224            fn from(inner: ::buffa::OwnedView<StopDetailsView<'static>>) -> Self {
22225                StopDetailsOwnedView(inner)
22226            }
22227        }
22228        impl ::core::convert::From<StopDetailsOwnedView>
22229        for ::buffa::OwnedView<StopDetailsView<'static>> {
22230            fn from(wrapper: StopDetailsOwnedView) -> Self {
22231                wrapper.0
22232            }
22233        }
22234        impl ::core::convert::AsRef<::buffa::OwnedView<StopDetailsView<'static>>>
22235        for StopDetailsOwnedView {
22236            fn as_ref(&self) -> &::buffa::OwnedView<StopDetailsView<'static>> {
22237                &self.0
22238            }
22239        }
22240        impl ::buffa::HasMessageView for super::super::StopDetails {
22241            type View<'a> = StopDetailsView<'a>;
22242            type ViewHandle = StopDetailsOwnedView;
22243        }
22244        impl ::serde::Serialize for StopDetailsOwnedView {
22245            fn serialize<__S: ::serde::Serializer>(
22246                &self,
22247                __s: __S,
22248            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22249                ::serde::Serialize::serialize(&self.0, __s)
22250            }
22251        }
22252        /// TrailingDetails contains configuration and runtime state for TRAILING_STOP
22253        /// triggers.
22254        #[derive(Clone, Debug, Default)]
22255        pub struct TrailingDetailsView<'a> {
22256            /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
22257            ///
22258            /// Field 1: `trailing_distance_ticks`
22259            pub trailing_distance_ticks: i64,
22260            /// Optional activation price: trailing only starts after this price is
22261            /// reached. Expressed in quote units scaled by 1e6.
22262            ///
22263            /// Field 2: `activation_price_ticks`
22264            pub activation_price_ticks: i64,
22265            /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
22266            ///
22267            /// Field 3: `peak_price_ticks`
22268            pub peak_price_ticks: i64,
22269            /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
22270            ///
22271            /// Field 4: `trough_price_ticks`
22272            pub trough_price_ticks: i64,
22273            /// Trailing distance in basis points (1 bp = 0.01%).
22274            ///
22275            /// Field 5: `trailing_distance_bps`
22276            pub trailing_distance_bps: i32,
22277            /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
22278            ///
22279            /// Field 6: `max_slippage_ticks`
22280            pub max_slippage_ticks: i32,
22281            /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
22282            ///
22283            /// Field 7: `max_slippage_bps`
22284            pub max_slippage_bps: i32,
22285            /// Price source used for trigger evaluation. Fixed for the lifetime of the
22286            /// trigger and exposed for completeness.
22287            ///
22288            /// Field 8: `trigger_price_source`
22289            pub trigger_price_source: ::buffa::EnumValue<
22290                super::super::super::super::orders::v1::TriggerPriceSource,
22291            >,
22292            /// Direction the price must cross to fire the trigger. Fixed for the lifetime
22293            /// of the trigger and exposed for completeness.
22294            ///
22295            /// Field 9: `trigger_direction`
22296            pub trigger_direction: ::buffa::EnumValue<
22297                super::super::super::super::orders::v1::TriggerDirection,
22298            >,
22299            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22300        }
22301        impl<'a> ::buffa::MessageView<'a> for TrailingDetailsView<'a> {
22302            type Owned = super::super::TrailingDetails;
22303            fn decode_view(
22304                buf: &'a [u8],
22305            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22306                let __limit = ::core::cell::Cell::new(
22307                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
22308                );
22309                <Self as ::buffa::MessageView>::decode_view_ctx(
22310                    buf,
22311                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
22312                )
22313            }
22314            fn decode_view_with_ctx(
22315                buf: &'a [u8],
22316                ctx: ::buffa::DecodeContext<'_>,
22317            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22318                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
22319            }
22320            fn merge_view_field(
22321                &mut self,
22322                tag: ::buffa::encoding::Tag,
22323                cur: &'a [u8],
22324                before_tag: &'a [u8],
22325                ctx: ::buffa::DecodeContext<'_>,
22326            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
22327                let _ = ctx;
22328                #[allow(unused_variables)]
22329                let view = self;
22330                let mut cur = cur;
22331                match tag.field_number() {
22332                    1u32 => {
22333                        ::buffa::encoding::check_wire_type(
22334                            tag,
22335                            ::buffa::encoding::WireType::Varint,
22336                        )?;
22337                        view.trailing_distance_ticks = ::buffa::types::decode_int64(
22338                            &mut cur,
22339                        )?;
22340                    }
22341                    2u32 => {
22342                        ::buffa::encoding::check_wire_type(
22343                            tag,
22344                            ::buffa::encoding::WireType::Varint,
22345                        )?;
22346                        view.activation_price_ticks = ::buffa::types::decode_int64(
22347                            &mut cur,
22348                        )?;
22349                    }
22350                    3u32 => {
22351                        ::buffa::encoding::check_wire_type(
22352                            tag,
22353                            ::buffa::encoding::WireType::Varint,
22354                        )?;
22355                        view.peak_price_ticks = ::buffa::types::decode_int64(&mut cur)?;
22356                    }
22357                    4u32 => {
22358                        ::buffa::encoding::check_wire_type(
22359                            tag,
22360                            ::buffa::encoding::WireType::Varint,
22361                        )?;
22362                        view.trough_price_ticks = ::buffa::types::decode_int64(
22363                            &mut cur,
22364                        )?;
22365                    }
22366                    5u32 => {
22367                        ::buffa::encoding::check_wire_type(
22368                            tag,
22369                            ::buffa::encoding::WireType::Varint,
22370                        )?;
22371                        view.trailing_distance_bps = ::buffa::types::decode_int32(
22372                            &mut cur,
22373                        )?;
22374                    }
22375                    6u32 => {
22376                        ::buffa::encoding::check_wire_type(
22377                            tag,
22378                            ::buffa::encoding::WireType::Varint,
22379                        )?;
22380                        view.max_slippage_ticks = ::buffa::types::decode_int32(
22381                            &mut cur,
22382                        )?;
22383                    }
22384                    7u32 => {
22385                        ::buffa::encoding::check_wire_type(
22386                            tag,
22387                            ::buffa::encoding::WireType::Varint,
22388                        )?;
22389                        view.max_slippage_bps = ::buffa::types::decode_int32(&mut cur)?;
22390                    }
22391                    8u32 => {
22392                        ::buffa::encoding::check_wire_type(
22393                            tag,
22394                            ::buffa::encoding::WireType::Varint,
22395                        )?;
22396                        view.trigger_price_source = ::buffa::EnumValue::from(
22397                            ::buffa::types::decode_int32(&mut cur)?,
22398                        );
22399                    }
22400                    9u32 => {
22401                        ::buffa::encoding::check_wire_type(
22402                            tag,
22403                            ::buffa::encoding::WireType::Varint,
22404                        )?;
22405                        view.trigger_direction = ::buffa::EnumValue::from(
22406                            ::buffa::types::decode_int32(&mut cur)?,
22407                        );
22408                    }
22409                    _ => {
22410                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
22411                        let span_len = before_tag.len() - cur.len();
22412                        view.__buffa_unknown_fields
22413                            .push_record(before_tag, span_len, ctx)?;
22414                    }
22415                }
22416                ::core::result::Result::Ok(cur)
22417            }
22418            fn to_owned_message(
22419                &self,
22420            ) -> ::core::result::Result<
22421                super::super::TrailingDetails,
22422                ::buffa::DecodeError,
22423            > {
22424                self.to_owned_from_source(None)
22425            }
22426            #[allow(clippy::useless_conversion, clippy::needless_update)]
22427            fn to_owned_from_source(
22428                &self,
22429                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
22430            ) -> ::core::result::Result<
22431                super::super::TrailingDetails,
22432                ::buffa::DecodeError,
22433            > {
22434                #[allow(unused_imports)]
22435                use ::buffa::alloc::string::ToString as _;
22436                let _ = __buffa_src;
22437                ::core::result::Result::Ok(super::super::TrailingDetails {
22438                    trailing_distance_ticks: self.trailing_distance_ticks,
22439                    activation_price_ticks: self.activation_price_ticks,
22440                    peak_price_ticks: self.peak_price_ticks,
22441                    trough_price_ticks: self.trough_price_ticks,
22442                    trailing_distance_bps: self.trailing_distance_bps,
22443                    max_slippage_ticks: self.max_slippage_ticks,
22444                    max_slippage_bps: self.max_slippage_bps,
22445                    trigger_price_source: self.trigger_price_source,
22446                    trigger_direction: self.trigger_direction,
22447                    __buffa_unknown_fields: self
22448                        .__buffa_unknown_fields
22449                        .to_owned()?
22450                        .into(),
22451                    ..::core::default::Default::default()
22452                })
22453            }
22454        }
22455        impl<'a> ::buffa::ViewEncode<'a> for TrailingDetailsView<'a> {
22456            #[allow(clippy::needless_borrow, clippy::let_and_return)]
22457            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
22458                #[allow(unused_imports)]
22459                use ::buffa::Enumeration as _;
22460                let mut size = 0u32;
22461                if self.trailing_distance_ticks != 0i64 {
22462                    size
22463                        += 1u32
22464                            + ::buffa::types::int64_encoded_len(
22465                                self.trailing_distance_ticks,
22466                            ) as u32;
22467                }
22468                if self.activation_price_ticks != 0i64 {
22469                    size
22470                        += 1u32
22471                            + ::buffa::types::int64_encoded_len(
22472                                self.activation_price_ticks,
22473                            ) as u32;
22474                }
22475                if self.peak_price_ticks != 0i64 {
22476                    size
22477                        += 1u32
22478                            + ::buffa::types::int64_encoded_len(self.peak_price_ticks)
22479                                as u32;
22480                }
22481                if self.trough_price_ticks != 0i64 {
22482                    size
22483                        += 1u32
22484                            + ::buffa::types::int64_encoded_len(self.trough_price_ticks)
22485                                as u32;
22486                }
22487                if self.trailing_distance_bps != 0i32 {
22488                    size
22489                        += 1u32
22490                            + ::buffa::types::int32_encoded_len(
22491                                self.trailing_distance_bps,
22492                            ) as u32;
22493                }
22494                if self.max_slippage_ticks != 0i32 {
22495                    size
22496                        += 1u32
22497                            + ::buffa::types::int32_encoded_len(self.max_slippage_ticks)
22498                                as u32;
22499                }
22500                if self.max_slippage_bps != 0i32 {
22501                    size
22502                        += 1u32
22503                            + ::buffa::types::int32_encoded_len(self.max_slippage_bps)
22504                                as u32;
22505                }
22506                {
22507                    let val = self.trigger_price_source.to_i32();
22508                    if val != 0 {
22509                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22510                    }
22511                }
22512                {
22513                    let val = self.trigger_direction.to_i32();
22514                    if val != 0 {
22515                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22516                    }
22517                }
22518                size += self.__buffa_unknown_fields.encoded_len() as u32;
22519                size
22520            }
22521            #[allow(clippy::needless_borrow)]
22522            fn write_to(
22523                &self,
22524                _cache: &mut ::buffa::SizeCache,
22525                buf: &mut impl ::buffa::bytes::BufMut,
22526            ) {
22527                #[allow(unused_imports)]
22528                use ::buffa::Enumeration as _;
22529                if self.trailing_distance_ticks != 0i64 {
22530                    ::buffa::types::put_int64_field(
22531                        1u32,
22532                        self.trailing_distance_ticks,
22533                        buf,
22534                    );
22535                }
22536                if self.activation_price_ticks != 0i64 {
22537                    ::buffa::types::put_int64_field(
22538                        2u32,
22539                        self.activation_price_ticks,
22540                        buf,
22541                    );
22542                }
22543                if self.peak_price_ticks != 0i64 {
22544                    ::buffa::types::put_int64_field(3u32, self.peak_price_ticks, buf);
22545                }
22546                if self.trough_price_ticks != 0i64 {
22547                    ::buffa::types::put_int64_field(4u32, self.trough_price_ticks, buf);
22548                }
22549                if self.trailing_distance_bps != 0i32 {
22550                    ::buffa::types::put_int32_field(
22551                        5u32,
22552                        self.trailing_distance_bps,
22553                        buf,
22554                    );
22555                }
22556                if self.max_slippage_ticks != 0i32 {
22557                    ::buffa::types::put_int32_field(6u32, self.max_slippage_ticks, buf);
22558                }
22559                if self.max_slippage_bps != 0i32 {
22560                    ::buffa::types::put_int32_field(7u32, self.max_slippage_bps, buf);
22561                }
22562                {
22563                    let val = self.trigger_price_source.to_i32();
22564                    if val != 0 {
22565                        ::buffa::types::put_int32_field(8u32, val, buf);
22566                    }
22567                }
22568                {
22569                    let val = self.trigger_direction.to_i32();
22570                    if val != 0 {
22571                        ::buffa::types::put_int32_field(9u32, val, buf);
22572                    }
22573                }
22574                self.__buffa_unknown_fields.write_to(buf);
22575            }
22576        }
22577        /// Serializes this view as protobuf JSON.
22578        ///
22579        /// Implicit-presence fields with default values are omitted, `required`
22580        /// fields are always emitted, explicit-presence (`optional`) fields are
22581        /// emitted only when set, bytes fields are base64-encoded, and enum
22582        /// values are their proto name strings.
22583        ///
22584        /// This impl uses `serialize_map(None)` because the number of emitted
22585        /// fields depends on default-omission rules; serializers that require
22586        /// known map lengths (e.g. `bincode`) will return a runtime error.
22587        /// Use the owned message type for those formats.
22588        impl<'__a> ::serde::Serialize for TrailingDetailsView<'__a> {
22589            fn serialize<__S: ::serde::Serializer>(
22590                &self,
22591                __s: __S,
22592            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22593                use ::serde::ser::SerializeMap as _;
22594                let mut __map = __s.serialize_map(::core::option::Option::None)?;
22595                if !::buffa::json_helpers::skip_if::is_zero_i64(
22596                    &self.trailing_distance_ticks,
22597                ) {
22598                    __map
22599                        .serialize_entry(
22600                            "trailingDistanceTicks",
22601                            &::buffa::json_helpers::ProtoJson(
22602                                &self.trailing_distance_ticks,
22603                            ),
22604                        )?;
22605                }
22606                if !::buffa::json_helpers::skip_if::is_zero_i64(
22607                    &self.activation_price_ticks,
22608                ) {
22609                    __map
22610                        .serialize_entry(
22611                            "activationPriceTicks",
22612                            &::buffa::json_helpers::ProtoJson(
22613                                &self.activation_price_ticks,
22614                            ),
22615                        )?;
22616                }
22617                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.peak_price_ticks) {
22618                    __map
22619                        .serialize_entry(
22620                            "peakPriceTicks",
22621                            &::buffa::json_helpers::ProtoJson(&self.peak_price_ticks),
22622                        )?;
22623                }
22624                if !::buffa::json_helpers::skip_if::is_zero_i64(
22625                    &self.trough_price_ticks,
22626                ) {
22627                    __map
22628                        .serialize_entry(
22629                            "troughPriceTicks",
22630                            &::buffa::json_helpers::ProtoJson(&self.trough_price_ticks),
22631                        )?;
22632                }
22633                if !::buffa::json_helpers::skip_if::is_zero_i32(
22634                    &self.trailing_distance_bps,
22635                ) {
22636                    __map
22637                        .serialize_entry(
22638                            "trailingDistanceBps",
22639                            &::buffa::json_helpers::ProtoJson(
22640                                &self.trailing_distance_bps,
22641                            ),
22642                        )?;
22643                }
22644                if !::buffa::json_helpers::skip_if::is_zero_i32(
22645                    &self.max_slippage_ticks,
22646                ) {
22647                    __map
22648                        .serialize_entry(
22649                            "maxSlippageTicks",
22650                            &::buffa::json_helpers::ProtoJson(&self.max_slippage_ticks),
22651                        )?;
22652                }
22653                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.max_slippage_bps) {
22654                    __map
22655                        .serialize_entry(
22656                            "maxSlippageBps",
22657                            &::buffa::json_helpers::ProtoJson(&self.max_slippage_bps),
22658                        )?;
22659                }
22660                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22661                    &self.trigger_price_source,
22662                ) {
22663                    __map
22664                        .serialize_entry(
22665                            "triggerPriceSource",
22666                            &self.trigger_price_source,
22667                        )?;
22668                }
22669                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22670                    &self.trigger_direction,
22671                ) {
22672                    __map.serialize_entry("triggerDirection", &self.trigger_direction)?;
22673                }
22674                __map.end()
22675            }
22676        }
22677        impl<'a> ::buffa::MessageName for TrailingDetailsView<'a> {
22678            const PACKAGE: &'static str = "triggers.v1";
22679            const NAME: &'static str = "TrailingDetails";
22680            const FULL_NAME: &'static str = "triggers.v1.TrailingDetails";
22681            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
22682        }
22683        ::buffa::impl_default_view_instance!(TrailingDetailsView);
22684        ::buffa::impl_view_reborrow!(TrailingDetailsView);
22685        /** Self-contained, `'static` owned view of a `TrailingDetails` message.
22686
22687 Wraps [`::buffa::OwnedView`]`<`[`TrailingDetailsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
22688
22689 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TrailingDetailsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
22690        #[derive(Clone, Debug)]
22691        pub struct TrailingDetailsOwnedView(
22692            ::buffa::OwnedView<TrailingDetailsView<'static>>,
22693        );
22694        impl TrailingDetailsOwnedView {
22695            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
22696            ///
22697            /// The view borrows directly from the buffer's data; the buffer is
22698            /// retained inside the returned handle.
22699            ///
22700            /// # Errors
22701            ///
22702            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
22703            /// protobuf data.
22704            pub fn decode(
22705                bytes: ::buffa::bytes::Bytes,
22706            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22707                ::core::result::Result::Ok(
22708                    TrailingDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
22709                )
22710            }
22711            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
22712            /// max message size).
22713            ///
22714            /// # Errors
22715            ///
22716            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
22717            /// exceeds the configured limits.
22718            pub fn decode_with_options(
22719                bytes: ::buffa::bytes::Bytes,
22720                opts: &::buffa::DecodeOptions,
22721            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22722                ::core::result::Result::Ok(
22723                    TrailingDetailsOwnedView(
22724                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
22725                    ),
22726                )
22727            }
22728            /// Build from an owned message via an encode → decode round-trip.
22729            ///
22730            /// # Errors
22731            ///
22732            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
22733            /// somehow invalid (should not happen for well-formed messages).
22734            pub fn from_owned(
22735                msg: &super::super::TrailingDetails,
22736            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22737                ::core::result::Result::Ok(
22738                    TrailingDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
22739                )
22740            }
22741            /// Borrow the full [`TrailingDetailsView`] with its lifetime tied to `&self`.
22742            #[must_use]
22743            pub fn view(&self) -> &TrailingDetailsView<'_> {
22744                self.0.reborrow()
22745            }
22746            /// Convert to the owned message type.
22747            ///
22748            /// # Errors
22749            ///
22750            /// Returns an error if re-materializing preserved unknown fields
22751            /// fails (e.g. the unknown-field limit is exceeded).
22752            pub fn to_owned_message(
22753                &self,
22754            ) -> ::core::result::Result<
22755                super::super::TrailingDetails,
22756                ::buffa::DecodeError,
22757            > {
22758                self.0.to_owned_message()
22759            }
22760            /// The underlying bytes buffer.
22761            #[must_use]
22762            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
22763                self.0.bytes()
22764            }
22765            /// Consume the handle, returning the underlying bytes buffer.
22766            #[must_use]
22767            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
22768                self.0.into_bytes()
22769            }
22770            /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
22771            ///
22772            /// Field 1: `trailing_distance_ticks`
22773            #[must_use]
22774            pub fn trailing_distance_ticks(&self) -> i64 {
22775                self.0.reborrow().trailing_distance_ticks
22776            }
22777            /// Optional activation price: trailing only starts after this price is
22778            /// reached. Expressed in quote units scaled by 1e6.
22779            ///
22780            /// Field 2: `activation_price_ticks`
22781            #[must_use]
22782            pub fn activation_price_ticks(&self) -> i64 {
22783                self.0.reborrow().activation_price_ticks
22784            }
22785            /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
22786            ///
22787            /// Field 3: `peak_price_ticks`
22788            #[must_use]
22789            pub fn peak_price_ticks(&self) -> i64 {
22790                self.0.reborrow().peak_price_ticks
22791            }
22792            /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
22793            ///
22794            /// Field 4: `trough_price_ticks`
22795            #[must_use]
22796            pub fn trough_price_ticks(&self) -> i64 {
22797                self.0.reborrow().trough_price_ticks
22798            }
22799            /// Trailing distance in basis points (1 bp = 0.01%).
22800            ///
22801            /// Field 5: `trailing_distance_bps`
22802            #[must_use]
22803            pub fn trailing_distance_bps(&self) -> i32 {
22804                self.0.reborrow().trailing_distance_bps
22805            }
22806            /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
22807            ///
22808            /// Field 6: `max_slippage_ticks`
22809            #[must_use]
22810            pub fn max_slippage_ticks(&self) -> i32 {
22811                self.0.reborrow().max_slippage_ticks
22812            }
22813            /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
22814            ///
22815            /// Field 7: `max_slippage_bps`
22816            #[must_use]
22817            pub fn max_slippage_bps(&self) -> i32 {
22818                self.0.reborrow().max_slippage_bps
22819            }
22820            /// Price source used for trigger evaluation. Fixed for the lifetime of the
22821            /// trigger and exposed for completeness.
22822            ///
22823            /// Field 8: `trigger_price_source`
22824            #[must_use]
22825            pub fn trigger_price_source(
22826                &self,
22827            ) -> ::buffa::EnumValue<
22828                super::super::super::super::orders::v1::TriggerPriceSource,
22829            > {
22830                self.0.reborrow().trigger_price_source
22831            }
22832            /// Direction the price must cross to fire the trigger. Fixed for the lifetime
22833            /// of the trigger and exposed for completeness.
22834            ///
22835            /// Field 9: `trigger_direction`
22836            #[must_use]
22837            pub fn trigger_direction(
22838                &self,
22839            ) -> ::buffa::EnumValue<
22840                super::super::super::super::orders::v1::TriggerDirection,
22841            > {
22842                self.0.reborrow().trigger_direction
22843            }
22844        }
22845        impl ::core::convert::From<::buffa::OwnedView<TrailingDetailsView<'static>>>
22846        for TrailingDetailsOwnedView {
22847            fn from(inner: ::buffa::OwnedView<TrailingDetailsView<'static>>) -> Self {
22848                TrailingDetailsOwnedView(inner)
22849            }
22850        }
22851        impl ::core::convert::From<TrailingDetailsOwnedView>
22852        for ::buffa::OwnedView<TrailingDetailsView<'static>> {
22853            fn from(wrapper: TrailingDetailsOwnedView) -> Self {
22854                wrapper.0
22855            }
22856        }
22857        impl ::core::convert::AsRef<::buffa::OwnedView<TrailingDetailsView<'static>>>
22858        for TrailingDetailsOwnedView {
22859            fn as_ref(&self) -> &::buffa::OwnedView<TrailingDetailsView<'static>> {
22860                &self.0
22861            }
22862        }
22863        impl ::buffa::HasMessageView for super::super::TrailingDetails {
22864            type View<'a> = TrailingDetailsView<'a>;
22865            type ViewHandle = TrailingDetailsOwnedView;
22866        }
22867        impl ::serde::Serialize for TrailingDetailsOwnedView {
22868            fn serialize<__S: ::serde::Serializer>(
22869                &self,
22870                __s: __S,
22871            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22872                ::serde::Serialize::serialize(&self.0, __s)
22873            }
22874        }
22875        /// TwapDetails contains configuration and runtime state for TWAP triggers.
22876        #[derive(Clone, Debug, Default)]
22877        pub struct TwapDetailsView<'a> {
22878            /// Total duration of TWAP execution in milliseconds.
22879            ///
22880            /// Field 1: `twap_duration_ms`
22881            pub twap_duration_ms: i64,
22882            /// Interval between TWAP slices in milliseconds.
22883            ///
22884            /// Field 2: `twap_slice_interval_ms`
22885            pub twap_slice_interval_ms: i64,
22886            /// Current slice index, zero-based.
22887            ///
22888            /// Field 4: `slice_idx`
22889            pub slice_idx: i32,
22890            /// Total number of planned slices.
22891            ///
22892            /// Field 5: `slice_count`
22893            pub slice_count: i32,
22894            /// Cumulative executed quantity scaled by the pair's base_quantity_scale from
22895            /// GetSpotConfig.
22896            ///
22897            /// Field 6: `executed_qty_scaled`
22898            pub executed_qty_scaled: i64,
22899            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22900        }
22901        impl<'a> ::buffa::MessageView<'a> for TwapDetailsView<'a> {
22902            type Owned = super::super::TwapDetails;
22903            fn decode_view(
22904                buf: &'a [u8],
22905            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22906                let __limit = ::core::cell::Cell::new(
22907                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
22908                );
22909                <Self as ::buffa::MessageView>::decode_view_ctx(
22910                    buf,
22911                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
22912                )
22913            }
22914            fn decode_view_with_ctx(
22915                buf: &'a [u8],
22916                ctx: ::buffa::DecodeContext<'_>,
22917            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22918                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
22919            }
22920            fn merge_view_field(
22921                &mut self,
22922                tag: ::buffa::encoding::Tag,
22923                cur: &'a [u8],
22924                before_tag: &'a [u8],
22925                ctx: ::buffa::DecodeContext<'_>,
22926            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
22927                let _ = ctx;
22928                #[allow(unused_variables)]
22929                let view = self;
22930                let mut cur = cur;
22931                match tag.field_number() {
22932                    1u32 => {
22933                        ::buffa::encoding::check_wire_type(
22934                            tag,
22935                            ::buffa::encoding::WireType::Varint,
22936                        )?;
22937                        view.twap_duration_ms = ::buffa::types::decode_int64(&mut cur)?;
22938                    }
22939                    2u32 => {
22940                        ::buffa::encoding::check_wire_type(
22941                            tag,
22942                            ::buffa::encoding::WireType::Varint,
22943                        )?;
22944                        view.twap_slice_interval_ms = ::buffa::types::decode_int64(
22945                            &mut cur,
22946                        )?;
22947                    }
22948                    4u32 => {
22949                        ::buffa::encoding::check_wire_type(
22950                            tag,
22951                            ::buffa::encoding::WireType::Varint,
22952                        )?;
22953                        view.slice_idx = ::buffa::types::decode_int32(&mut cur)?;
22954                    }
22955                    5u32 => {
22956                        ::buffa::encoding::check_wire_type(
22957                            tag,
22958                            ::buffa::encoding::WireType::Varint,
22959                        )?;
22960                        view.slice_count = ::buffa::types::decode_int32(&mut cur)?;
22961                    }
22962                    6u32 => {
22963                        ::buffa::encoding::check_wire_type(
22964                            tag,
22965                            ::buffa::encoding::WireType::Varint,
22966                        )?;
22967                        view.executed_qty_scaled = ::buffa::types::decode_int64(
22968                            &mut cur,
22969                        )?;
22970                    }
22971                    _ => {
22972                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
22973                        let span_len = before_tag.len() - cur.len();
22974                        view.__buffa_unknown_fields
22975                            .push_record(before_tag, span_len, ctx)?;
22976                    }
22977                }
22978                ::core::result::Result::Ok(cur)
22979            }
22980            fn to_owned_message(
22981                &self,
22982            ) -> ::core::result::Result<
22983                super::super::TwapDetails,
22984                ::buffa::DecodeError,
22985            > {
22986                self.to_owned_from_source(None)
22987            }
22988            #[allow(clippy::useless_conversion, clippy::needless_update)]
22989            fn to_owned_from_source(
22990                &self,
22991                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
22992            ) -> ::core::result::Result<
22993                super::super::TwapDetails,
22994                ::buffa::DecodeError,
22995            > {
22996                #[allow(unused_imports)]
22997                use ::buffa::alloc::string::ToString as _;
22998                let _ = __buffa_src;
22999                ::core::result::Result::Ok(super::super::TwapDetails {
23000                    twap_duration_ms: self.twap_duration_ms,
23001                    twap_slice_interval_ms: self.twap_slice_interval_ms,
23002                    slice_idx: self.slice_idx,
23003                    slice_count: self.slice_count,
23004                    executed_qty_scaled: self.executed_qty_scaled,
23005                    __buffa_unknown_fields: self
23006                        .__buffa_unknown_fields
23007                        .to_owned()?
23008                        .into(),
23009                    ..::core::default::Default::default()
23010                })
23011            }
23012        }
23013        impl<'a> ::buffa::ViewEncode<'a> for TwapDetailsView<'a> {
23014            #[allow(clippy::needless_borrow, clippy::let_and_return)]
23015            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
23016                #[allow(unused_imports)]
23017                use ::buffa::Enumeration as _;
23018                let mut size = 0u32;
23019                if self.twap_duration_ms != 0i64 {
23020                    size
23021                        += 1u32
23022                            + ::buffa::types::int64_encoded_len(self.twap_duration_ms)
23023                                as u32;
23024                }
23025                if self.twap_slice_interval_ms != 0i64 {
23026                    size
23027                        += 1u32
23028                            + ::buffa::types::int64_encoded_len(
23029                                self.twap_slice_interval_ms,
23030                            ) as u32;
23031                }
23032                if self.slice_idx != 0i32 {
23033                    size
23034                        += 1u32
23035                            + ::buffa::types::int32_encoded_len(self.slice_idx) as u32;
23036                }
23037                if self.slice_count != 0i32 {
23038                    size
23039                        += 1u32
23040                            + ::buffa::types::int32_encoded_len(self.slice_count) as u32;
23041                }
23042                if self.executed_qty_scaled != 0i64 {
23043                    size
23044                        += 1u32
23045                            + ::buffa::types::int64_encoded_len(self.executed_qty_scaled)
23046                                as u32;
23047                }
23048                size += self.__buffa_unknown_fields.encoded_len() as u32;
23049                size
23050            }
23051            #[allow(clippy::needless_borrow)]
23052            fn write_to(
23053                &self,
23054                _cache: &mut ::buffa::SizeCache,
23055                buf: &mut impl ::buffa::bytes::BufMut,
23056            ) {
23057                #[allow(unused_imports)]
23058                use ::buffa::Enumeration as _;
23059                if self.twap_duration_ms != 0i64 {
23060                    ::buffa::types::put_int64_field(1u32, self.twap_duration_ms, buf);
23061                }
23062                if self.twap_slice_interval_ms != 0i64 {
23063                    ::buffa::types::put_int64_field(
23064                        2u32,
23065                        self.twap_slice_interval_ms,
23066                        buf,
23067                    );
23068                }
23069                if self.slice_idx != 0i32 {
23070                    ::buffa::types::put_int32_field(4u32, self.slice_idx, buf);
23071                }
23072                if self.slice_count != 0i32 {
23073                    ::buffa::types::put_int32_field(5u32, self.slice_count, buf);
23074                }
23075                if self.executed_qty_scaled != 0i64 {
23076                    ::buffa::types::put_int64_field(6u32, self.executed_qty_scaled, buf);
23077                }
23078                self.__buffa_unknown_fields.write_to(buf);
23079            }
23080        }
23081        /// Serializes this view as protobuf JSON.
23082        ///
23083        /// Implicit-presence fields with default values are omitted, `required`
23084        /// fields are always emitted, explicit-presence (`optional`) fields are
23085        /// emitted only when set, bytes fields are base64-encoded, and enum
23086        /// values are their proto name strings.
23087        ///
23088        /// This impl uses `serialize_map(None)` because the number of emitted
23089        /// fields depends on default-omission rules; serializers that require
23090        /// known map lengths (e.g. `bincode`) will return a runtime error.
23091        /// Use the owned message type for those formats.
23092        impl<'__a> ::serde::Serialize for TwapDetailsView<'__a> {
23093            fn serialize<__S: ::serde::Serializer>(
23094                &self,
23095                __s: __S,
23096            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23097                use ::serde::ser::SerializeMap as _;
23098                let mut __map = __s.serialize_map(::core::option::Option::None)?;
23099                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.twap_duration_ms) {
23100                    __map
23101                        .serialize_entry(
23102                            "twapDurationMs",
23103                            &::buffa::json_helpers::ProtoJson(&self.twap_duration_ms),
23104                        )?;
23105                }
23106                if !::buffa::json_helpers::skip_if::is_zero_i64(
23107                    &self.twap_slice_interval_ms,
23108                ) {
23109                    __map
23110                        .serialize_entry(
23111                            "twapSliceIntervalMs",
23112                            &::buffa::json_helpers::ProtoJson(
23113                                &self.twap_slice_interval_ms,
23114                            ),
23115                        )?;
23116                }
23117                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.slice_idx) {
23118                    __map
23119                        .serialize_entry(
23120                            "sliceIdx",
23121                            &::buffa::json_helpers::ProtoJson(&self.slice_idx),
23122                        )?;
23123                }
23124                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.slice_count) {
23125                    __map
23126                        .serialize_entry(
23127                            "sliceCount",
23128                            &::buffa::json_helpers::ProtoJson(&self.slice_count),
23129                        )?;
23130                }
23131                if !::buffa::json_helpers::skip_if::is_zero_i64(
23132                    &self.executed_qty_scaled,
23133                ) {
23134                    __map
23135                        .serialize_entry(
23136                            "executedQtyScaled",
23137                            &::buffa::json_helpers::ProtoJson(&self.executed_qty_scaled),
23138                        )?;
23139                }
23140                __map.end()
23141            }
23142        }
23143        impl<'a> ::buffa::MessageName for TwapDetailsView<'a> {
23144            const PACKAGE: &'static str = "triggers.v1";
23145            const NAME: &'static str = "TwapDetails";
23146            const FULL_NAME: &'static str = "triggers.v1.TwapDetails";
23147            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
23148        }
23149        ::buffa::impl_default_view_instance!(TwapDetailsView);
23150        ::buffa::impl_view_reborrow!(TwapDetailsView);
23151        /** Self-contained, `'static` owned view of a `TwapDetails` message.
23152
23153 Wraps [`::buffa::OwnedView`]`<`[`TwapDetailsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
23154
23155 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TwapDetailsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
23156        #[derive(Clone, Debug)]
23157        pub struct TwapDetailsOwnedView(::buffa::OwnedView<TwapDetailsView<'static>>);
23158        impl TwapDetailsOwnedView {
23159            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
23160            ///
23161            /// The view borrows directly from the buffer's data; the buffer is
23162            /// retained inside the returned handle.
23163            ///
23164            /// # Errors
23165            ///
23166            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
23167            /// protobuf data.
23168            pub fn decode(
23169                bytes: ::buffa::bytes::Bytes,
23170            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23171                ::core::result::Result::Ok(
23172                    TwapDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
23173                )
23174            }
23175            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
23176            /// max message size).
23177            ///
23178            /// # Errors
23179            ///
23180            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
23181            /// exceeds the configured limits.
23182            pub fn decode_with_options(
23183                bytes: ::buffa::bytes::Bytes,
23184                opts: &::buffa::DecodeOptions,
23185            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23186                ::core::result::Result::Ok(
23187                    TwapDetailsOwnedView(
23188                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
23189                    ),
23190                )
23191            }
23192            /// Build from an owned message via an encode → decode round-trip.
23193            ///
23194            /// # Errors
23195            ///
23196            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
23197            /// somehow invalid (should not happen for well-formed messages).
23198            pub fn from_owned(
23199                msg: &super::super::TwapDetails,
23200            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23201                ::core::result::Result::Ok(
23202                    TwapDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
23203                )
23204            }
23205            /// Borrow the full [`TwapDetailsView`] with its lifetime tied to `&self`.
23206            #[must_use]
23207            pub fn view(&self) -> &TwapDetailsView<'_> {
23208                self.0.reborrow()
23209            }
23210            /// Convert to the owned message type.
23211            ///
23212            /// # Errors
23213            ///
23214            /// Returns an error if re-materializing preserved unknown fields
23215            /// fails (e.g. the unknown-field limit is exceeded).
23216            pub fn to_owned_message(
23217                &self,
23218            ) -> ::core::result::Result<
23219                super::super::TwapDetails,
23220                ::buffa::DecodeError,
23221            > {
23222                self.0.to_owned_message()
23223            }
23224            /// The underlying bytes buffer.
23225            #[must_use]
23226            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
23227                self.0.bytes()
23228            }
23229            /// Consume the handle, returning the underlying bytes buffer.
23230            #[must_use]
23231            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
23232                self.0.into_bytes()
23233            }
23234            /// Total duration of TWAP execution in milliseconds.
23235            ///
23236            /// Field 1: `twap_duration_ms`
23237            #[must_use]
23238            pub fn twap_duration_ms(&self) -> i64 {
23239                self.0.reborrow().twap_duration_ms
23240            }
23241            /// Interval between TWAP slices in milliseconds.
23242            ///
23243            /// Field 2: `twap_slice_interval_ms`
23244            #[must_use]
23245            pub fn twap_slice_interval_ms(&self) -> i64 {
23246                self.0.reborrow().twap_slice_interval_ms
23247            }
23248            /// Current slice index, zero-based.
23249            ///
23250            /// Field 4: `slice_idx`
23251            #[must_use]
23252            pub fn slice_idx(&self) -> i32 {
23253                self.0.reborrow().slice_idx
23254            }
23255            /// Total number of planned slices.
23256            ///
23257            /// Field 5: `slice_count`
23258            #[must_use]
23259            pub fn slice_count(&self) -> i32 {
23260                self.0.reborrow().slice_count
23261            }
23262            /// Cumulative executed quantity scaled by the pair's base_quantity_scale from
23263            /// GetSpotConfig.
23264            ///
23265            /// Field 6: `executed_qty_scaled`
23266            #[must_use]
23267            pub fn executed_qty_scaled(&self) -> i64 {
23268                self.0.reborrow().executed_qty_scaled
23269            }
23270        }
23271        impl ::core::convert::From<::buffa::OwnedView<TwapDetailsView<'static>>>
23272        for TwapDetailsOwnedView {
23273            fn from(inner: ::buffa::OwnedView<TwapDetailsView<'static>>) -> Self {
23274                TwapDetailsOwnedView(inner)
23275            }
23276        }
23277        impl ::core::convert::From<TwapDetailsOwnedView>
23278        for ::buffa::OwnedView<TwapDetailsView<'static>> {
23279            fn from(wrapper: TwapDetailsOwnedView) -> Self {
23280                wrapper.0
23281            }
23282        }
23283        impl ::core::convert::AsRef<::buffa::OwnedView<TwapDetailsView<'static>>>
23284        for TwapDetailsOwnedView {
23285            fn as_ref(&self) -> &::buffa::OwnedView<TwapDetailsView<'static>> {
23286                &self.0
23287            }
23288        }
23289        impl ::buffa::HasMessageView for super::super::TwapDetails {
23290            type View<'a> = TwapDetailsView<'a>;
23291            type ViewHandle = TwapDetailsOwnedView;
23292        }
23293        impl ::serde::Serialize for TwapDetailsOwnedView {
23294            fn serialize<__S: ::serde::Serializer>(
23295                &self,
23296                __s: __S,
23297            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23298                ::serde::Serialize::serialize(&self.0, __s)
23299            }
23300        }
23301        /// LadderDetails contains configuration for LADDER triggers.
23302        #[derive(Clone, Debug, Default)]
23303        pub struct LadderDetailsView<'a> {
23304            /// Minimum price in quote units scaled by 1e6 for the ladder range.
23305            ///
23306            /// Field 1: `ladder_price_min_ticks`
23307            pub ladder_price_min_ticks: i64,
23308            /// Maximum price in quote units scaled by 1e6 for the ladder range.
23309            ///
23310            /// Field 2: `ladder_price_max_ticks`
23311            pub ladder_price_max_ticks: i64,
23312            /// Number of price levels in the ladder.
23313            ///
23314            /// Field 3: `ladder_levels`
23315            pub ladder_levels: i32,
23316            /// Quantity distribution across ladder levels.
23317            ///
23318            /// Field 4: `ladder_distribution`
23319            pub ladder_distribution: ::buffa::EnumValue<
23320                super::super::LadderDistribution,
23321            >,
23322            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
23323        }
23324        impl<'a> ::buffa::MessageView<'a> for LadderDetailsView<'a> {
23325            type Owned = super::super::LadderDetails;
23326            fn decode_view(
23327                buf: &'a [u8],
23328            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23329                let __limit = ::core::cell::Cell::new(
23330                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23331                );
23332                <Self as ::buffa::MessageView>::decode_view_ctx(
23333                    buf,
23334                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23335                )
23336            }
23337            fn decode_view_with_ctx(
23338                buf: &'a [u8],
23339                ctx: ::buffa::DecodeContext<'_>,
23340            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23341                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23342            }
23343            fn merge_view_field(
23344                &mut self,
23345                tag: ::buffa::encoding::Tag,
23346                cur: &'a [u8],
23347                before_tag: &'a [u8],
23348                ctx: ::buffa::DecodeContext<'_>,
23349            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23350                let _ = ctx;
23351                #[allow(unused_variables)]
23352                let view = self;
23353                let mut cur = cur;
23354                match tag.field_number() {
23355                    1u32 => {
23356                        ::buffa::encoding::check_wire_type(
23357                            tag,
23358                            ::buffa::encoding::WireType::Varint,
23359                        )?;
23360                        view.ladder_price_min_ticks = ::buffa::types::decode_int64(
23361                            &mut cur,
23362                        )?;
23363                    }
23364                    2u32 => {
23365                        ::buffa::encoding::check_wire_type(
23366                            tag,
23367                            ::buffa::encoding::WireType::Varint,
23368                        )?;
23369                        view.ladder_price_max_ticks = ::buffa::types::decode_int64(
23370                            &mut cur,
23371                        )?;
23372                    }
23373                    3u32 => {
23374                        ::buffa::encoding::check_wire_type(
23375                            tag,
23376                            ::buffa::encoding::WireType::Varint,
23377                        )?;
23378                        view.ladder_levels = ::buffa::types::decode_int32(&mut cur)?;
23379                    }
23380                    4u32 => {
23381                        ::buffa::encoding::check_wire_type(
23382                            tag,
23383                            ::buffa::encoding::WireType::Varint,
23384                        )?;
23385                        view.ladder_distribution = ::buffa::EnumValue::from(
23386                            ::buffa::types::decode_int32(&mut cur)?,
23387                        );
23388                    }
23389                    _ => {
23390                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
23391                        let span_len = before_tag.len() - cur.len();
23392                        view.__buffa_unknown_fields
23393                            .push_record(before_tag, span_len, ctx)?;
23394                    }
23395                }
23396                ::core::result::Result::Ok(cur)
23397            }
23398            fn to_owned_message(
23399                &self,
23400            ) -> ::core::result::Result<
23401                super::super::LadderDetails,
23402                ::buffa::DecodeError,
23403            > {
23404                self.to_owned_from_source(None)
23405            }
23406            #[allow(clippy::useless_conversion, clippy::needless_update)]
23407            fn to_owned_from_source(
23408                &self,
23409                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
23410            ) -> ::core::result::Result<
23411                super::super::LadderDetails,
23412                ::buffa::DecodeError,
23413            > {
23414                #[allow(unused_imports)]
23415                use ::buffa::alloc::string::ToString as _;
23416                let _ = __buffa_src;
23417                ::core::result::Result::Ok(super::super::LadderDetails {
23418                    ladder_price_min_ticks: self.ladder_price_min_ticks,
23419                    ladder_price_max_ticks: self.ladder_price_max_ticks,
23420                    ladder_levels: self.ladder_levels,
23421                    ladder_distribution: self.ladder_distribution,
23422                    __buffa_unknown_fields: self
23423                        .__buffa_unknown_fields
23424                        .to_owned()?
23425                        .into(),
23426                    ..::core::default::Default::default()
23427                })
23428            }
23429        }
23430        impl<'a> ::buffa::ViewEncode<'a> for LadderDetailsView<'a> {
23431            #[allow(clippy::needless_borrow, clippy::let_and_return)]
23432            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
23433                #[allow(unused_imports)]
23434                use ::buffa::Enumeration as _;
23435                let mut size = 0u32;
23436                if self.ladder_price_min_ticks != 0i64 {
23437                    size
23438                        += 1u32
23439                            + ::buffa::types::int64_encoded_len(
23440                                self.ladder_price_min_ticks,
23441                            ) as u32;
23442                }
23443                if self.ladder_price_max_ticks != 0i64 {
23444                    size
23445                        += 1u32
23446                            + ::buffa::types::int64_encoded_len(
23447                                self.ladder_price_max_ticks,
23448                            ) as u32;
23449                }
23450                if self.ladder_levels != 0i32 {
23451                    size
23452                        += 1u32
23453                            + ::buffa::types::int32_encoded_len(self.ladder_levels)
23454                                as u32;
23455                }
23456                {
23457                    let val = self.ladder_distribution.to_i32();
23458                    if val != 0 {
23459                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
23460                    }
23461                }
23462                size += self.__buffa_unknown_fields.encoded_len() as u32;
23463                size
23464            }
23465            #[allow(clippy::needless_borrow)]
23466            fn write_to(
23467                &self,
23468                _cache: &mut ::buffa::SizeCache,
23469                buf: &mut impl ::buffa::bytes::BufMut,
23470            ) {
23471                #[allow(unused_imports)]
23472                use ::buffa::Enumeration as _;
23473                if self.ladder_price_min_ticks != 0i64 {
23474                    ::buffa::types::put_int64_field(
23475                        1u32,
23476                        self.ladder_price_min_ticks,
23477                        buf,
23478                    );
23479                }
23480                if self.ladder_price_max_ticks != 0i64 {
23481                    ::buffa::types::put_int64_field(
23482                        2u32,
23483                        self.ladder_price_max_ticks,
23484                        buf,
23485                    );
23486                }
23487                if self.ladder_levels != 0i32 {
23488                    ::buffa::types::put_int32_field(3u32, self.ladder_levels, buf);
23489                }
23490                {
23491                    let val = self.ladder_distribution.to_i32();
23492                    if val != 0 {
23493                        ::buffa::types::put_int32_field(4u32, val, buf);
23494                    }
23495                }
23496                self.__buffa_unknown_fields.write_to(buf);
23497            }
23498        }
23499        /// Serializes this view as protobuf JSON.
23500        ///
23501        /// Implicit-presence fields with default values are omitted, `required`
23502        /// fields are always emitted, explicit-presence (`optional`) fields are
23503        /// emitted only when set, bytes fields are base64-encoded, and enum
23504        /// values are their proto name strings.
23505        ///
23506        /// This impl uses `serialize_map(None)` because the number of emitted
23507        /// fields depends on default-omission rules; serializers that require
23508        /// known map lengths (e.g. `bincode`) will return a runtime error.
23509        /// Use the owned message type for those formats.
23510        impl<'__a> ::serde::Serialize for LadderDetailsView<'__a> {
23511            fn serialize<__S: ::serde::Serializer>(
23512                &self,
23513                __s: __S,
23514            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23515                use ::serde::ser::SerializeMap as _;
23516                let mut __map = __s.serialize_map(::core::option::Option::None)?;
23517                if !::buffa::json_helpers::skip_if::is_zero_i64(
23518                    &self.ladder_price_min_ticks,
23519                ) {
23520                    __map
23521                        .serialize_entry(
23522                            "ladderPriceMinTicks",
23523                            &::buffa::json_helpers::ProtoJson(
23524                                &self.ladder_price_min_ticks,
23525                            ),
23526                        )?;
23527                }
23528                if !::buffa::json_helpers::skip_if::is_zero_i64(
23529                    &self.ladder_price_max_ticks,
23530                ) {
23531                    __map
23532                        .serialize_entry(
23533                            "ladderPriceMaxTicks",
23534                            &::buffa::json_helpers::ProtoJson(
23535                                &self.ladder_price_max_ticks,
23536                            ),
23537                        )?;
23538                }
23539                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.ladder_levels) {
23540                    __map
23541                        .serialize_entry(
23542                            "ladderLevels",
23543                            &::buffa::json_helpers::ProtoJson(&self.ladder_levels),
23544                        )?;
23545                }
23546                if !::buffa::json_helpers::skip_if::is_default_enum_value(
23547                    &self.ladder_distribution,
23548                ) {
23549                    __map
23550                        .serialize_entry(
23551                            "ladderDistribution",
23552                            &self.ladder_distribution,
23553                        )?;
23554                }
23555                __map.end()
23556            }
23557        }
23558        impl<'a> ::buffa::MessageName for LadderDetailsView<'a> {
23559            const PACKAGE: &'static str = "triggers.v1";
23560            const NAME: &'static str = "LadderDetails";
23561            const FULL_NAME: &'static str = "triggers.v1.LadderDetails";
23562            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
23563        }
23564        ::buffa::impl_default_view_instance!(LadderDetailsView);
23565        ::buffa::impl_view_reborrow!(LadderDetailsView);
23566        /** Self-contained, `'static` owned view of a `LadderDetails` message.
23567
23568 Wraps [`::buffa::OwnedView`]`<`[`LadderDetailsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
23569
23570 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`LadderDetailsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
23571        #[derive(Clone, Debug)]
23572        pub struct LadderDetailsOwnedView(
23573            ::buffa::OwnedView<LadderDetailsView<'static>>,
23574        );
23575        impl LadderDetailsOwnedView {
23576            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
23577            ///
23578            /// The view borrows directly from the buffer's data; the buffer is
23579            /// retained inside the returned handle.
23580            ///
23581            /// # Errors
23582            ///
23583            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
23584            /// protobuf data.
23585            pub fn decode(
23586                bytes: ::buffa::bytes::Bytes,
23587            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23588                ::core::result::Result::Ok(
23589                    LadderDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
23590                )
23591            }
23592            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
23593            /// max message size).
23594            ///
23595            /// # Errors
23596            ///
23597            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
23598            /// exceeds the configured limits.
23599            pub fn decode_with_options(
23600                bytes: ::buffa::bytes::Bytes,
23601                opts: &::buffa::DecodeOptions,
23602            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23603                ::core::result::Result::Ok(
23604                    LadderDetailsOwnedView(
23605                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
23606                    ),
23607                )
23608            }
23609            /// Build from an owned message via an encode → decode round-trip.
23610            ///
23611            /// # Errors
23612            ///
23613            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
23614            /// somehow invalid (should not happen for well-formed messages).
23615            pub fn from_owned(
23616                msg: &super::super::LadderDetails,
23617            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23618                ::core::result::Result::Ok(
23619                    LadderDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
23620                )
23621            }
23622            /// Borrow the full [`LadderDetailsView`] with its lifetime tied to `&self`.
23623            #[must_use]
23624            pub fn view(&self) -> &LadderDetailsView<'_> {
23625                self.0.reborrow()
23626            }
23627            /// Convert to the owned message type.
23628            ///
23629            /// # Errors
23630            ///
23631            /// Returns an error if re-materializing preserved unknown fields
23632            /// fails (e.g. the unknown-field limit is exceeded).
23633            pub fn to_owned_message(
23634                &self,
23635            ) -> ::core::result::Result<
23636                super::super::LadderDetails,
23637                ::buffa::DecodeError,
23638            > {
23639                self.0.to_owned_message()
23640            }
23641            /// The underlying bytes buffer.
23642            #[must_use]
23643            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
23644                self.0.bytes()
23645            }
23646            /// Consume the handle, returning the underlying bytes buffer.
23647            #[must_use]
23648            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
23649                self.0.into_bytes()
23650            }
23651            /// Minimum price in quote units scaled by 1e6 for the ladder range.
23652            ///
23653            /// Field 1: `ladder_price_min_ticks`
23654            #[must_use]
23655            pub fn ladder_price_min_ticks(&self) -> i64 {
23656                self.0.reborrow().ladder_price_min_ticks
23657            }
23658            /// Maximum price in quote units scaled by 1e6 for the ladder range.
23659            ///
23660            /// Field 2: `ladder_price_max_ticks`
23661            #[must_use]
23662            pub fn ladder_price_max_ticks(&self) -> i64 {
23663                self.0.reborrow().ladder_price_max_ticks
23664            }
23665            /// Number of price levels in the ladder.
23666            ///
23667            /// Field 3: `ladder_levels`
23668            #[must_use]
23669            pub fn ladder_levels(&self) -> i32 {
23670                self.0.reborrow().ladder_levels
23671            }
23672            /// Quantity distribution across ladder levels.
23673            ///
23674            /// Field 4: `ladder_distribution`
23675            #[must_use]
23676            pub fn ladder_distribution(
23677                &self,
23678            ) -> ::buffa::EnumValue<super::super::LadderDistribution> {
23679                self.0.reborrow().ladder_distribution
23680            }
23681        }
23682        impl ::core::convert::From<::buffa::OwnedView<LadderDetailsView<'static>>>
23683        for LadderDetailsOwnedView {
23684            fn from(inner: ::buffa::OwnedView<LadderDetailsView<'static>>) -> Self {
23685                LadderDetailsOwnedView(inner)
23686            }
23687        }
23688        impl ::core::convert::From<LadderDetailsOwnedView>
23689        for ::buffa::OwnedView<LadderDetailsView<'static>> {
23690            fn from(wrapper: LadderDetailsOwnedView) -> Self {
23691                wrapper.0
23692            }
23693        }
23694        impl ::core::convert::AsRef<::buffa::OwnedView<LadderDetailsView<'static>>>
23695        for LadderDetailsOwnedView {
23696            fn as_ref(&self) -> &::buffa::OwnedView<LadderDetailsView<'static>> {
23697                &self.0
23698            }
23699        }
23700        impl ::buffa::HasMessageView for super::super::LadderDetails {
23701            type View<'a> = LadderDetailsView<'a>;
23702            type ViewHandle = LadderDetailsOwnedView;
23703        }
23704        impl ::serde::Serialize for LadderDetailsOwnedView {
23705            fn serialize<__S: ::serde::Serializer>(
23706                &self,
23707                __s: __S,
23708            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23709                ::serde::Serialize::serialize(&self.0, __s)
23710            }
23711        }
23712        /// Trigger represents a trigger with its full state.
23713        #[derive(Clone, Debug, Default)]
23714        pub struct TriggerView<'a> {
23715            /// Trigger ID.
23716            ///
23717            /// Field 1: `trigger_id`
23718            pub trigger_id: u64,
23719            /// Public account or sub-account ID associated with the trigger.
23720            ///
23721            /// Field 2: `subaccount_id`
23722            pub subaccount_id: u64,
23723            /// Trading symbol numeric identifier.
23724            ///
23725            /// Field 3: `symbol_id`
23726            pub symbol_id: u32,
23727            /// Trading symbol, for example "BTC-USDT".
23728            ///
23729            /// Field 4: `symbol`
23730            pub symbol: &'a str,
23731            /// Current trigger lifecycle status.
23732            ///
23733            /// Field 5: `status`
23734            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
23735            /// Parent order ID for attached-risk triggers; empty for standalone triggers.
23736            ///
23737            /// Field 6: `parent_order_id`
23738            pub parent_order_id: ::core::option::Option<u64>,
23739            /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
23740            ///
23741            /// Field 20: `qty_scaled`
23742            pub qty_scaled: i64,
23743            /// Fee asset for BUY child orders.
23744            ///
23745            /// Field 21: `fee_asset`
23746            pub fee_asset: ::buffa::EnumValue<
23747                super::super::super::super::orders::v1::FeeAsset,
23748            >,
23749            /// Self-trade prevention mode for child orders.
23750            ///
23751            /// Field 22: `self_trade_prevention_mode`
23752            pub self_trade_prevention_mode: ::buffa::EnumValue<
23753                super::super::super::super::orders::v1::SelfTradePreventionMode,
23754            >,
23755            /// Client-provided trigger ID for idempotency and correlation.
23756            ///
23757            /// Field 60: `client_trigger_id`
23758            pub client_trigger_id: &'a str,
23759            /// Creation timestamp.
23760            ///
23761            /// Field 61: `created_at`
23762            pub created_at: ::buffa::MessageFieldView<
23763                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23764            >,
23765            /// Last update timestamp.
23766            ///
23767            /// Field 62: `updated_at`
23768            pub updated_at: ::buffa::MessageFieldView<
23769                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23770            >,
23771            /// Timestamp when the trigger became armed.
23772            ///
23773            /// Field 63: `armed_at`
23774            pub armed_at: ::buffa::MessageFieldView<
23775                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23776            >,
23777            /// Timestamp when the trigger reached a terminal successful state.
23778            ///
23779            /// Field 64: `completed_at`
23780            pub completed_at: ::buffa::MessageFieldView<
23781                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23782            >,
23783            /// Child orders spawned by this trigger.
23784            ///
23785            /// Field 70: `child_order_ids`
23786            pub child_order_ids: ::buffa::RepeatedView<'a, u64>,
23787            pub configuration: ::core::option::Option<
23788                super::super::__buffa::view::oneof::trigger::Configuration<'a>,
23789            >,
23790            pub runtime_details: ::core::option::Option<
23791                super::super::__buffa::view::oneof::trigger::RuntimeDetails<'a>,
23792            >,
23793            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
23794        }
23795        impl<'a> ::buffa::MessageView<'a> for TriggerView<'a> {
23796            type Owned = super::super::Trigger;
23797            fn decode_view(
23798                buf: &'a [u8],
23799            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23800                let __limit = ::core::cell::Cell::new(
23801                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23802                );
23803                <Self as ::buffa::MessageView>::decode_view_ctx(
23804                    buf,
23805                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23806                )
23807            }
23808            fn decode_view_with_ctx(
23809                buf: &'a [u8],
23810                ctx: ::buffa::DecodeContext<'_>,
23811            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23812                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23813            }
23814            fn merge_view_field(
23815                &mut self,
23816                tag: ::buffa::encoding::Tag,
23817                cur: &'a [u8],
23818                before_tag: &'a [u8],
23819                ctx: ::buffa::DecodeContext<'_>,
23820            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23821                let _ = ctx;
23822                #[allow(unused_variables)]
23823                let view = self;
23824                let mut cur = cur;
23825                match tag.field_number() {
23826                    1u32 => {
23827                        ::buffa::encoding::check_wire_type(
23828                            tag,
23829                            ::buffa::encoding::WireType::Fixed64,
23830                        )?;
23831                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
23832                    }
23833                    2u32 => {
23834                        ::buffa::encoding::check_wire_type(
23835                            tag,
23836                            ::buffa::encoding::WireType::Fixed64,
23837                        )?;
23838                        view.subaccount_id = ::buffa::types::decode_fixed64(&mut cur)?;
23839                    }
23840                    3u32 => {
23841                        ::buffa::encoding::check_wire_type(
23842                            tag,
23843                            ::buffa::encoding::WireType::Varint,
23844                        )?;
23845                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
23846                    }
23847                    4u32 => {
23848                        ::buffa::encoding::check_wire_type(
23849                            tag,
23850                            ::buffa::encoding::WireType::LengthDelimited,
23851                        )?;
23852                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
23853                    }
23854                    5u32 => {
23855                        ::buffa::encoding::check_wire_type(
23856                            tag,
23857                            ::buffa::encoding::WireType::Varint,
23858                        )?;
23859                        view.status = ::buffa::EnumValue::from(
23860                            ::buffa::types::decode_int32(&mut cur)?,
23861                        );
23862                    }
23863                    6u32 => {
23864                        ::buffa::encoding::check_wire_type(
23865                            tag,
23866                            ::buffa::encoding::WireType::Fixed64,
23867                        )?;
23868                        view.parent_order_id = Some(
23869                            ::buffa::types::decode_fixed64(&mut cur)?,
23870                        );
23871                    }
23872                    20u32 => {
23873                        ::buffa::encoding::check_wire_type(
23874                            tag,
23875                            ::buffa::encoding::WireType::Varint,
23876                        )?;
23877                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
23878                    }
23879                    21u32 => {
23880                        ::buffa::encoding::check_wire_type(
23881                            tag,
23882                            ::buffa::encoding::WireType::Varint,
23883                        )?;
23884                        view.fee_asset = ::buffa::EnumValue::from(
23885                            ::buffa::types::decode_int32(&mut cur)?,
23886                        );
23887                    }
23888                    22u32 => {
23889                        ::buffa::encoding::check_wire_type(
23890                            tag,
23891                            ::buffa::encoding::WireType::Varint,
23892                        )?;
23893                        view.self_trade_prevention_mode = ::buffa::EnumValue::from(
23894                            ::buffa::types::decode_int32(&mut cur)?,
23895                        );
23896                    }
23897                    60u32 => {
23898                        ::buffa::encoding::check_wire_type(
23899                            tag,
23900                            ::buffa::encoding::WireType::LengthDelimited,
23901                        )?;
23902                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
23903                    }
23904                    61u32 => {
23905                        ::buffa::encoding::check_wire_type(
23906                            tag,
23907                            ::buffa::encoding::WireType::LengthDelimited,
23908                        )?;
23909                        let __sub_ctx = ctx.descend()?;
23910                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
23911                        match view.created_at.as_mut() {
23912                            Some(existing) => {
23913                                ::buffa::MessageView::merge_into_view(
23914                                    existing,
23915                                    sub,
23916                                    __sub_ctx,
23917                                )?
23918                            }
23919                            None => {
23920                                view.created_at = ::buffa::MessageFieldView::set(
23921                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
23922                                        sub,
23923                                        __sub_ctx,
23924                                    )?,
23925                                );
23926                            }
23927                        }
23928                    }
23929                    62u32 => {
23930                        ::buffa::encoding::check_wire_type(
23931                            tag,
23932                            ::buffa::encoding::WireType::LengthDelimited,
23933                        )?;
23934                        let __sub_ctx = ctx.descend()?;
23935                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
23936                        match view.updated_at.as_mut() {
23937                            Some(existing) => {
23938                                ::buffa::MessageView::merge_into_view(
23939                                    existing,
23940                                    sub,
23941                                    __sub_ctx,
23942                                )?
23943                            }
23944                            None => {
23945                                view.updated_at = ::buffa::MessageFieldView::set(
23946                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
23947                                        sub,
23948                                        __sub_ctx,
23949                                    )?,
23950                                );
23951                            }
23952                        }
23953                    }
23954                    63u32 => {
23955                        ::buffa::encoding::check_wire_type(
23956                            tag,
23957                            ::buffa::encoding::WireType::LengthDelimited,
23958                        )?;
23959                        let __sub_ctx = ctx.descend()?;
23960                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
23961                        match view.armed_at.as_mut() {
23962                            Some(existing) => {
23963                                ::buffa::MessageView::merge_into_view(
23964                                    existing,
23965                                    sub,
23966                                    __sub_ctx,
23967                                )?
23968                            }
23969                            None => {
23970                                view.armed_at = ::buffa::MessageFieldView::set(
23971                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
23972                                        sub,
23973                                        __sub_ctx,
23974                                    )?,
23975                                );
23976                            }
23977                        }
23978                    }
23979                    64u32 => {
23980                        ::buffa::encoding::check_wire_type(
23981                            tag,
23982                            ::buffa::encoding::WireType::LengthDelimited,
23983                        )?;
23984                        let __sub_ctx = ctx.descend()?;
23985                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
23986                        match view.completed_at.as_mut() {
23987                            Some(existing) => {
23988                                ::buffa::MessageView::merge_into_view(
23989                                    existing,
23990                                    sub,
23991                                    __sub_ctx,
23992                                )?
23993                            }
23994                            None => {
23995                                view.completed_at = ::buffa::MessageFieldView::set(
23996                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
23997                                        sub,
23998                                        __sub_ctx,
23999                                    )?,
24000                                );
24001                            }
24002                        }
24003                    }
24004                    70u32 => {
24005                        if tag.wire_type()
24006                            == ::buffa::encoding::WireType::LengthDelimited
24007                        {
24008                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
24009                            view.child_order_ids.reserve(payload.len() / 8usize);
24010                            let mut pcur: &[u8] = payload;
24011                            while !pcur.is_empty() {
24012                                view.child_order_ids
24013                                    .push(::buffa::types::decode_fixed64(&mut pcur)?);
24014                            }
24015                        } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64
24016                        {
24017                            view.child_order_ids
24018                                .push(::buffa::types::decode_fixed64(&mut cur)?);
24019                        } else {
24020                            return Err(
24021                                ::buffa::encoding::wire_type_mismatch(
24022                                    tag,
24023                                    ::buffa::encoding::WireType::LengthDelimited,
24024                                ),
24025                            );
24026                        }
24027                    }
24028                    30u32 => {
24029                        ::buffa::encoding::check_wire_type(
24030                            tag,
24031                            ::buffa::encoding::WireType::LengthDelimited,
24032                        )?;
24033                        let __sub_ctx = ctx.descend()?;
24034                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24035                        if let Some(
24036                            super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24037                                ref mut existing,
24038                            ),
24039                        ) = view.configuration
24040                        {
24041                            ::buffa::MessageView::merge_into_view(
24042                                &mut **existing,
24043                                sub,
24044                                __sub_ctx,
24045                            )?;
24046                        } else {
24047                            view.configuration = Some(
24048                                super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24049                                    ::buffa::alloc::boxed::Box::new(
24050                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
24051                                            sub,
24052                                            __sub_ctx,
24053                                        )?,
24054                                    ),
24055                                ),
24056                            );
24057                        }
24058                    }
24059                    31u32 => {
24060                        ::buffa::encoding::check_wire_type(
24061                            tag,
24062                            ::buffa::encoding::WireType::LengthDelimited,
24063                        )?;
24064                        let __sub_ctx = ctx.descend()?;
24065                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24066                        if let Some(
24067                            super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24068                                ref mut existing,
24069                            ),
24070                        ) = view.configuration
24071                        {
24072                            ::buffa::MessageView::merge_into_view(
24073                                &mut **existing,
24074                                sub,
24075                                __sub_ctx,
24076                            )?;
24077                        } else {
24078                            view.configuration = Some(
24079                                super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24080                                    ::buffa::alloc::boxed::Box::new(
24081                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
24082                                            sub,
24083                                            __sub_ctx,
24084                                        )?,
24085                                    ),
24086                                ),
24087                            );
24088                        }
24089                    }
24090                    32u32 => {
24091                        ::buffa::encoding::check_wire_type(
24092                            tag,
24093                            ::buffa::encoding::WireType::LengthDelimited,
24094                        )?;
24095                        let __sub_ctx = ctx.descend()?;
24096                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24097                        if let Some(
24098                            super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24099                                ref mut existing,
24100                            ),
24101                        ) = view.configuration
24102                        {
24103                            ::buffa::MessageView::merge_into_view(
24104                                &mut **existing,
24105                                sub,
24106                                __sub_ctx,
24107                            )?;
24108                        } else {
24109                            view.configuration = Some(
24110                                super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24111                                    ::buffa::alloc::boxed::Box::new(
24112                                        <super::super::__buffa::view::TrailingStopTriggerView as ::buffa::MessageView>::decode_view_ctx(
24113                                            sub,
24114                                            __sub_ctx,
24115                                        )?,
24116                                    ),
24117                                ),
24118                            );
24119                        }
24120                    }
24121                    33u32 => {
24122                        ::buffa::encoding::check_wire_type(
24123                            tag,
24124                            ::buffa::encoding::WireType::LengthDelimited,
24125                        )?;
24126                        let __sub_ctx = ctx.descend()?;
24127                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24128                        if let Some(
24129                            super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24130                                ref mut existing,
24131                            ),
24132                        ) = view.configuration
24133                        {
24134                            ::buffa::MessageView::merge_into_view(
24135                                &mut **existing,
24136                                sub,
24137                                __sub_ctx,
24138                            )?;
24139                        } else {
24140                            view.configuration = Some(
24141                                super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24142                                    ::buffa::alloc::boxed::Box::new(
24143                                        <super::super::__buffa::view::TwapTriggerView as ::buffa::MessageView>::decode_view_ctx(
24144                                            sub,
24145                                            __sub_ctx,
24146                                        )?,
24147                                    ),
24148                                ),
24149                            );
24150                        }
24151                    }
24152                    34u32 => {
24153                        ::buffa::encoding::check_wire_type(
24154                            tag,
24155                            ::buffa::encoding::WireType::LengthDelimited,
24156                        )?;
24157                        let __sub_ctx = ctx.descend()?;
24158                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24159                        if let Some(
24160                            super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24161                                ref mut existing,
24162                            ),
24163                        ) = view.configuration
24164                        {
24165                            ::buffa::MessageView::merge_into_view(
24166                                &mut **existing,
24167                                sub,
24168                                __sub_ctx,
24169                            )?;
24170                        } else {
24171                            view.configuration = Some(
24172                                super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24173                                    ::buffa::alloc::boxed::Box::new(
24174                                        <super::super::__buffa::view::LadderTriggerView as ::buffa::MessageView>::decode_view_ctx(
24175                                            sub,
24176                                            __sub_ctx,
24177                                        )?,
24178                                    ),
24179                                ),
24180                            );
24181                        }
24182                    }
24183                    100u32 => {
24184                        ::buffa::encoding::check_wire_type(
24185                            tag,
24186                            ::buffa::encoding::WireType::LengthDelimited,
24187                        )?;
24188                        let __sub_ctx = ctx.descend()?;
24189                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24190                        if let Some(
24191                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24192                                ref mut existing,
24193                            ),
24194                        ) = view.runtime_details
24195                        {
24196                            ::buffa::MessageView::merge_into_view(
24197                                &mut **existing,
24198                                sub,
24199                                __sub_ctx,
24200                            )?;
24201                        } else {
24202                            view.runtime_details = Some(
24203                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24204                                    ::buffa::alloc::boxed::Box::new(
24205                                        <super::super::__buffa::view::StopDetailsView as ::buffa::MessageView>::decode_view_ctx(
24206                                            sub,
24207                                            __sub_ctx,
24208                                        )?,
24209                                    ),
24210                                ),
24211                            );
24212                        }
24213                    }
24214                    101u32 => {
24215                        ::buffa::encoding::check_wire_type(
24216                            tag,
24217                            ::buffa::encoding::WireType::LengthDelimited,
24218                        )?;
24219                        let __sub_ctx = ctx.descend()?;
24220                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24221                        if let Some(
24222                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24223                                ref mut existing,
24224                            ),
24225                        ) = view.runtime_details
24226                        {
24227                            ::buffa::MessageView::merge_into_view(
24228                                &mut **existing,
24229                                sub,
24230                                __sub_ctx,
24231                            )?;
24232                        } else {
24233                            view.runtime_details = Some(
24234                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24235                                    ::buffa::alloc::boxed::Box::new(
24236                                        <super::super::__buffa::view::TrailingDetailsView as ::buffa::MessageView>::decode_view_ctx(
24237                                            sub,
24238                                            __sub_ctx,
24239                                        )?,
24240                                    ),
24241                                ),
24242                            );
24243                        }
24244                    }
24245                    102u32 => {
24246                        ::buffa::encoding::check_wire_type(
24247                            tag,
24248                            ::buffa::encoding::WireType::LengthDelimited,
24249                        )?;
24250                        let __sub_ctx = ctx.descend()?;
24251                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24252                        if let Some(
24253                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24254                                ref mut existing,
24255                            ),
24256                        ) = view.runtime_details
24257                        {
24258                            ::buffa::MessageView::merge_into_view(
24259                                &mut **existing,
24260                                sub,
24261                                __sub_ctx,
24262                            )?;
24263                        } else {
24264                            view.runtime_details = Some(
24265                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24266                                    ::buffa::alloc::boxed::Box::new(
24267                                        <super::super::__buffa::view::TwapDetailsView as ::buffa::MessageView>::decode_view_ctx(
24268                                            sub,
24269                                            __sub_ctx,
24270                                        )?,
24271                                    ),
24272                                ),
24273                            );
24274                        }
24275                    }
24276                    103u32 => {
24277                        ::buffa::encoding::check_wire_type(
24278                            tag,
24279                            ::buffa::encoding::WireType::LengthDelimited,
24280                        )?;
24281                        let __sub_ctx = ctx.descend()?;
24282                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24283                        if let Some(
24284                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24285                                ref mut existing,
24286                            ),
24287                        ) = view.runtime_details
24288                        {
24289                            ::buffa::MessageView::merge_into_view(
24290                                &mut **existing,
24291                                sub,
24292                                __sub_ctx,
24293                            )?;
24294                        } else {
24295                            view.runtime_details = Some(
24296                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24297                                    ::buffa::alloc::boxed::Box::new(
24298                                        <super::super::__buffa::view::LadderDetailsView as ::buffa::MessageView>::decode_view_ctx(
24299                                            sub,
24300                                            __sub_ctx,
24301                                        )?,
24302                                    ),
24303                                ),
24304                            );
24305                        }
24306                    }
24307                    _ => {
24308                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
24309                        let span_len = before_tag.len() - cur.len();
24310                        view.__buffa_unknown_fields
24311                            .push_record(before_tag, span_len, ctx)?;
24312                    }
24313                }
24314                ::core::result::Result::Ok(cur)
24315            }
24316            fn to_owned_message(
24317                &self,
24318            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
24319                self.to_owned_from_source(None)
24320            }
24321            #[allow(clippy::useless_conversion, clippy::needless_update)]
24322            fn to_owned_from_source(
24323                &self,
24324                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
24325            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
24326                #[allow(unused_imports)]
24327                use ::buffa::alloc::string::ToString as _;
24328                let _ = __buffa_src;
24329                ::core::result::Result::Ok(super::super::Trigger {
24330                    trigger_id: self.trigger_id,
24331                    subaccount_id: self.subaccount_id,
24332                    symbol_id: self.symbol_id,
24333                    symbol: self.symbol.to_string(),
24334                    status: self.status,
24335                    parent_order_id: self.parent_order_id,
24336                    qty_scaled: self.qty_scaled,
24337                    fee_asset: self.fee_asset,
24338                    self_trade_prevention_mode: self.self_trade_prevention_mode,
24339                    client_trigger_id: self.client_trigger_id.to_string(),
24340                    created_at: match self.created_at.as_option() {
24341                        Some(v) => {
24342                            ::buffa::MessageField::<
24343                                ::buffa_types::google::protobuf::Timestamp,
24344                            >::some(v.to_owned_from_source(__buffa_src)?)
24345                        }
24346                        None => ::buffa::MessageField::none(),
24347                    },
24348                    updated_at: match self.updated_at.as_option() {
24349                        Some(v) => {
24350                            ::buffa::MessageField::<
24351                                ::buffa_types::google::protobuf::Timestamp,
24352                            >::some(v.to_owned_from_source(__buffa_src)?)
24353                        }
24354                        None => ::buffa::MessageField::none(),
24355                    },
24356                    armed_at: match self.armed_at.as_option() {
24357                        Some(v) => {
24358                            ::buffa::MessageField::<
24359                                ::buffa_types::google::protobuf::Timestamp,
24360                            >::some(v.to_owned_from_source(__buffa_src)?)
24361                        }
24362                        None => ::buffa::MessageField::none(),
24363                    },
24364                    completed_at: match self.completed_at.as_option() {
24365                        Some(v) => {
24366                            ::buffa::MessageField::<
24367                                ::buffa_types::google::protobuf::Timestamp,
24368                            >::some(v.to_owned_from_source(__buffa_src)?)
24369                        }
24370                        None => ::buffa::MessageField::none(),
24371                    },
24372                    child_order_ids: self.child_order_ids.to_vec(),
24373                    configuration: match self.configuration.as_ref() {
24374                        ::core::option::Option::Some(v) => {
24375                            ::core::option::Option::Some(
24376                                match v {
24377                                    super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24378                                        v,
24379                                    ) => {
24380                                        super::super::__buffa::oneof::trigger::Configuration::StopLoss(
24381                                            ::buffa::alloc::boxed::Box::new(
24382                                                v.to_owned_from_source(__buffa_src)?,
24383                                            ),
24384                                        )
24385                                    }
24386                                    super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24387                                        v,
24388                                    ) => {
24389                                        super::super::__buffa::oneof::trigger::Configuration::TakeProfit(
24390                                            ::buffa::alloc::boxed::Box::new(
24391                                                v.to_owned_from_source(__buffa_src)?,
24392                                            ),
24393                                        )
24394                                    }
24395                                    super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24396                                        v,
24397                                    ) => {
24398                                        super::super::__buffa::oneof::trigger::Configuration::TrailingStop(
24399                                            ::buffa::alloc::boxed::Box::new(
24400                                                v.to_owned_from_source(__buffa_src)?,
24401                                            ),
24402                                        )
24403                                    }
24404                                    super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24405                                        v,
24406                                    ) => {
24407                                        super::super::__buffa::oneof::trigger::Configuration::Twap(
24408                                            ::buffa::alloc::boxed::Box::new(
24409                                                v.to_owned_from_source(__buffa_src)?,
24410                                            ),
24411                                        )
24412                                    }
24413                                    super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24414                                        v,
24415                                    ) => {
24416                                        super::super::__buffa::oneof::trigger::Configuration::Ladder(
24417                                            ::buffa::alloc::boxed::Box::new(
24418                                                v.to_owned_from_source(__buffa_src)?,
24419                                            ),
24420                                        )
24421                                    }
24422                                },
24423                            )
24424                        }
24425                        ::core::option::Option::None => ::core::option::Option::None,
24426                    },
24427                    runtime_details: match self.runtime_details.as_ref() {
24428                        ::core::option::Option::Some(v) => {
24429                            ::core::option::Option::Some(
24430                                match v {
24431                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24432                                        v,
24433                                    ) => {
24434                                        super::super::__buffa::oneof::trigger::RuntimeDetails::Stop(
24435                                            ::buffa::alloc::boxed::Box::new(
24436                                                v.to_owned_from_source(__buffa_src)?,
24437                                            ),
24438                                        )
24439                                    }
24440                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24441                                        v,
24442                                    ) => {
24443                                        super::super::__buffa::oneof::trigger::RuntimeDetails::Trailing(
24444                                            ::buffa::alloc::boxed::Box::new(
24445                                                v.to_owned_from_source(__buffa_src)?,
24446                                            ),
24447                                        )
24448                                    }
24449                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24450                                        v,
24451                                    ) => {
24452                                        super::super::__buffa::oneof::trigger::RuntimeDetails::TwapState(
24453                                            ::buffa::alloc::boxed::Box::new(
24454                                                v.to_owned_from_source(__buffa_src)?,
24455                                            ),
24456                                        )
24457                                    }
24458                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24459                                        v,
24460                                    ) => {
24461                                        super::super::__buffa::oneof::trigger::RuntimeDetails::LadderState(
24462                                            ::buffa::alloc::boxed::Box::new(
24463                                                v.to_owned_from_source(__buffa_src)?,
24464                                            ),
24465                                        )
24466                                    }
24467                                },
24468                            )
24469                        }
24470                        ::core::option::Option::None => ::core::option::Option::None,
24471                    },
24472                    __buffa_unknown_fields: self
24473                        .__buffa_unknown_fields
24474                        .to_owned()?
24475                        .into(),
24476                    ..::core::default::Default::default()
24477                })
24478            }
24479        }
24480        impl<'a> ::buffa::ViewEncode<'a> for TriggerView<'a> {
24481            #[allow(clippy::needless_borrow, clippy::let_and_return)]
24482            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
24483                #[allow(unused_imports)]
24484                use ::buffa::Enumeration as _;
24485                let mut size = 0u32;
24486                if self.trigger_id != 0u64 {
24487                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24488                }
24489                if self.subaccount_id != 0u64 {
24490                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24491                }
24492                if self.symbol_id != 0u32 {
24493                    size
24494                        += 1u32
24495                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
24496                }
24497                if !self.symbol.is_empty() {
24498                    size
24499                        += 1u32
24500                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
24501                }
24502                {
24503                    let val = self.status.to_i32();
24504                    if val != 0 {
24505                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
24506                    }
24507                }
24508                if self.parent_order_id.is_some() {
24509                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24510                }
24511                if self.qty_scaled != 0i64 {
24512                    size
24513                        += 2u32
24514                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
24515                }
24516                {
24517                    let val = self.fee_asset.to_i32();
24518                    if val != 0 {
24519                        size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
24520                    }
24521                }
24522                {
24523                    let val = self.self_trade_prevention_mode.to_i32();
24524                    if val != 0 {
24525                        size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
24526                    }
24527                }
24528                if let ::core::option::Option::Some(ref v) = self.configuration {
24529                    match v {
24530                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24531                            x,
24532                        ) => {
24533                            let __slot = __cache.reserve();
24534                            let inner = x.compute_size(__cache);
24535                            __cache.set(__slot, inner);
24536                            size
24537                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24538                                    + inner;
24539                        }
24540                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24541                            x,
24542                        ) => {
24543                            let __slot = __cache.reserve();
24544                            let inner = x.compute_size(__cache);
24545                            __cache.set(__slot, inner);
24546                            size
24547                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24548                                    + inner;
24549                        }
24550                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24551                            x,
24552                        ) => {
24553                            let __slot = __cache.reserve();
24554                            let inner = x.compute_size(__cache);
24555                            __cache.set(__slot, inner);
24556                            size
24557                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24558                                    + inner;
24559                        }
24560                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24561                            x,
24562                        ) => {
24563                            let __slot = __cache.reserve();
24564                            let inner = x.compute_size(__cache);
24565                            __cache.set(__slot, inner);
24566                            size
24567                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24568                                    + inner;
24569                        }
24570                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24571                            x,
24572                        ) => {
24573                            let __slot = __cache.reserve();
24574                            let inner = x.compute_size(__cache);
24575                            __cache.set(__slot, inner);
24576                            size
24577                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24578                                    + inner;
24579                        }
24580                    }
24581                }
24582                if !self.client_trigger_id.is_empty() {
24583                    size
24584                        += 2u32
24585                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
24586                                as u32;
24587                }
24588                if self.created_at.is_set() {
24589                    let __slot = __cache.reserve();
24590                    let inner_size = self.created_at.compute_size(__cache);
24591                    __cache.set(__slot, inner_size);
24592                    size
24593                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24594                            + inner_size;
24595                }
24596                if self.updated_at.is_set() {
24597                    let __slot = __cache.reserve();
24598                    let inner_size = self.updated_at.compute_size(__cache);
24599                    __cache.set(__slot, inner_size);
24600                    size
24601                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24602                            + inner_size;
24603                }
24604                if self.armed_at.is_set() {
24605                    let __slot = __cache.reserve();
24606                    let inner_size = self.armed_at.compute_size(__cache);
24607                    __cache.set(__slot, inner_size);
24608                    size
24609                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24610                            + inner_size;
24611                }
24612                if self.completed_at.is_set() {
24613                    let __slot = __cache.reserve();
24614                    let inner_size = self.completed_at.compute_size(__cache);
24615                    __cache.set(__slot, inner_size);
24616                    size
24617                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24618                            + inner_size;
24619                }
24620                if !self.child_order_ids.is_empty() {
24621                    let payload: u32 = self.child_order_ids.len() as u32
24622                        * ::buffa::types::FIXED64_ENCODED_LEN as u32;
24623                    size
24624                        += 2u32 + ::buffa::encoding::varint_len(payload as u64) as u32
24625                            + payload;
24626                }
24627                if let ::core::option::Option::Some(ref v) = self.runtime_details {
24628                    match v {
24629                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24630                            x,
24631                        ) => {
24632                            let __slot = __cache.reserve();
24633                            let inner = x.compute_size(__cache);
24634                            __cache.set(__slot, inner);
24635                            size
24636                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24637                                    + inner;
24638                        }
24639                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24640                            x,
24641                        ) => {
24642                            let __slot = __cache.reserve();
24643                            let inner = x.compute_size(__cache);
24644                            __cache.set(__slot, inner);
24645                            size
24646                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24647                                    + inner;
24648                        }
24649                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24650                            x,
24651                        ) => {
24652                            let __slot = __cache.reserve();
24653                            let inner = x.compute_size(__cache);
24654                            __cache.set(__slot, inner);
24655                            size
24656                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24657                                    + inner;
24658                        }
24659                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24660                            x,
24661                        ) => {
24662                            let __slot = __cache.reserve();
24663                            let inner = x.compute_size(__cache);
24664                            __cache.set(__slot, inner);
24665                            size
24666                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24667                                    + inner;
24668                        }
24669                    }
24670                }
24671                size += self.__buffa_unknown_fields.encoded_len() as u32;
24672                size
24673            }
24674            #[allow(clippy::needless_borrow)]
24675            fn write_to(
24676                &self,
24677                __cache: &mut ::buffa::SizeCache,
24678                buf: &mut impl ::buffa::bytes::BufMut,
24679            ) {
24680                #[allow(unused_imports)]
24681                use ::buffa::Enumeration as _;
24682                if self.trigger_id != 0u64 {
24683                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
24684                }
24685                if self.subaccount_id != 0u64 {
24686                    ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
24687                }
24688                if self.symbol_id != 0u32 {
24689                    ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
24690                }
24691                if !self.symbol.is_empty() {
24692                    ::buffa::types::put_string_field(4u32, &self.symbol, buf);
24693                }
24694                {
24695                    let val = self.status.to_i32();
24696                    if val != 0 {
24697                        ::buffa::types::put_int32_field(5u32, val, buf);
24698                    }
24699                }
24700                if let Some(v) = self.parent_order_id {
24701                    ::buffa::types::put_fixed64_field(6u32, v, buf);
24702                }
24703                if self.qty_scaled != 0i64 {
24704                    ::buffa::types::put_int64_field(20u32, self.qty_scaled, buf);
24705                }
24706                {
24707                    let val = self.fee_asset.to_i32();
24708                    if val != 0 {
24709                        ::buffa::types::put_int32_field(21u32, val, buf);
24710                    }
24711                }
24712                {
24713                    let val = self.self_trade_prevention_mode.to_i32();
24714                    if val != 0 {
24715                        ::buffa::types::put_int32_field(22u32, val, buf);
24716                    }
24717                }
24718                if let ::core::option::Option::Some(ref v) = self.configuration {
24719                    match v {
24720                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24721                            x,
24722                        ) => {
24723                            ::buffa::types::put_len_delimited_header(
24724                                30u32,
24725                                __cache.consume_next(),
24726                                buf,
24727                            );
24728                            x.write_to(__cache, buf);
24729                        }
24730                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24731                            x,
24732                        ) => {
24733                            ::buffa::types::put_len_delimited_header(
24734                                31u32,
24735                                __cache.consume_next(),
24736                                buf,
24737                            );
24738                            x.write_to(__cache, buf);
24739                        }
24740                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24741                            x,
24742                        ) => {
24743                            ::buffa::types::put_len_delimited_header(
24744                                32u32,
24745                                __cache.consume_next(),
24746                                buf,
24747                            );
24748                            x.write_to(__cache, buf);
24749                        }
24750                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24751                            x,
24752                        ) => {
24753                            ::buffa::types::put_len_delimited_header(
24754                                33u32,
24755                                __cache.consume_next(),
24756                                buf,
24757                            );
24758                            x.write_to(__cache, buf);
24759                        }
24760                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24761                            x,
24762                        ) => {
24763                            ::buffa::types::put_len_delimited_header(
24764                                34u32,
24765                                __cache.consume_next(),
24766                                buf,
24767                            );
24768                            x.write_to(__cache, buf);
24769                        }
24770                    }
24771                }
24772                if !self.client_trigger_id.is_empty() {
24773                    ::buffa::types::put_string_field(
24774                        60u32,
24775                        &self.client_trigger_id,
24776                        buf,
24777                    );
24778                }
24779                if self.created_at.is_set() {
24780                    ::buffa::types::put_len_delimited_header(
24781                        61u32,
24782                        __cache.consume_next(),
24783                        buf,
24784                    );
24785                    self.created_at.write_to(__cache, buf);
24786                }
24787                if self.updated_at.is_set() {
24788                    ::buffa::types::put_len_delimited_header(
24789                        62u32,
24790                        __cache.consume_next(),
24791                        buf,
24792                    );
24793                    self.updated_at.write_to(__cache, buf);
24794                }
24795                if self.armed_at.is_set() {
24796                    ::buffa::types::put_len_delimited_header(
24797                        63u32,
24798                        __cache.consume_next(),
24799                        buf,
24800                    );
24801                    self.armed_at.write_to(__cache, buf);
24802                }
24803                if self.completed_at.is_set() {
24804                    ::buffa::types::put_len_delimited_header(
24805                        64u32,
24806                        __cache.consume_next(),
24807                        buf,
24808                    );
24809                    self.completed_at.write_to(__cache, buf);
24810                }
24811                if !self.child_order_ids.is_empty() {
24812                    let payload: u32 = self.child_order_ids.len() as u32
24813                        * ::buffa::types::FIXED64_ENCODED_LEN as u32;
24814                    ::buffa::types::put_len_delimited_header(70u32, payload, buf);
24815                    for &v in &self.child_order_ids {
24816                        ::buffa::types::encode_fixed64(v, buf);
24817                    }
24818                }
24819                if let ::core::option::Option::Some(ref v) = self.runtime_details {
24820                    match v {
24821                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24822                            x,
24823                        ) => {
24824                            ::buffa::types::put_len_delimited_header(
24825                                100u32,
24826                                __cache.consume_next(),
24827                                buf,
24828                            );
24829                            x.write_to(__cache, buf);
24830                        }
24831                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24832                            x,
24833                        ) => {
24834                            ::buffa::types::put_len_delimited_header(
24835                                101u32,
24836                                __cache.consume_next(),
24837                                buf,
24838                            );
24839                            x.write_to(__cache, buf);
24840                        }
24841                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24842                            x,
24843                        ) => {
24844                            ::buffa::types::put_len_delimited_header(
24845                                102u32,
24846                                __cache.consume_next(),
24847                                buf,
24848                            );
24849                            x.write_to(__cache, buf);
24850                        }
24851                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24852                            x,
24853                        ) => {
24854                            ::buffa::types::put_len_delimited_header(
24855                                103u32,
24856                                __cache.consume_next(),
24857                                buf,
24858                            );
24859                            x.write_to(__cache, buf);
24860                        }
24861                    }
24862                }
24863                self.__buffa_unknown_fields.write_to(buf);
24864            }
24865        }
24866        /// Serializes this view as protobuf JSON.
24867        ///
24868        /// Implicit-presence fields with default values are omitted, `required`
24869        /// fields are always emitted, explicit-presence (`optional`) fields are
24870        /// emitted only when set, bytes fields are base64-encoded, and enum
24871        /// values are their proto name strings.
24872        ///
24873        /// This impl uses `serialize_map(None)` because the number of emitted
24874        /// fields depends on default-omission rules; serializers that require
24875        /// known map lengths (e.g. `bincode`) will return a runtime error.
24876        /// Use the owned message type for those formats.
24877        impl<'__a> ::serde::Serialize for TriggerView<'__a> {
24878            fn serialize<__S: ::serde::Serializer>(
24879                &self,
24880                __s: __S,
24881            ) -> ::core::result::Result<__S::Ok, __S::Error> {
24882                use ::serde::ser::SerializeMap as _;
24883                let mut __map = __s.serialize_map(::core::option::Option::None)?;
24884                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
24885                    __map
24886                        .serialize_entry(
24887                            "triggerId",
24888                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
24889                        )?;
24890                }
24891                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
24892                    __map
24893                        .serialize_entry(
24894                            "subaccountId",
24895                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
24896                        )?;
24897                }
24898                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
24899                    __map
24900                        .serialize_entry(
24901                            "symbolId",
24902                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
24903                        )?;
24904                }
24905                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
24906                    __map.serialize_entry("symbol", self.symbol)?;
24907                }
24908                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
24909                    __map.serialize_entry("status", &self.status)?;
24910                }
24911                if let ::core::option::Option::Some(__v) = self.parent_order_id {
24912                    __map
24913                        .serialize_entry(
24914                            "parentOrderId",
24915                            &::buffa::json_helpers::ProtoJson(&__v),
24916                        )?;
24917                }
24918                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
24919                    __map
24920                        .serialize_entry(
24921                            "qtyScaled",
24922                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
24923                        )?;
24924                }
24925                if !::buffa::json_helpers::skip_if::is_default_enum_value(
24926                    &self.fee_asset,
24927                ) {
24928                    __map.serialize_entry("feeAsset", &self.fee_asset)?;
24929                }
24930                if !::buffa::json_helpers::skip_if::is_default_enum_value(
24931                    &self.self_trade_prevention_mode,
24932                ) {
24933                    __map
24934                        .serialize_entry(
24935                            "selfTradePreventionMode",
24936                            &self.self_trade_prevention_mode,
24937                        )?;
24938                }
24939                if !::buffa::json_helpers::skip_if::is_empty_str(
24940                    self.client_trigger_id,
24941                ) {
24942                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
24943                }
24944                {
24945                    if let ::core::option::Option::Some(__v) = self
24946                        .created_at
24947                        .as_option()
24948                    {
24949                        __map.serialize_entry("createdAt", __v)?;
24950                    }
24951                }
24952                {
24953                    if let ::core::option::Option::Some(__v) = self
24954                        .updated_at
24955                        .as_option()
24956                    {
24957                        __map.serialize_entry("updatedAt", __v)?;
24958                    }
24959                }
24960                {
24961                    if let ::core::option::Option::Some(__v) = self.armed_at.as_option()
24962                    {
24963                        __map.serialize_entry("armedAt", __v)?;
24964                    }
24965                }
24966                {
24967                    if let ::core::option::Option::Some(__v) = self
24968                        .completed_at
24969                        .as_option()
24970                    {
24971                        __map.serialize_entry("completedAt", __v)?;
24972                    }
24973                }
24974                if !self.child_order_ids.is_empty() {
24975                    __map
24976                        .serialize_entry(
24977                            "childOrderIds",
24978                            &::buffa::json_helpers::RepeatedJson(&self.child_order_ids),
24979                        )?;
24980                }
24981                if let ::core::option::Option::Some(ref __ov) = self.configuration {
24982                    match __ov {
24983                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24984                            v,
24985                        ) => {
24986                            __map.serialize_entry("stopLoss", v)?;
24987                        }
24988                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24989                            v,
24990                        ) => {
24991                            __map.serialize_entry("takeProfit", v)?;
24992                        }
24993                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24994                            v,
24995                        ) => {
24996                            __map.serialize_entry("trailingStop", v)?;
24997                        }
24998                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24999                            v,
25000                        ) => {
25001                            __map.serialize_entry("twap", v)?;
25002                        }
25003                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
25004                            v,
25005                        ) => {
25006                            __map.serialize_entry("ladder", v)?;
25007                        }
25008                    }
25009                }
25010                if let ::core::option::Option::Some(ref __ov) = self.runtime_details {
25011                    match __ov {
25012                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
25013                            v,
25014                        ) => {
25015                            __map.serialize_entry("stop", v)?;
25016                        }
25017                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
25018                            v,
25019                        ) => {
25020                            __map.serialize_entry("trailing", v)?;
25021                        }
25022                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
25023                            v,
25024                        ) => {
25025                            __map.serialize_entry("twapState", v)?;
25026                        }
25027                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
25028                            v,
25029                        ) => {
25030                            __map.serialize_entry("ladderState", v)?;
25031                        }
25032                    }
25033                }
25034                __map.end()
25035            }
25036        }
25037        impl<'a> ::buffa::MessageName for TriggerView<'a> {
25038            const PACKAGE: &'static str = "triggers.v1";
25039            const NAME: &'static str = "Trigger";
25040            const FULL_NAME: &'static str = "triggers.v1.Trigger";
25041            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
25042        }
25043        ::buffa::impl_default_view_instance!(TriggerView);
25044        ::buffa::impl_view_reborrow!(TriggerView);
25045        /** Self-contained, `'static` owned view of a `Trigger` message.
25046
25047 Wraps [`::buffa::OwnedView`]`<`[`TriggerView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
25048
25049 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TriggerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
25050        #[derive(Clone, Debug)]
25051        pub struct TriggerOwnedView(::buffa::OwnedView<TriggerView<'static>>);
25052        impl TriggerOwnedView {
25053            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
25054            ///
25055            /// The view borrows directly from the buffer's data; the buffer is
25056            /// retained inside the returned handle.
25057            ///
25058            /// # Errors
25059            ///
25060            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
25061            /// protobuf data.
25062            pub fn decode(
25063                bytes: ::buffa::bytes::Bytes,
25064            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25065                ::core::result::Result::Ok(
25066                    TriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
25067                )
25068            }
25069            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
25070            /// max message size).
25071            ///
25072            /// # Errors
25073            ///
25074            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
25075            /// exceeds the configured limits.
25076            pub fn decode_with_options(
25077                bytes: ::buffa::bytes::Bytes,
25078                opts: &::buffa::DecodeOptions,
25079            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25080                ::core::result::Result::Ok(
25081                    TriggerOwnedView(
25082                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
25083                    ),
25084                )
25085            }
25086            /// Build from an owned message via an encode → decode round-trip.
25087            ///
25088            /// # Errors
25089            ///
25090            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
25091            /// somehow invalid (should not happen for well-formed messages).
25092            pub fn from_owned(
25093                msg: &super::super::Trigger,
25094            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25095                ::core::result::Result::Ok(
25096                    TriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
25097                )
25098            }
25099            /// Borrow the full [`TriggerView`] with its lifetime tied to `&self`.
25100            #[must_use]
25101            pub fn view(&self) -> &TriggerView<'_> {
25102                self.0.reborrow()
25103            }
25104            /// Convert to the owned message type.
25105            ///
25106            /// # Errors
25107            ///
25108            /// Returns an error if re-materializing preserved unknown fields
25109            /// fails (e.g. the unknown-field limit is exceeded).
25110            pub fn to_owned_message(
25111                &self,
25112            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
25113                self.0.to_owned_message()
25114            }
25115            /// The underlying bytes buffer.
25116            #[must_use]
25117            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
25118                self.0.bytes()
25119            }
25120            /// Consume the handle, returning the underlying bytes buffer.
25121            #[must_use]
25122            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
25123                self.0.into_bytes()
25124            }
25125            /// Trigger ID.
25126            ///
25127            /// Field 1: `trigger_id`
25128            #[must_use]
25129            pub fn trigger_id(&self) -> u64 {
25130                self.0.reborrow().trigger_id
25131            }
25132            /// Public account or sub-account ID associated with the trigger.
25133            ///
25134            /// Field 2: `subaccount_id`
25135            #[must_use]
25136            pub fn subaccount_id(&self) -> u64 {
25137                self.0.reborrow().subaccount_id
25138            }
25139            /// Trading symbol numeric identifier.
25140            ///
25141            /// Field 3: `symbol_id`
25142            #[must_use]
25143            pub fn symbol_id(&self) -> u32 {
25144                self.0.reborrow().symbol_id
25145            }
25146            /// Trading symbol, for example "BTC-USDT".
25147            ///
25148            /// Field 4: `symbol`
25149            #[must_use]
25150            pub fn symbol(&self) -> &'_ str {
25151                self.0.reborrow().symbol
25152            }
25153            /// Current trigger lifecycle status.
25154            ///
25155            /// Field 5: `status`
25156            #[must_use]
25157            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
25158                self.0.reborrow().status
25159            }
25160            /// Parent order ID for attached-risk triggers; empty for standalone triggers.
25161            ///
25162            /// Field 6: `parent_order_id`
25163            #[must_use]
25164            pub fn parent_order_id(&self) -> ::core::option::Option<u64> {
25165                self.0.reborrow().parent_order_id
25166            }
25167            /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
25168            ///
25169            /// Field 20: `qty_scaled`
25170            #[must_use]
25171            pub fn qty_scaled(&self) -> i64 {
25172                self.0.reborrow().qty_scaled
25173            }
25174            /// Fee asset for BUY child orders.
25175            ///
25176            /// Field 21: `fee_asset`
25177            #[must_use]
25178            pub fn fee_asset(
25179                &self,
25180            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::FeeAsset> {
25181                self.0.reborrow().fee_asset
25182            }
25183            /// Self-trade prevention mode for child orders.
25184            ///
25185            /// Field 22: `self_trade_prevention_mode`
25186            #[must_use]
25187            pub fn self_trade_prevention_mode(
25188                &self,
25189            ) -> ::buffa::EnumValue<
25190                super::super::super::super::orders::v1::SelfTradePreventionMode,
25191            > {
25192                self.0.reborrow().self_trade_prevention_mode
25193            }
25194            /// Client-provided trigger ID for idempotency and correlation.
25195            ///
25196            /// Field 60: `client_trigger_id`
25197            #[must_use]
25198            pub fn client_trigger_id(&self) -> &'_ str {
25199                self.0.reborrow().client_trigger_id
25200            }
25201            /// Creation timestamp.
25202            ///
25203            /// Field 61: `created_at`
25204            #[must_use]
25205            pub fn created_at(
25206                &self,
25207            ) -> &::buffa::MessageFieldView<
25208                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25209            > {
25210                &self.0.reborrow().created_at
25211            }
25212            /// Last update timestamp.
25213            ///
25214            /// Field 62: `updated_at`
25215            #[must_use]
25216            pub fn updated_at(
25217                &self,
25218            ) -> &::buffa::MessageFieldView<
25219                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25220            > {
25221                &self.0.reborrow().updated_at
25222            }
25223            /// Timestamp when the trigger became armed.
25224            ///
25225            /// Field 63: `armed_at`
25226            #[must_use]
25227            pub fn armed_at(
25228                &self,
25229            ) -> &::buffa::MessageFieldView<
25230                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25231            > {
25232                &self.0.reborrow().armed_at
25233            }
25234            /// Timestamp when the trigger reached a terminal successful state.
25235            ///
25236            /// Field 64: `completed_at`
25237            #[must_use]
25238            pub fn completed_at(
25239                &self,
25240            ) -> &::buffa::MessageFieldView<
25241                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25242            > {
25243                &self.0.reborrow().completed_at
25244            }
25245            /// Child orders spawned by this trigger.
25246            ///
25247            /// Field 70: `child_order_ids`
25248            #[must_use]
25249            pub fn child_order_ids(&self) -> &::buffa::RepeatedView<'_, u64> {
25250                &self.0.reborrow().child_order_ids
25251            }
25252            /// Oneof `configuration`.
25253            #[must_use]
25254            pub fn configuration(
25255                &self,
25256            ) -> ::core::option::Option<
25257                &super::super::__buffa::view::oneof::trigger::Configuration<'_>,
25258            > {
25259                self.0.reborrow().configuration.as_ref()
25260            }
25261            /// Oneof `runtime_details`.
25262            #[must_use]
25263            pub fn runtime_details(
25264                &self,
25265            ) -> ::core::option::Option<
25266                &super::super::__buffa::view::oneof::trigger::RuntimeDetails<'_>,
25267            > {
25268                self.0.reborrow().runtime_details.as_ref()
25269            }
25270        }
25271        impl ::core::convert::From<::buffa::OwnedView<TriggerView<'static>>>
25272        for TriggerOwnedView {
25273            fn from(inner: ::buffa::OwnedView<TriggerView<'static>>) -> Self {
25274                TriggerOwnedView(inner)
25275            }
25276        }
25277        impl ::core::convert::From<TriggerOwnedView>
25278        for ::buffa::OwnedView<TriggerView<'static>> {
25279            fn from(wrapper: TriggerOwnedView) -> Self {
25280                wrapper.0
25281            }
25282        }
25283        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerView<'static>>>
25284        for TriggerOwnedView {
25285            fn as_ref(&self) -> &::buffa::OwnedView<TriggerView<'static>> {
25286                &self.0
25287            }
25288        }
25289        impl ::buffa::HasMessageView for super::super::Trigger {
25290            type View<'a> = TriggerView<'a>;
25291            type ViewHandle = TriggerOwnedView;
25292        }
25293        impl ::serde::Serialize for TriggerOwnedView {
25294            fn serialize<__S: ::serde::Serializer>(
25295                &self,
25296                __s: __S,
25297            ) -> ::core::result::Result<__S::Ok, __S::Error> {
25298                ::serde::Serialize::serialize(&self.0, __s)
25299            }
25300        }
25301        pub mod oneof {
25302            #[allow(unused_imports)]
25303            use super::*;
25304            pub mod conditional_child_execution {
25305                #[allow(unused_imports)]
25306                use super::*;
25307                #[derive(Clone, Debug)]
25308                pub enum Execution<'a> {
25309                    MarketIoc(
25310                        ::buffa::alloc::boxed::Box<
25311                            super::super::super::super::__buffa::view::TriggerMarketIocView<
25312                                'a,
25313                            >,
25314                        >,
25315                    ),
25316                    LimitGtc(
25317                        ::buffa::alloc::boxed::Box<
25318                            super::super::super::super::__buffa::view::TriggerLimitGtcView<
25319                                'a,
25320                            >,
25321                        >,
25322                    ),
25323                    LimitIoc(
25324                        ::buffa::alloc::boxed::Box<
25325                            super::super::super::super::__buffa::view::TriggerLimitIocView<
25326                                'a,
25327                            >,
25328                        >,
25329                    ),
25330                    LimitFok(
25331                        ::buffa::alloc::boxed::Box<
25332                            super::super::super::super::__buffa::view::TriggerLimitFokView<
25333                                'a,
25334                            >,
25335                        >,
25336                    ),
25337                }
25338            }
25339            pub mod trailing_stop_trigger {
25340                #[allow(unused_imports)]
25341                use super::*;
25342                #[derive(Clone, Debug)]
25343                pub enum TrailingDistance {
25344                    TrailingDistanceTicks(i64),
25345                    TrailingDistanceBps(i32),
25346                }
25347                #[derive(Clone, Debug)]
25348                pub enum MaxSlippage {
25349                    MaxSlippageTicks(i32),
25350                    MaxSlippageBps(i32),
25351                }
25352            }
25353            pub mod twap_trigger {
25354                #[allow(unused_imports)]
25355                use super::*;
25356                #[derive(Clone, Debug)]
25357                pub enum Execution<'a> {
25358                    MarketIoc(
25359                        ::buffa::alloc::boxed::Box<
25360                            super::super::super::super::__buffa::view::TwapMarketIocView<
25361                                'a,
25362                            >,
25363                        >,
25364                    ),
25365                    LimitGtc(
25366                        ::buffa::alloc::boxed::Box<
25367                            super::super::super::super::__buffa::view::TwapLimitGtcView<
25368                                'a,
25369                            >,
25370                        >,
25371                    ),
25372                }
25373            }
25374            pub mod trigger_intent {
25375                #[allow(unused_imports)]
25376                use super::*;
25377                #[derive(Clone, Debug)]
25378                pub enum Strategy<'a> {
25379                    StopLoss(
25380                        ::buffa::alloc::boxed::Box<
25381                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25382                                'a,
25383                            >,
25384                        >,
25385                    ),
25386                    TakeProfit(
25387                        ::buffa::alloc::boxed::Box<
25388                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25389                                'a,
25390                            >,
25391                        >,
25392                    ),
25393                    TrailingStop(
25394                        ::buffa::alloc::boxed::Box<
25395                            super::super::super::super::__buffa::view::TrailingStopTriggerView<
25396                                'a,
25397                            >,
25398                        >,
25399                    ),
25400                    Twap(
25401                        ::buffa::alloc::boxed::Box<
25402                            super::super::super::super::__buffa::view::TwapTriggerView<
25403                                'a,
25404                            >,
25405                        >,
25406                    ),
25407                    Ladder(
25408                        ::buffa::alloc::boxed::Box<
25409                            super::super::super::super::__buffa::view::LadderTriggerView<
25410                                'a,
25411                            >,
25412                        >,
25413                    ),
25414                }
25415            }
25416            pub mod modify_trigger_request {
25417                #[allow(unused_imports)]
25418                use super::*;
25419                #[derive(Clone, Debug)]
25420                pub enum TrailingDistance {
25421                    TrailingDistanceTicks(i64),
25422                    TrailingDistanceBps(i32),
25423                }
25424                #[derive(Clone, Debug)]
25425                pub enum MaxSlippage {
25426                    MaxSlippageTicks(i32),
25427                    MaxSlippageBps(i32),
25428                }
25429            }
25430            pub mod trigger {
25431                #[allow(unused_imports)]
25432                use super::*;
25433                #[derive(Clone, Debug)]
25434                pub enum Configuration<'a> {
25435                    StopLoss(
25436                        ::buffa::alloc::boxed::Box<
25437                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25438                                'a,
25439                            >,
25440                        >,
25441                    ),
25442                    TakeProfit(
25443                        ::buffa::alloc::boxed::Box<
25444                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25445                                'a,
25446                            >,
25447                        >,
25448                    ),
25449                    TrailingStop(
25450                        ::buffa::alloc::boxed::Box<
25451                            super::super::super::super::__buffa::view::TrailingStopTriggerView<
25452                                'a,
25453                            >,
25454                        >,
25455                    ),
25456                    Twap(
25457                        ::buffa::alloc::boxed::Box<
25458                            super::super::super::super::__buffa::view::TwapTriggerView<
25459                                'a,
25460                            >,
25461                        >,
25462                    ),
25463                    Ladder(
25464                        ::buffa::alloc::boxed::Box<
25465                            super::super::super::super::__buffa::view::LadderTriggerView<
25466                                'a,
25467                            >,
25468                        >,
25469                    ),
25470                }
25471                #[derive(Clone, Debug)]
25472                pub enum RuntimeDetails<'a> {
25473                    Stop(
25474                        ::buffa::alloc::boxed::Box<
25475                            super::super::super::super::__buffa::view::StopDetailsView<
25476                                'a,
25477                            >,
25478                        >,
25479                    ),
25480                    Trailing(
25481                        ::buffa::alloc::boxed::Box<
25482                            super::super::super::super::__buffa::view::TrailingDetailsView<
25483                                'a,
25484                            >,
25485                        >,
25486                    ),
25487                    TwapState(
25488                        ::buffa::alloc::boxed::Box<
25489                            super::super::super::super::__buffa::view::TwapDetailsView<
25490                                'a,
25491                            >,
25492                        >,
25493                    ),
25494                    LadderState(
25495                        ::buffa::alloc::boxed::Box<
25496                            super::super::super::super::__buffa::view::LadderDetailsView<
25497                                'a,
25498                            >,
25499                        >,
25500                    ),
25501                }
25502            }
25503        }
25504    }
25505    pub mod oneof {
25506        #[allow(unused_imports)]
25507        use super::*;
25508        pub mod conditional_child_execution {
25509            #[allow(unused_imports)]
25510            use super::*;
25511            #[derive(Clone, PartialEq, Debug)]
25512            pub enum Execution {
25513                MarketIoc(
25514                    ::buffa::alloc::boxed::Box<super::super::super::TriggerMarketIoc>,
25515                ),
25516                LimitGtc(
25517                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitGtc>,
25518                ),
25519                LimitIoc(
25520                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitIoc>,
25521                ),
25522                LimitFok(
25523                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitFok>,
25524                ),
25525            }
25526            impl ::buffa::Oneof for Execution {}
25527            impl From<super::super::super::TriggerMarketIoc> for Execution {
25528                fn from(v: super::super::super::TriggerMarketIoc) -> Self {
25529                    Self::MarketIoc(::buffa::alloc::boxed::Box::new(v))
25530                }
25531            }
25532            impl From<super::super::super::TriggerMarketIoc>
25533            for ::core::option::Option<Execution> {
25534                fn from(v: super::super::super::TriggerMarketIoc) -> Self {
25535                    Self::Some(Execution::from(v))
25536                }
25537            }
25538            impl From<super::super::super::TriggerLimitGtc> for Execution {
25539                fn from(v: super::super::super::TriggerLimitGtc) -> Self {
25540                    Self::LimitGtc(::buffa::alloc::boxed::Box::new(v))
25541                }
25542            }
25543            impl From<super::super::super::TriggerLimitGtc>
25544            for ::core::option::Option<Execution> {
25545                fn from(v: super::super::super::TriggerLimitGtc) -> Self {
25546                    Self::Some(Execution::from(v))
25547                }
25548            }
25549            impl From<super::super::super::TriggerLimitIoc> for Execution {
25550                fn from(v: super::super::super::TriggerLimitIoc) -> Self {
25551                    Self::LimitIoc(::buffa::alloc::boxed::Box::new(v))
25552                }
25553            }
25554            impl From<super::super::super::TriggerLimitIoc>
25555            for ::core::option::Option<Execution> {
25556                fn from(v: super::super::super::TriggerLimitIoc) -> Self {
25557                    Self::Some(Execution::from(v))
25558                }
25559            }
25560            impl From<super::super::super::TriggerLimitFok> for Execution {
25561                fn from(v: super::super::super::TriggerLimitFok) -> Self {
25562                    Self::LimitFok(::buffa::alloc::boxed::Box::new(v))
25563                }
25564            }
25565            impl From<super::super::super::TriggerLimitFok>
25566            for ::core::option::Option<Execution> {
25567                fn from(v: super::super::super::TriggerLimitFok) -> Self {
25568                    Self::Some(Execution::from(v))
25569                }
25570            }
25571            impl serde::Serialize for Execution {
25572                fn serialize<S: serde::Serializer>(
25573                    &self,
25574                    s: S,
25575                ) -> ::core::result::Result<S::Ok, S::Error> {
25576                    use serde::ser::SerializeMap;
25577                    let mut map = s.serialize_map(Some(1))?;
25578                    match self {
25579                        Self::MarketIoc(v) => {
25580                            map.serialize_entry("marketIoc", v)?;
25581                        }
25582                        Self::LimitGtc(v) => {
25583                            map.serialize_entry("limitGtc", v)?;
25584                        }
25585                        Self::LimitIoc(v) => {
25586                            map.serialize_entry("limitIoc", v)?;
25587                        }
25588                        Self::LimitFok(v) => {
25589                            map.serialize_entry("limitFok", v)?;
25590                        }
25591                    }
25592                    map.end()
25593                }
25594            }
25595        }
25596        pub mod trailing_stop_trigger {
25597            #[allow(unused_imports)]
25598            use super::*;
25599            /// Required trailing distance.
25600            #[derive(Clone, PartialEq, Debug)]
25601            pub enum TrailingDistance {
25602                TrailingDistanceTicks(i64),
25603                TrailingDistanceBps(i32),
25604            }
25605            impl ::buffa::Oneof for TrailingDistance {}
25606            impl serde::Serialize for TrailingDistance {
25607                fn serialize<S: serde::Serializer>(
25608                    &self,
25609                    s: S,
25610                ) -> ::core::result::Result<S::Ok, S::Error> {
25611                    use serde::ser::SerializeMap;
25612                    let mut map = s.serialize_map(Some(1))?;
25613                    match self {
25614                        Self::TrailingDistanceTicks(v) => {
25615                            map.serialize_entry(
25616                                "trailingDistanceTicks",
25617                                &::buffa::json_helpers::ProtoJson(v),
25618                            )?;
25619                        }
25620                        Self::TrailingDistanceBps(v) => {
25621                            map.serialize_entry(
25622                                "trailingDistanceBps",
25623                                &::buffa::json_helpers::ProtoJson(v),
25624                            )?;
25625                        }
25626                    }
25627                    map.end()
25628                }
25629            }
25630            /// Optional protection applied when the market child fires.
25631            #[derive(Clone, PartialEq, Debug)]
25632            pub enum MaxSlippage {
25633                MaxSlippageTicks(i32),
25634                MaxSlippageBps(i32),
25635            }
25636            impl ::buffa::Oneof for MaxSlippage {}
25637            impl serde::Serialize for MaxSlippage {
25638                fn serialize<S: serde::Serializer>(
25639                    &self,
25640                    s: S,
25641                ) -> ::core::result::Result<S::Ok, S::Error> {
25642                    use serde::ser::SerializeMap;
25643                    let mut map = s.serialize_map(Some(1))?;
25644                    match self {
25645                        Self::MaxSlippageTicks(v) => {
25646                            map.serialize_entry(
25647                                "maxSlippageTicks",
25648                                &::buffa::json_helpers::ProtoJson(v),
25649                            )?;
25650                        }
25651                        Self::MaxSlippageBps(v) => {
25652                            map.serialize_entry(
25653                                "maxSlippageBps",
25654                                &::buffa::json_helpers::ProtoJson(v),
25655                            )?;
25656                        }
25657                    }
25658                    map.end()
25659                }
25660            }
25661        }
25662        pub mod twap_trigger {
25663            #[allow(unused_imports)]
25664            use super::*;
25665            /// Proven slice execution behavior.
25666            #[derive(Clone, PartialEq, Debug)]
25667            pub enum Execution {
25668                MarketIoc(
25669                    ::buffa::alloc::boxed::Box<super::super::super::TwapMarketIoc>,
25670                ),
25671                LimitGtc(::buffa::alloc::boxed::Box<super::super::super::TwapLimitGtc>),
25672            }
25673            impl ::buffa::Oneof for Execution {}
25674            impl From<super::super::super::TwapMarketIoc> for Execution {
25675                fn from(v: super::super::super::TwapMarketIoc) -> Self {
25676                    Self::MarketIoc(::buffa::alloc::boxed::Box::new(v))
25677                }
25678            }
25679            impl From<super::super::super::TwapMarketIoc>
25680            for ::core::option::Option<Execution> {
25681                fn from(v: super::super::super::TwapMarketIoc) -> Self {
25682                    Self::Some(Execution::from(v))
25683                }
25684            }
25685            impl From<super::super::super::TwapLimitGtc> for Execution {
25686                fn from(v: super::super::super::TwapLimitGtc) -> Self {
25687                    Self::LimitGtc(::buffa::alloc::boxed::Box::new(v))
25688                }
25689            }
25690            impl From<super::super::super::TwapLimitGtc>
25691            for ::core::option::Option<Execution> {
25692                fn from(v: super::super::super::TwapLimitGtc) -> Self {
25693                    Self::Some(Execution::from(v))
25694                }
25695            }
25696            impl serde::Serialize for Execution {
25697                fn serialize<S: serde::Serializer>(
25698                    &self,
25699                    s: S,
25700                ) -> ::core::result::Result<S::Ok, S::Error> {
25701                    use serde::ser::SerializeMap;
25702                    let mut map = s.serialize_map(Some(1))?;
25703                    match self {
25704                        Self::MarketIoc(v) => {
25705                            map.serialize_entry("marketIoc", v)?;
25706                        }
25707                        Self::LimitGtc(v) => {
25708                            map.serialize_entry("limitGtc", v)?;
25709                        }
25710                    }
25711                    map.end()
25712                }
25713            }
25714        }
25715        pub mod trigger_intent {
25716            #[allow(unused_imports)]
25717            use super::*;
25718            /// Required trigger strategy.
25719            #[derive(Clone, PartialEq, Debug)]
25720            pub enum Strategy {
25721                StopLoss(
25722                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25723                ),
25724                TakeProfit(
25725                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25726                ),
25727                TrailingStop(
25728                    ::buffa::alloc::boxed::Box<super::super::super::TrailingStopTrigger>,
25729                ),
25730                Twap(::buffa::alloc::boxed::Box<super::super::super::TwapTrigger>),
25731                Ladder(::buffa::alloc::boxed::Box<super::super::super::LadderTrigger>),
25732            }
25733            impl ::buffa::Oneof for Strategy {}
25734            impl From<super::super::super::TrailingStopTrigger> for Strategy {
25735                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25736                    Self::TrailingStop(::buffa::alloc::boxed::Box::new(v))
25737                }
25738            }
25739            impl From<super::super::super::TrailingStopTrigger>
25740            for ::core::option::Option<Strategy> {
25741                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25742                    Self::Some(Strategy::from(v))
25743                }
25744            }
25745            impl From<super::super::super::TwapTrigger> for Strategy {
25746                fn from(v: super::super::super::TwapTrigger) -> Self {
25747                    Self::Twap(::buffa::alloc::boxed::Box::new(v))
25748                }
25749            }
25750            impl From<super::super::super::TwapTrigger>
25751            for ::core::option::Option<Strategy> {
25752                fn from(v: super::super::super::TwapTrigger) -> Self {
25753                    Self::Some(Strategy::from(v))
25754                }
25755            }
25756            impl From<super::super::super::LadderTrigger> for Strategy {
25757                fn from(v: super::super::super::LadderTrigger) -> Self {
25758                    Self::Ladder(::buffa::alloc::boxed::Box::new(v))
25759                }
25760            }
25761            impl From<super::super::super::LadderTrigger>
25762            for ::core::option::Option<Strategy> {
25763                fn from(v: super::super::super::LadderTrigger) -> Self {
25764                    Self::Some(Strategy::from(v))
25765                }
25766            }
25767            impl serde::Serialize for Strategy {
25768                fn serialize<S: serde::Serializer>(
25769                    &self,
25770                    s: S,
25771                ) -> ::core::result::Result<S::Ok, S::Error> {
25772                    use serde::ser::SerializeMap;
25773                    let mut map = s.serialize_map(Some(1))?;
25774                    match self {
25775                        Self::StopLoss(v) => {
25776                            map.serialize_entry("stopLoss", v)?;
25777                        }
25778                        Self::TakeProfit(v) => {
25779                            map.serialize_entry("takeProfit", v)?;
25780                        }
25781                        Self::TrailingStop(v) => {
25782                            map.serialize_entry("trailingStop", v)?;
25783                        }
25784                        Self::Twap(v) => {
25785                            map.serialize_entry("twap", v)?;
25786                        }
25787                        Self::Ladder(v) => {
25788                            map.serialize_entry("ladder", v)?;
25789                        }
25790                    }
25791                    map.end()
25792                }
25793            }
25794        }
25795        pub mod modify_trigger_request {
25796            #[allow(unused_imports)]
25797            use super::*;
25798            /// For trailing stop:
25799            #[derive(Clone, PartialEq, Debug)]
25800            pub enum TrailingDistance {
25801                TrailingDistanceTicks(i64),
25802                TrailingDistanceBps(i32),
25803            }
25804            impl ::buffa::Oneof for TrailingDistance {}
25805            impl serde::Serialize for TrailingDistance {
25806                fn serialize<S: serde::Serializer>(
25807                    &self,
25808                    s: S,
25809                ) -> ::core::result::Result<S::Ok, S::Error> {
25810                    use serde::ser::SerializeMap;
25811                    let mut map = s.serialize_map(Some(1))?;
25812                    match self {
25813                        Self::TrailingDistanceTicks(v) => {
25814                            map.serialize_entry(
25815                                "trailingDistanceTicks",
25816                                &::buffa::json_helpers::ProtoJson(v),
25817                            )?;
25818                        }
25819                        Self::TrailingDistanceBps(v) => {
25820                            map.serialize_entry(
25821                                "trailingDistanceBps",
25822                                &::buffa::json_helpers::ProtoJson(v),
25823                            )?;
25824                        }
25825                    }
25826                    map.end()
25827                }
25828            }
25829            /// Optional price protection.
25830            #[derive(Clone, PartialEq, Debug)]
25831            pub enum MaxSlippage {
25832                MaxSlippageTicks(i32),
25833                MaxSlippageBps(i32),
25834            }
25835            impl ::buffa::Oneof for MaxSlippage {}
25836            impl serde::Serialize for MaxSlippage {
25837                fn serialize<S: serde::Serializer>(
25838                    &self,
25839                    s: S,
25840                ) -> ::core::result::Result<S::Ok, S::Error> {
25841                    use serde::ser::SerializeMap;
25842                    let mut map = s.serialize_map(Some(1))?;
25843                    match self {
25844                        Self::MaxSlippageTicks(v) => {
25845                            map.serialize_entry(
25846                                "maxSlippageTicks",
25847                                &::buffa::json_helpers::ProtoJson(v),
25848                            )?;
25849                        }
25850                        Self::MaxSlippageBps(v) => {
25851                            map.serialize_entry(
25852                                "maxSlippageBps",
25853                                &::buffa::json_helpers::ProtoJson(v),
25854                            )?;
25855                        }
25856                    }
25857                    map.end()
25858                }
25859            }
25860        }
25861        pub mod trigger {
25862            #[allow(unused_imports)]
25863            use super::*;
25864            /// Immutable strategy configuration. The selected variant is the trigger
25865            /// category and uses the same shape accepted by CreateTrigger.
25866            #[derive(Clone, PartialEq, Debug)]
25867            pub enum Configuration {
25868                StopLoss(
25869                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25870                ),
25871                TakeProfit(
25872                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25873                ),
25874                TrailingStop(
25875                    ::buffa::alloc::boxed::Box<super::super::super::TrailingStopTrigger>,
25876                ),
25877                Twap(::buffa::alloc::boxed::Box<super::super::super::TwapTrigger>),
25878                Ladder(::buffa::alloc::boxed::Box<super::super::super::LadderTrigger>),
25879            }
25880            impl ::buffa::Oneof for Configuration {}
25881            impl From<super::super::super::TrailingStopTrigger> for Configuration {
25882                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25883                    Self::TrailingStop(::buffa::alloc::boxed::Box::new(v))
25884                }
25885            }
25886            impl From<super::super::super::TrailingStopTrigger>
25887            for ::core::option::Option<Configuration> {
25888                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25889                    Self::Some(Configuration::from(v))
25890                }
25891            }
25892            impl From<super::super::super::TwapTrigger> for Configuration {
25893                fn from(v: super::super::super::TwapTrigger) -> Self {
25894                    Self::Twap(::buffa::alloc::boxed::Box::new(v))
25895                }
25896            }
25897            impl From<super::super::super::TwapTrigger>
25898            for ::core::option::Option<Configuration> {
25899                fn from(v: super::super::super::TwapTrigger) -> Self {
25900                    Self::Some(Configuration::from(v))
25901                }
25902            }
25903            impl From<super::super::super::LadderTrigger> for Configuration {
25904                fn from(v: super::super::super::LadderTrigger) -> Self {
25905                    Self::Ladder(::buffa::alloc::boxed::Box::new(v))
25906                }
25907            }
25908            impl From<super::super::super::LadderTrigger>
25909            for ::core::option::Option<Configuration> {
25910                fn from(v: super::super::super::LadderTrigger) -> Self {
25911                    Self::Some(Configuration::from(v))
25912                }
25913            }
25914            impl serde::Serialize for Configuration {
25915                fn serialize<S: serde::Serializer>(
25916                    &self,
25917                    s: S,
25918                ) -> ::core::result::Result<S::Ok, S::Error> {
25919                    use serde::ser::SerializeMap;
25920                    let mut map = s.serialize_map(Some(1))?;
25921                    match self {
25922                        Self::StopLoss(v) => {
25923                            map.serialize_entry("stopLoss", v)?;
25924                        }
25925                        Self::TakeProfit(v) => {
25926                            map.serialize_entry("takeProfit", v)?;
25927                        }
25928                        Self::TrailingStop(v) => {
25929                            map.serialize_entry("trailingStop", v)?;
25930                        }
25931                        Self::Twap(v) => {
25932                            map.serialize_entry("twap", v)?;
25933                        }
25934                        Self::Ladder(v) => {
25935                            map.serialize_entry("ladder", v)?;
25936                        }
25937                    }
25938                    map.end()
25939                }
25940            }
25941            /// Type-specific runtime state.
25942            #[derive(Clone, PartialEq, Debug)]
25943            pub enum RuntimeDetails {
25944                Stop(::buffa::alloc::boxed::Box<super::super::super::StopDetails>),
25945                Trailing(
25946                    ::buffa::alloc::boxed::Box<super::super::super::TrailingDetails>,
25947                ),
25948                TwapState(::buffa::alloc::boxed::Box<super::super::super::TwapDetails>),
25949                LadderState(
25950                    ::buffa::alloc::boxed::Box<super::super::super::LadderDetails>,
25951                ),
25952            }
25953            impl ::buffa::Oneof for RuntimeDetails {}
25954            impl From<super::super::super::StopDetails> for RuntimeDetails {
25955                fn from(v: super::super::super::StopDetails) -> Self {
25956                    Self::Stop(::buffa::alloc::boxed::Box::new(v))
25957                }
25958            }
25959            impl From<super::super::super::StopDetails>
25960            for ::core::option::Option<RuntimeDetails> {
25961                fn from(v: super::super::super::StopDetails) -> Self {
25962                    Self::Some(RuntimeDetails::from(v))
25963                }
25964            }
25965            impl From<super::super::super::TrailingDetails> for RuntimeDetails {
25966                fn from(v: super::super::super::TrailingDetails) -> Self {
25967                    Self::Trailing(::buffa::alloc::boxed::Box::new(v))
25968                }
25969            }
25970            impl From<super::super::super::TrailingDetails>
25971            for ::core::option::Option<RuntimeDetails> {
25972                fn from(v: super::super::super::TrailingDetails) -> Self {
25973                    Self::Some(RuntimeDetails::from(v))
25974                }
25975            }
25976            impl From<super::super::super::TwapDetails> for RuntimeDetails {
25977                fn from(v: super::super::super::TwapDetails) -> Self {
25978                    Self::TwapState(::buffa::alloc::boxed::Box::new(v))
25979                }
25980            }
25981            impl From<super::super::super::TwapDetails>
25982            for ::core::option::Option<RuntimeDetails> {
25983                fn from(v: super::super::super::TwapDetails) -> Self {
25984                    Self::Some(RuntimeDetails::from(v))
25985                }
25986            }
25987            impl From<super::super::super::LadderDetails> for RuntimeDetails {
25988                fn from(v: super::super::super::LadderDetails) -> Self {
25989                    Self::LadderState(::buffa::alloc::boxed::Box::new(v))
25990                }
25991            }
25992            impl From<super::super::super::LadderDetails>
25993            for ::core::option::Option<RuntimeDetails> {
25994                fn from(v: super::super::super::LadderDetails) -> Self {
25995                    Self::Some(RuntimeDetails::from(v))
25996                }
25997            }
25998            impl serde::Serialize for RuntimeDetails {
25999                fn serialize<S: serde::Serializer>(
26000                    &self,
26001                    s: S,
26002                ) -> ::core::result::Result<S::Ok, S::Error> {
26003                    use serde::ser::SerializeMap;
26004                    let mut map = s.serialize_map(Some(1))?;
26005                    match self {
26006                        Self::Stop(v) => {
26007                            map.serialize_entry("stop", v)?;
26008                        }
26009                        Self::Trailing(v) => {
26010                            map.serialize_entry("trailing", v)?;
26011                        }
26012                        Self::TwapState(v) => {
26013                            map.serialize_entry("twapState", v)?;
26014                        }
26015                        Self::LadderState(v) => {
26016                            map.serialize_entry("ladderState", v)?;
26017                        }
26018                    }
26019                    map.end()
26020                }
26021            }
26022        }
26023    }
26024    /// Register this package's `Any` type entries and extension entries.
26025    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
26026        reg.register_json_any(super::__TRIGGER_MARKET_IOC_JSON_ANY);
26027        reg.register_json_any(super::__TRIGGER_LIMIT_GTC_JSON_ANY);
26028        reg.register_json_any(super::__TRIGGER_LIMIT_IOC_JSON_ANY);
26029        reg.register_json_any(super::__TRIGGER_LIMIT_FOK_JSON_ANY);
26030        reg.register_json_any(super::__CONDITIONAL_CHILD_EXECUTION_JSON_ANY);
26031        reg.register_json_any(super::__CONDITIONAL_TRIGGER_JSON_ANY);
26032        reg.register_json_any(super::__TRAILING_STOP_TRIGGER_JSON_ANY);
26033        reg.register_json_any(super::__TWAP_MARKET_IOC_JSON_ANY);
26034        reg.register_json_any(super::__TWAP_LIMIT_GTC_JSON_ANY);
26035        reg.register_json_any(super::__TWAP_TRIGGER_JSON_ANY);
26036        reg.register_json_any(super::__LADDER_TRIGGER_JSON_ANY);
26037        reg.register_json_any(super::__TRIGGER_INTENT_JSON_ANY);
26038        reg.register_json_any(super::__CREATE_TRIGGER_REQUEST_JSON_ANY);
26039        reg.register_json_any(super::__CREATE_TRIGGER_RESPONSE_JSON_ANY);
26040        reg.register_json_any(super::__GET_TRIGGER_REQUEST_JSON_ANY);
26041        reg.register_json_any(super::__GET_TRIGGER_RESPONSE_JSON_ANY);
26042        reg.register_json_any(super::__LIST_TRIGGERS_REQUEST_JSON_ANY);
26043        reg.register_json_any(super::__LIST_TRIGGERS_RESPONSE_JSON_ANY);
26044        reg.register_json_any(super::__LIST_TRIGGER_EVENTS_REQUEST_JSON_ANY);
26045        reg.register_json_any(super::__TRIGGER_EVENT_JSON_ANY);
26046        reg.register_json_any(super::__LIST_TRIGGER_EVENTS_RESPONSE_JSON_ANY);
26047        reg.register_json_any(super::__CANCEL_TRIGGER_REQUEST_JSON_ANY);
26048        reg.register_json_any(super::__CANCEL_TRIGGER_RESPONSE_JSON_ANY);
26049        reg.register_json_any(super::__MODIFY_TRIGGER_REQUEST_JSON_ANY);
26050        reg.register_json_any(super::__MODIFY_TRIGGER_RESPONSE_JSON_ANY);
26051        reg.register_json_any(super::__PAUSE_TRIGGER_REQUEST_JSON_ANY);
26052        reg.register_json_any(super::__PAUSE_TRIGGER_RESPONSE_JSON_ANY);
26053        reg.register_json_any(super::__RESUME_TRIGGER_REQUEST_JSON_ANY);
26054        reg.register_json_any(super::__RESUME_TRIGGER_RESPONSE_JSON_ANY);
26055        reg.register_json_any(super::__STOP_DETAILS_JSON_ANY);
26056        reg.register_json_any(super::__TRAILING_DETAILS_JSON_ANY);
26057        reg.register_json_any(super::__TWAP_DETAILS_JSON_ANY);
26058        reg.register_json_any(super::__LADDER_DETAILS_JSON_ANY);
26059        reg.register_json_any(super::__TRIGGER_JSON_ANY);
26060    }
26061}
26062#[doc(inline)]
26063pub use self::__buffa::view::TriggerMarketIocView;
26064#[doc(inline)]
26065pub use self::__buffa::view::TriggerMarketIocOwnedView;
26066#[doc(inline)]
26067pub use self::__buffa::view::TriggerLimitGtcView;
26068#[doc(inline)]
26069pub use self::__buffa::view::TriggerLimitGtcOwnedView;
26070#[doc(inline)]
26071pub use self::__buffa::view::TriggerLimitIocView;
26072#[doc(inline)]
26073pub use self::__buffa::view::TriggerLimitIocOwnedView;
26074#[doc(inline)]
26075pub use self::__buffa::view::TriggerLimitFokView;
26076#[doc(inline)]
26077pub use self::__buffa::view::TriggerLimitFokOwnedView;
26078#[doc(inline)]
26079pub use self::__buffa::view::ConditionalChildExecutionView;
26080#[doc(inline)]
26081pub use self::__buffa::view::ConditionalChildExecutionOwnedView;
26082#[doc(inline)]
26083pub use self::__buffa::view::ConditionalTriggerView;
26084#[doc(inline)]
26085pub use self::__buffa::view::ConditionalTriggerOwnedView;
26086#[doc(inline)]
26087pub use self::__buffa::view::TrailingStopTriggerView;
26088#[doc(inline)]
26089pub use self::__buffa::view::TrailingStopTriggerOwnedView;
26090#[doc(inline)]
26091pub use self::__buffa::view::TwapMarketIocView;
26092#[doc(inline)]
26093pub use self::__buffa::view::TwapMarketIocOwnedView;
26094#[doc(inline)]
26095pub use self::__buffa::view::TwapLimitGtcView;
26096#[doc(inline)]
26097pub use self::__buffa::view::TwapLimitGtcOwnedView;
26098#[doc(inline)]
26099pub use self::__buffa::view::TwapTriggerView;
26100#[doc(inline)]
26101pub use self::__buffa::view::TwapTriggerOwnedView;
26102#[doc(inline)]
26103pub use self::__buffa::view::LadderTriggerView;
26104#[doc(inline)]
26105pub use self::__buffa::view::LadderTriggerOwnedView;
26106#[doc(inline)]
26107pub use self::__buffa::view::TriggerIntentView;
26108#[doc(inline)]
26109pub use self::__buffa::view::TriggerIntentOwnedView;
26110#[doc(inline)]
26111pub use self::__buffa::view::CreateTriggerRequestView;
26112#[doc(inline)]
26113pub use self::__buffa::view::CreateTriggerRequestOwnedView;
26114#[doc(inline)]
26115pub use self::__buffa::view::CreateTriggerResponseView;
26116#[doc(inline)]
26117pub use self::__buffa::view::CreateTriggerResponseOwnedView;
26118#[doc(inline)]
26119pub use self::__buffa::view::GetTriggerRequestView;
26120#[doc(inline)]
26121pub use self::__buffa::view::GetTriggerRequestOwnedView;
26122#[doc(inline)]
26123pub use self::__buffa::view::GetTriggerResponseView;
26124#[doc(inline)]
26125pub use self::__buffa::view::GetTriggerResponseOwnedView;
26126#[doc(inline)]
26127pub use self::__buffa::view::ListTriggersRequestView;
26128#[doc(inline)]
26129pub use self::__buffa::view::ListTriggersRequestOwnedView;
26130#[doc(inline)]
26131pub use self::__buffa::view::ListTriggersResponseView;
26132#[doc(inline)]
26133pub use self::__buffa::view::ListTriggersResponseOwnedView;
26134#[doc(inline)]
26135pub use self::__buffa::view::ListTriggerEventsRequestView;
26136#[doc(inline)]
26137pub use self::__buffa::view::ListTriggerEventsRequestOwnedView;
26138#[doc(inline)]
26139pub use self::__buffa::view::TriggerEventView;
26140#[doc(inline)]
26141pub use self::__buffa::view::TriggerEventOwnedView;
26142#[doc(inline)]
26143pub use self::__buffa::view::ListTriggerEventsResponseView;
26144#[doc(inline)]
26145pub use self::__buffa::view::ListTriggerEventsResponseOwnedView;
26146#[doc(inline)]
26147pub use self::__buffa::view::CancelTriggerRequestView;
26148#[doc(inline)]
26149pub use self::__buffa::view::CancelTriggerRequestOwnedView;
26150#[doc(inline)]
26151pub use self::__buffa::view::CancelTriggerResponseView;
26152#[doc(inline)]
26153pub use self::__buffa::view::CancelTriggerResponseOwnedView;
26154#[doc(inline)]
26155pub use self::__buffa::view::ModifyTriggerRequestView;
26156#[doc(inline)]
26157pub use self::__buffa::view::ModifyTriggerRequestOwnedView;
26158#[doc(inline)]
26159pub use self::__buffa::view::ModifyTriggerResponseView;
26160#[doc(inline)]
26161pub use self::__buffa::view::ModifyTriggerResponseOwnedView;
26162#[doc(inline)]
26163pub use self::__buffa::view::PauseTriggerRequestView;
26164#[doc(inline)]
26165pub use self::__buffa::view::PauseTriggerRequestOwnedView;
26166#[doc(inline)]
26167pub use self::__buffa::view::PauseTriggerResponseView;
26168#[doc(inline)]
26169pub use self::__buffa::view::PauseTriggerResponseOwnedView;
26170#[doc(inline)]
26171pub use self::__buffa::view::ResumeTriggerRequestView;
26172#[doc(inline)]
26173pub use self::__buffa::view::ResumeTriggerRequestOwnedView;
26174#[doc(inline)]
26175pub use self::__buffa::view::ResumeTriggerResponseView;
26176#[doc(inline)]
26177pub use self::__buffa::view::ResumeTriggerResponseOwnedView;
26178#[doc(inline)]
26179pub use self::__buffa::view::StopDetailsView;
26180#[doc(inline)]
26181pub use self::__buffa::view::StopDetailsOwnedView;
26182#[doc(inline)]
26183pub use self::__buffa::view::TrailingDetailsView;
26184#[doc(inline)]
26185pub use self::__buffa::view::TrailingDetailsOwnedView;
26186#[doc(inline)]
26187pub use self::__buffa::view::TwapDetailsView;
26188#[doc(inline)]
26189pub use self::__buffa::view::TwapDetailsOwnedView;
26190#[doc(inline)]
26191pub use self::__buffa::view::LadderDetailsView;
26192#[doc(inline)]
26193pub use self::__buffa::view::LadderDetailsOwnedView;
26194#[doc(inline)]
26195pub use self::__buffa::view::TriggerView;
26196#[doc(inline)]
26197pub use self::__buffa::view::TriggerOwnedView;
26198#[doc(inline)]
26199pub use self::__buffa::register_types;