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 a spot trailing-stop strategy.
1817/// Standalone triggers currently support SELL market-IOC children. Attached
1818/// trailing stops may use either side, opposite their parent order.
1819#[derive(Clone, PartialEq, Default)]
1820#[derive(::serde::Serialize)]
1821#[serde(default)]
1822pub struct TrailingStopTrigger {
1823    /// Optional activation price in quote units scaled by 1e6.
1824    ///
1825    /// Field 3: `activation_price_ticks`
1826    #[serde(
1827        rename = "activationPriceTicks",
1828        alias = "activation_price_ticks",
1829        with = "::buffa::json_helpers::int64",
1830        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1831    )]
1832    pub activation_price_ticks: i64,
1833    /// Child order side.
1834    ///
1835    /// Field 6: `side`
1836    #[serde(
1837        rename = "side",
1838        with = "::buffa::json_helpers::proto_enum",
1839        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
1840    )]
1841    pub side: ::buffa::EnumValue<super::super::orders::v1::Side>,
1842    #[serde(flatten)]
1843    pub trailing_distance: ::core::option::Option<
1844        __buffa::oneof::trailing_stop_trigger::TrailingDistance,
1845    >,
1846    #[serde(flatten)]
1847    pub max_slippage: ::core::option::Option<
1848        __buffa::oneof::trailing_stop_trigger::MaxSlippage,
1849    >,
1850    #[serde(skip)]
1851    #[doc(hidden)]
1852    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1853}
1854impl ::core::fmt::Debug for TrailingStopTrigger {
1855    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1856        f.debug_struct("TrailingStopTrigger")
1857            .field("activation_price_ticks", &self.activation_price_ticks)
1858            .field("side", &self.side)
1859            .field("trailing_distance", &self.trailing_distance)
1860            .field("max_slippage", &self.max_slippage)
1861            .finish()
1862    }
1863}
1864impl TrailingStopTrigger {
1865    /// Protobuf type URL for this message, for use with `Any::pack` and
1866    /// `Any::unpack_if`.
1867    ///
1868    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1869    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
1870}
1871::buffa::impl_default_instance!(TrailingStopTrigger);
1872impl ::buffa::MessageName for TrailingStopTrigger {
1873    const PACKAGE: &'static str = "triggers.v1";
1874    const NAME: &'static str = "TrailingStopTrigger";
1875    const FULL_NAME: &'static str = "triggers.v1.TrailingStopTrigger";
1876    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
1877}
1878impl ::buffa::Message for TrailingStopTrigger {
1879    /// Returns the total encoded size in bytes.
1880    ///
1881    /// The result is a `u32`; the protobuf specification requires all
1882    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1883    /// compliant message will never overflow this type.
1884    #[allow(clippy::let_and_return)]
1885    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1886        #[allow(unused_imports)]
1887        use ::buffa::Enumeration as _;
1888        let mut size = 0u32;
1889        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
1890            match v {
1891                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
1892                    v,
1893                ) => {
1894                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
1895                }
1896                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
1897                    v,
1898                ) => {
1899                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1900                }
1901            }
1902        }
1903        if self.activation_price_ticks != 0i64 {
1904            size
1905                += 1u32
1906                    + ::buffa::types::int64_encoded_len(self.activation_price_ticks)
1907                        as u32;
1908        }
1909        if let ::core::option::Option::Some(ref v) = self.max_slippage {
1910            match v {
1911                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
1912                    v,
1913                ) => {
1914                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1915                }
1916                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
1917                    v,
1918                ) => {
1919                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1920                }
1921            }
1922        }
1923        {
1924            let val = self.side.to_i32();
1925            if val != 0 {
1926                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1927            }
1928        }
1929        size += self.__buffa_unknown_fields.encoded_len() as u32;
1930        size
1931    }
1932    fn write_to(
1933        &self,
1934        _cache: &mut ::buffa::SizeCache,
1935        buf: &mut impl ::buffa::bytes::BufMut,
1936    ) {
1937        #[allow(unused_imports)]
1938        use ::buffa::Enumeration as _;
1939        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
1940            match v {
1941                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
1942                    x,
1943                ) => {
1944                    ::buffa::types::put_int64_field(1u32, *x, buf);
1945                }
1946                __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
1947                    x,
1948                ) => {
1949                    ::buffa::types::put_int32_field(2u32, *x, buf);
1950                }
1951            }
1952        }
1953        if self.activation_price_ticks != 0i64 {
1954            ::buffa::types::put_int64_field(3u32, self.activation_price_ticks, buf);
1955        }
1956        if let ::core::option::Option::Some(ref v) = self.max_slippage {
1957            match v {
1958                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
1959                    x,
1960                ) => {
1961                    ::buffa::types::put_int32_field(4u32, *x, buf);
1962                }
1963                __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
1964                    x,
1965                ) => {
1966                    ::buffa::types::put_int32_field(5u32, *x, buf);
1967                }
1968            }
1969        }
1970        {
1971            let val = self.side.to_i32();
1972            if val != 0 {
1973                ::buffa::types::put_int32_field(6u32, val, buf);
1974            }
1975        }
1976        self.__buffa_unknown_fields.write_to(buf);
1977    }
1978    fn merge_field(
1979        &mut self,
1980        tag: ::buffa::encoding::Tag,
1981        buf: &mut impl ::buffa::bytes::Buf,
1982        ctx: ::buffa::DecodeContext<'_>,
1983    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1984        #[allow(unused_imports)]
1985        use ::buffa::bytes::Buf as _;
1986        #[allow(unused_imports)]
1987        use ::buffa::Enumeration as _;
1988        match tag.field_number() {
1989            1u32 => {
1990                ::buffa::encoding::check_wire_type(
1991                    tag,
1992                    ::buffa::encoding::WireType::Varint,
1993                )?;
1994                self.trailing_distance = ::core::option::Option::Some(
1995                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
1996                        ::buffa::types::decode_int64(buf)?,
1997                    ),
1998                );
1999            }
2000            2u32 => {
2001                ::buffa::encoding::check_wire_type(
2002                    tag,
2003                    ::buffa::encoding::WireType::Varint,
2004                )?;
2005                self.trailing_distance = ::core::option::Option::Some(
2006                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
2007                        ::buffa::types::decode_int32(buf)?,
2008                    ),
2009                );
2010            }
2011            3u32 => {
2012                ::buffa::encoding::check_wire_type(
2013                    tag,
2014                    ::buffa::encoding::WireType::Varint,
2015                )?;
2016                self.activation_price_ticks = ::buffa::types::decode_int64(buf)?;
2017            }
2018            4u32 => {
2019                ::buffa::encoding::check_wire_type(
2020                    tag,
2021                    ::buffa::encoding::WireType::Varint,
2022                )?;
2023                self.max_slippage = ::core::option::Option::Some(
2024                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
2025                        ::buffa::types::decode_int32(buf)?,
2026                    ),
2027                );
2028            }
2029            5u32 => {
2030                ::buffa::encoding::check_wire_type(
2031                    tag,
2032                    ::buffa::encoding::WireType::Varint,
2033                )?;
2034                self.max_slippage = ::core::option::Option::Some(
2035                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
2036                        ::buffa::types::decode_int32(buf)?,
2037                    ),
2038                );
2039            }
2040            6u32 => {
2041                ::buffa::encoding::check_wire_type(
2042                    tag,
2043                    ::buffa::encoding::WireType::Varint,
2044                )?;
2045                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
2046            }
2047            _ => {
2048                self.__buffa_unknown_fields
2049                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2050            }
2051        }
2052        ::core::result::Result::Ok(())
2053    }
2054    fn clear(&mut self) {
2055        self.trailing_distance = ::core::option::Option::None;
2056        self.activation_price_ticks = 0i64;
2057        self.max_slippage = ::core::option::Option::None;
2058        self.side = ::buffa::EnumValue::from(0);
2059        self.__buffa_unknown_fields.clear();
2060    }
2061}
2062impl ::buffa::ExtensionSet for TrailingStopTrigger {
2063    const PROTO_FQN: &'static str = "triggers.v1.TrailingStopTrigger";
2064    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2065        &self.__buffa_unknown_fields
2066    }
2067    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2068        &mut self.__buffa_unknown_fields
2069    }
2070}
2071impl<'de> serde::Deserialize<'de> for TrailingStopTrigger {
2072    fn deserialize<D: serde::Deserializer<'de>>(
2073        d: D,
2074    ) -> ::core::result::Result<Self, D::Error> {
2075        struct _V;
2076        impl<'de> serde::de::Visitor<'de> for _V {
2077            type Value = TrailingStopTrigger;
2078            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2079                f.write_str("struct TrailingStopTrigger")
2080            }
2081            #[allow(clippy::field_reassign_with_default)]
2082            fn visit_map<A: serde::de::MapAccess<'de>>(
2083                self,
2084                mut map: A,
2085            ) -> ::core::result::Result<TrailingStopTrigger, A::Error> {
2086                let mut __f_activation_price_ticks: ::core::option::Option<i64> = None;
2087                let mut __f_side: ::core::option::Option<
2088                    ::buffa::EnumValue<super::super::orders::v1::Side>,
2089                > = None;
2090                let mut __oneof_trailing_distance: ::core::option::Option<
2091                    __buffa::oneof::trailing_stop_trigger::TrailingDistance,
2092                > = None;
2093                let mut __oneof_max_slippage: ::core::option::Option<
2094                    __buffa::oneof::trailing_stop_trigger::MaxSlippage,
2095                > = None;
2096                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
2097                    match key.as_str() {
2098                        "activationPriceTicks" | "activation_price_ticks" => {
2099                            __f_activation_price_ticks = Some({
2100                                struct _S;
2101                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2102                                    type Value = i64;
2103                                    fn deserialize<D: serde::Deserializer<'de>>(
2104                                        self,
2105                                        d: D,
2106                                    ) -> ::core::result::Result<i64, D::Error> {
2107                                        ::buffa::json_helpers::int64::deserialize(d)
2108                                    }
2109                                }
2110                                map.next_value_seed(_S)?
2111                            });
2112                        }
2113                        "side" => {
2114                            __f_side = Some({
2115                                struct _S;
2116                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2117                                    type Value = ::buffa::EnumValue<
2118                                        super::super::orders::v1::Side,
2119                                    >;
2120                                    fn deserialize<D: serde::Deserializer<'de>>(
2121                                        self,
2122                                        d: D,
2123                                    ) -> ::core::result::Result<
2124                                        ::buffa::EnumValue<super::super::orders::v1::Side>,
2125                                        D::Error,
2126                                    > {
2127                                        ::buffa::json_helpers::proto_enum::deserialize(d)
2128                                    }
2129                                }
2130                                map.next_value_seed(_S)?
2131                            });
2132                        }
2133                        "trailingDistanceTicks" | "trailing_distance_ticks" => {
2134                            struct _DeserSeed;
2135                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2136                                type Value = i64;
2137                                fn deserialize<D: serde::Deserializer<'de>>(
2138                                    self,
2139                                    d: D,
2140                                ) -> ::core::result::Result<i64, D::Error> {
2141                                    ::buffa::json_helpers::int64::deserialize(d)
2142                                }
2143                            }
2144                            let v: ::core::option::Option<i64> = map
2145                                .next_value_seed(
2146                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2147                                )?;
2148                            if let Some(v) = v {
2149                                if __oneof_trailing_distance.is_some() {
2150                                    return Err(
2151                                        serde::de::Error::custom(
2152                                            "multiple oneof fields set for 'trailing_distance'",
2153                                        ),
2154                                    );
2155                                }
2156                                __oneof_trailing_distance = Some(
2157                                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
2158                                        v,
2159                                    ),
2160                                );
2161                            }
2162                        }
2163                        "trailingDistanceBps" | "trailing_distance_bps" => {
2164                            struct _DeserSeed;
2165                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2166                                type Value = i32;
2167                                fn deserialize<D: serde::Deserializer<'de>>(
2168                                    self,
2169                                    d: D,
2170                                ) -> ::core::result::Result<i32, D::Error> {
2171                                    ::buffa::json_helpers::int32::deserialize(d)
2172                                }
2173                            }
2174                            let v: ::core::option::Option<i32> = map
2175                                .next_value_seed(
2176                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2177                                )?;
2178                            if let Some(v) = v {
2179                                if __oneof_trailing_distance.is_some() {
2180                                    return Err(
2181                                        serde::de::Error::custom(
2182                                            "multiple oneof fields set for 'trailing_distance'",
2183                                        ),
2184                                    );
2185                                }
2186                                __oneof_trailing_distance = Some(
2187                                    __buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
2188                                        v,
2189                                    ),
2190                                );
2191                            }
2192                        }
2193                        "maxSlippageTicks" | "max_slippage_ticks" => {
2194                            struct _DeserSeed;
2195                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2196                                type Value = i32;
2197                                fn deserialize<D: serde::Deserializer<'de>>(
2198                                    self,
2199                                    d: D,
2200                                ) -> ::core::result::Result<i32, D::Error> {
2201                                    ::buffa::json_helpers::int32::deserialize(d)
2202                                }
2203                            }
2204                            let v: ::core::option::Option<i32> = map
2205                                .next_value_seed(
2206                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2207                                )?;
2208                            if let Some(v) = v {
2209                                if __oneof_max_slippage.is_some() {
2210                                    return Err(
2211                                        serde::de::Error::custom(
2212                                            "multiple oneof fields set for 'max_slippage'",
2213                                        ),
2214                                    );
2215                                }
2216                                __oneof_max_slippage = Some(
2217                                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
2218                                        v,
2219                                    ),
2220                                );
2221                            }
2222                        }
2223                        "maxSlippageBps" | "max_slippage_bps" => {
2224                            struct _DeserSeed;
2225                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
2226                                type Value = i32;
2227                                fn deserialize<D: serde::Deserializer<'de>>(
2228                                    self,
2229                                    d: D,
2230                                ) -> ::core::result::Result<i32, D::Error> {
2231                                    ::buffa::json_helpers::int32::deserialize(d)
2232                                }
2233                            }
2234                            let v: ::core::option::Option<i32> = map
2235                                .next_value_seed(
2236                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
2237                                )?;
2238                            if let Some(v) = v {
2239                                if __oneof_max_slippage.is_some() {
2240                                    return Err(
2241                                        serde::de::Error::custom(
2242                                            "multiple oneof fields set for 'max_slippage'",
2243                                        ),
2244                                    );
2245                                }
2246                                __oneof_max_slippage = Some(
2247                                    __buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
2248                                        v,
2249                                    ),
2250                                );
2251                            }
2252                        }
2253                        _ => {
2254                            map.next_value::<serde::de::IgnoredAny>()?;
2255                        }
2256                    }
2257                }
2258                let mut __r = <TrailingStopTrigger as ::core::default::Default>::default();
2259                if let ::core::option::Option::Some(v) = __f_activation_price_ticks {
2260                    __r.activation_price_ticks = v;
2261                }
2262                if let ::core::option::Option::Some(v) = __f_side {
2263                    __r.side = v;
2264                }
2265                __r.trailing_distance = __oneof_trailing_distance;
2266                __r.max_slippage = __oneof_max_slippage;
2267                Ok(__r)
2268            }
2269        }
2270        d.deserialize_map(_V)
2271    }
2272}
2273impl ::buffa::json_helpers::ProtoElemJson for TrailingStopTrigger {
2274    fn serialize_proto_json<S: ::serde::Serializer>(
2275        v: &Self,
2276        s: S,
2277    ) -> ::core::result::Result<S::Ok, S::Error> {
2278        ::serde::Serialize::serialize(v, s)
2279    }
2280    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2281        d: D,
2282    ) -> ::core::result::Result<Self, D::Error> {
2283        <Self as ::serde::Deserialize>::deserialize(d)
2284    }
2285}
2286#[doc(hidden)]
2287pub const __TRAILING_STOP_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2288    type_url: "type.googleapis.com/triggers.v1.TrailingStopTrigger",
2289    to_json: ::buffa::type_registry::any_to_json::<TrailingStopTrigger>,
2290    from_json: ::buffa::type_registry::any_from_json::<TrailingStopTrigger>,
2291    is_wkt: false,
2292};
2293pub mod trailing_stop_trigger {
2294    #[allow(unused_imports)]
2295    use super::*;
2296    #[doc(inline)]
2297    pub use super::__buffa::oneof::trailing_stop_trigger::TrailingDistance;
2298    #[doc(inline)]
2299    pub use super::__buffa::oneof::trailing_stop_trigger::MaxSlippage;
2300    #[doc(inline)]
2301    pub use super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance as TrailingDistanceView;
2302    #[doc(inline)]
2303    pub use super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage as MaxSlippageView;
2304}
2305/// TwapMarketIoc configures server-priced market-IOC slices.
2306#[derive(Clone, PartialEq, Default)]
2307#[derive(::serde::Serialize, ::serde::Deserialize)]
2308#[serde(default)]
2309pub struct TwapMarketIoc {
2310    #[serde(skip)]
2311    #[doc(hidden)]
2312    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2313}
2314impl ::core::fmt::Debug for TwapMarketIoc {
2315    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2316        f.debug_struct("TwapMarketIoc").finish()
2317    }
2318}
2319impl TwapMarketIoc {
2320    /// Protobuf type URL for this message, for use with `Any::pack` and
2321    /// `Any::unpack_if`.
2322    ///
2323    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2324    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
2325}
2326::buffa::impl_default_instance!(TwapMarketIoc);
2327impl ::buffa::MessageName for TwapMarketIoc {
2328    const PACKAGE: &'static str = "triggers.v1";
2329    const NAME: &'static str = "TwapMarketIoc";
2330    const FULL_NAME: &'static str = "triggers.v1.TwapMarketIoc";
2331    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
2332}
2333impl ::buffa::Message for TwapMarketIoc {
2334    /// Returns the total encoded size in bytes.
2335    ///
2336    /// The result is a `u32`; the protobuf specification requires all
2337    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2338    /// compliant message will never overflow this type.
2339    #[allow(clippy::let_and_return)]
2340    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2341        #[allow(unused_imports)]
2342        use ::buffa::Enumeration as _;
2343        let mut size = 0u32;
2344        size += self.__buffa_unknown_fields.encoded_len() as u32;
2345        size
2346    }
2347    fn write_to(
2348        &self,
2349        _cache: &mut ::buffa::SizeCache,
2350        buf: &mut impl ::buffa::bytes::BufMut,
2351    ) {
2352        #[allow(unused_imports)]
2353        use ::buffa::Enumeration as _;
2354        self.__buffa_unknown_fields.write_to(buf);
2355    }
2356    fn merge_field(
2357        &mut self,
2358        tag: ::buffa::encoding::Tag,
2359        buf: &mut impl ::buffa::bytes::Buf,
2360        ctx: ::buffa::DecodeContext<'_>,
2361    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2362        #[allow(unused_imports)]
2363        use ::buffa::bytes::Buf as _;
2364        #[allow(unused_imports)]
2365        use ::buffa::Enumeration as _;
2366        match tag.field_number() {
2367            _ => {
2368                self.__buffa_unknown_fields
2369                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2370            }
2371        }
2372        ::core::result::Result::Ok(())
2373    }
2374    fn clear(&mut self) {
2375        self.__buffa_unknown_fields.clear();
2376    }
2377}
2378impl ::buffa::ExtensionSet for TwapMarketIoc {
2379    const PROTO_FQN: &'static str = "triggers.v1.TwapMarketIoc";
2380    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2381        &self.__buffa_unknown_fields
2382    }
2383    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2384        &mut self.__buffa_unknown_fields
2385    }
2386}
2387impl ::buffa::json_helpers::ProtoElemJson for TwapMarketIoc {
2388    fn serialize_proto_json<S: ::serde::Serializer>(
2389        v: &Self,
2390        s: S,
2391    ) -> ::core::result::Result<S::Ok, S::Error> {
2392        ::serde::Serialize::serialize(v, s)
2393    }
2394    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2395        d: D,
2396    ) -> ::core::result::Result<Self, D::Error> {
2397        <Self as ::serde::Deserialize>::deserialize(d)
2398    }
2399}
2400#[doc(hidden)]
2401pub const __TWAP_MARKET_IOC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2402    type_url: "type.googleapis.com/triggers.v1.TwapMarketIoc",
2403    to_json: ::buffa::type_registry::any_to_json::<TwapMarketIoc>,
2404    from_json: ::buffa::type_registry::any_from_json::<TwapMarketIoc>,
2405    is_wkt: false,
2406};
2407/// TwapLimitGtc configures one resting limit slice at a time. A previous open
2408/// slice is canceled before the next interval.
2409#[derive(Clone, PartialEq, Default)]
2410#[derive(::serde::Serialize, ::serde::Deserialize)]
2411#[serde(default)]
2412pub struct TwapLimitGtc {
2413    /// Slice limit price in quote units scaled by 1e6.
2414    ///
2415    /// Field 1: `price_ticks`
2416    #[serde(
2417        rename = "priceTicks",
2418        alias = "price_ticks",
2419        with = "::buffa::json_helpers::int64",
2420        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2421    )]
2422    pub price_ticks: i64,
2423    #[serde(skip)]
2424    #[doc(hidden)]
2425    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2426}
2427impl ::core::fmt::Debug for TwapLimitGtc {
2428    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2429        f.debug_struct("TwapLimitGtc").field("price_ticks", &self.price_ticks).finish()
2430    }
2431}
2432impl TwapLimitGtc {
2433    /// Protobuf type URL for this message, for use with `Any::pack` and
2434    /// `Any::unpack_if`.
2435    ///
2436    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2437    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
2438}
2439::buffa::impl_default_instance!(TwapLimitGtc);
2440impl ::buffa::MessageName for TwapLimitGtc {
2441    const PACKAGE: &'static str = "triggers.v1";
2442    const NAME: &'static str = "TwapLimitGtc";
2443    const FULL_NAME: &'static str = "triggers.v1.TwapLimitGtc";
2444    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
2445}
2446impl ::buffa::Message for TwapLimitGtc {
2447    /// Returns the total encoded size in bytes.
2448    ///
2449    /// The result is a `u32`; the protobuf specification requires all
2450    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2451    /// compliant message will never overflow this type.
2452    #[allow(clippy::let_and_return)]
2453    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2454        #[allow(unused_imports)]
2455        use ::buffa::Enumeration as _;
2456        let mut size = 0u32;
2457        if self.price_ticks != 0i64 {
2458            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
2459        }
2460        size += self.__buffa_unknown_fields.encoded_len() as u32;
2461        size
2462    }
2463    fn write_to(
2464        &self,
2465        _cache: &mut ::buffa::SizeCache,
2466        buf: &mut impl ::buffa::bytes::BufMut,
2467    ) {
2468        #[allow(unused_imports)]
2469        use ::buffa::Enumeration as _;
2470        if self.price_ticks != 0i64 {
2471            ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
2472        }
2473        self.__buffa_unknown_fields.write_to(buf);
2474    }
2475    fn merge_field(
2476        &mut self,
2477        tag: ::buffa::encoding::Tag,
2478        buf: &mut impl ::buffa::bytes::Buf,
2479        ctx: ::buffa::DecodeContext<'_>,
2480    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2481        #[allow(unused_imports)]
2482        use ::buffa::bytes::Buf as _;
2483        #[allow(unused_imports)]
2484        use ::buffa::Enumeration as _;
2485        match tag.field_number() {
2486            1u32 => {
2487                ::buffa::encoding::check_wire_type(
2488                    tag,
2489                    ::buffa::encoding::WireType::Varint,
2490                )?;
2491                self.price_ticks = ::buffa::types::decode_int64(buf)?;
2492            }
2493            _ => {
2494                self.__buffa_unknown_fields
2495                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2496            }
2497        }
2498        ::core::result::Result::Ok(())
2499    }
2500    fn clear(&mut self) {
2501        self.price_ticks = 0i64;
2502        self.__buffa_unknown_fields.clear();
2503    }
2504}
2505impl ::buffa::ExtensionSet for TwapLimitGtc {
2506    const PROTO_FQN: &'static str = "triggers.v1.TwapLimitGtc";
2507    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2508        &self.__buffa_unknown_fields
2509    }
2510    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2511        &mut self.__buffa_unknown_fields
2512    }
2513}
2514impl ::buffa::json_helpers::ProtoElemJson for TwapLimitGtc {
2515    fn serialize_proto_json<S: ::serde::Serializer>(
2516        v: &Self,
2517        s: S,
2518    ) -> ::core::result::Result<S::Ok, S::Error> {
2519        ::serde::Serialize::serialize(v, s)
2520    }
2521    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2522        d: D,
2523    ) -> ::core::result::Result<Self, D::Error> {
2524        <Self as ::serde::Deserialize>::deserialize(d)
2525    }
2526}
2527#[doc(hidden)]
2528pub const __TWAP_LIMIT_GTC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2529    type_url: "type.googleapis.com/triggers.v1.TwapLimitGtc",
2530    to_json: ::buffa::type_registry::any_to_json::<TwapLimitGtc>,
2531    from_json: ::buffa::type_registry::any_from_json::<TwapLimitGtc>,
2532    is_wkt: false,
2533};
2534/// TwapTrigger configures a proven TWAP execution mode.
2535#[derive(Clone, PartialEq, Default)]
2536#[derive(::serde::Serialize)]
2537#[serde(default)]
2538pub struct TwapTrigger {
2539    /// Child side.
2540    ///
2541    /// Field 1: `side`
2542    #[serde(
2543        rename = "side",
2544        with = "::buffa::json_helpers::proto_enum",
2545        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2546    )]
2547    pub side: ::buffa::EnumValue<super::super::orders::v1::Side>,
2548    /// Total execution duration in milliseconds.
2549    ///
2550    /// Field 2: `duration_ms`
2551    #[serde(
2552        rename = "durationMs",
2553        alias = "duration_ms",
2554        with = "::buffa::json_helpers::int64",
2555        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2556    )]
2557    pub duration_ms: i64,
2558    /// Interval between slices in milliseconds.
2559    ///
2560    /// Field 3: `slice_interval_ms`
2561    #[serde(
2562        rename = "sliceIntervalMs",
2563        alias = "slice_interval_ms",
2564        with = "::buffa::json_helpers::int64",
2565        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2566    )]
2567    pub slice_interval_ms: i64,
2568    #[serde(flatten)]
2569    pub execution: ::core::option::Option<__buffa::oneof::twap_trigger::Execution>,
2570    #[serde(skip)]
2571    #[doc(hidden)]
2572    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2573}
2574impl ::core::fmt::Debug for TwapTrigger {
2575    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2576        f.debug_struct("TwapTrigger")
2577            .field("side", &self.side)
2578            .field("duration_ms", &self.duration_ms)
2579            .field("slice_interval_ms", &self.slice_interval_ms)
2580            .field("execution", &self.execution)
2581            .finish()
2582    }
2583}
2584impl TwapTrigger {
2585    /// Protobuf type URL for this message, for use with `Any::pack` and
2586    /// `Any::unpack_if`.
2587    ///
2588    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2589    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
2590}
2591::buffa::impl_default_instance!(TwapTrigger);
2592impl ::buffa::MessageName for TwapTrigger {
2593    const PACKAGE: &'static str = "triggers.v1";
2594    const NAME: &'static str = "TwapTrigger";
2595    const FULL_NAME: &'static str = "triggers.v1.TwapTrigger";
2596    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
2597}
2598impl ::buffa::Message for TwapTrigger {
2599    /// Returns the total encoded size in bytes.
2600    ///
2601    /// The result is a `u32`; the protobuf specification requires all
2602    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2603    /// compliant message will never overflow this type.
2604    #[allow(clippy::let_and_return)]
2605    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2606        #[allow(unused_imports)]
2607        use ::buffa::Enumeration as _;
2608        let mut size = 0u32;
2609        {
2610            let val = self.side.to_i32();
2611            if val != 0 {
2612                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2613            }
2614        }
2615        if self.duration_ms != 0i64 {
2616            size += 1u32 + ::buffa::types::int64_encoded_len(self.duration_ms) as u32;
2617        }
2618        if self.slice_interval_ms != 0i64 {
2619            size
2620                += 1u32
2621                    + ::buffa::types::int64_encoded_len(self.slice_interval_ms) as u32;
2622        }
2623        if let ::core::option::Option::Some(ref v) = self.execution {
2624            match v {
2625                __buffa::oneof::twap_trigger::Execution::MarketIoc(x) => {
2626                    let __slot = __cache.reserve();
2627                    let inner = x.compute_size(__cache);
2628                    __cache.set(__slot, inner);
2629                    size
2630                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
2631                            + inner;
2632                }
2633                __buffa::oneof::twap_trigger::Execution::LimitGtc(x) => {
2634                    let __slot = __cache.reserve();
2635                    let inner = x.compute_size(__cache);
2636                    __cache.set(__slot, inner);
2637                    size
2638                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
2639                            + inner;
2640                }
2641            }
2642        }
2643        size += self.__buffa_unknown_fields.encoded_len() as u32;
2644        size
2645    }
2646    fn write_to(
2647        &self,
2648        __cache: &mut ::buffa::SizeCache,
2649        buf: &mut impl ::buffa::bytes::BufMut,
2650    ) {
2651        #[allow(unused_imports)]
2652        use ::buffa::Enumeration as _;
2653        {
2654            let val = self.side.to_i32();
2655            if val != 0 {
2656                ::buffa::types::put_int32_field(1u32, val, buf);
2657            }
2658        }
2659        if self.duration_ms != 0i64 {
2660            ::buffa::types::put_int64_field(2u32, self.duration_ms, buf);
2661        }
2662        if self.slice_interval_ms != 0i64 {
2663            ::buffa::types::put_int64_field(3u32, self.slice_interval_ms, buf);
2664        }
2665        if let ::core::option::Option::Some(ref v) = self.execution {
2666            match v {
2667                __buffa::oneof::twap_trigger::Execution::MarketIoc(x) => {
2668                    ::buffa::types::put_len_delimited_header(
2669                        4u32,
2670                        __cache.consume_next(),
2671                        buf,
2672                    );
2673                    x.write_to(__cache, buf);
2674                }
2675                __buffa::oneof::twap_trigger::Execution::LimitGtc(x) => {
2676                    ::buffa::types::put_len_delimited_header(
2677                        5u32,
2678                        __cache.consume_next(),
2679                        buf,
2680                    );
2681                    x.write_to(__cache, buf);
2682                }
2683            }
2684        }
2685        self.__buffa_unknown_fields.write_to(buf);
2686    }
2687    fn merge_field(
2688        &mut self,
2689        tag: ::buffa::encoding::Tag,
2690        buf: &mut impl ::buffa::bytes::Buf,
2691        ctx: ::buffa::DecodeContext<'_>,
2692    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2693        #[allow(unused_imports)]
2694        use ::buffa::bytes::Buf as _;
2695        #[allow(unused_imports)]
2696        use ::buffa::Enumeration as _;
2697        match tag.field_number() {
2698            1u32 => {
2699                ::buffa::encoding::check_wire_type(
2700                    tag,
2701                    ::buffa::encoding::WireType::Varint,
2702                )?;
2703                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
2704            }
2705            2u32 => {
2706                ::buffa::encoding::check_wire_type(
2707                    tag,
2708                    ::buffa::encoding::WireType::Varint,
2709                )?;
2710                self.duration_ms = ::buffa::types::decode_int64(buf)?;
2711            }
2712            3u32 => {
2713                ::buffa::encoding::check_wire_type(
2714                    tag,
2715                    ::buffa::encoding::WireType::Varint,
2716                )?;
2717                self.slice_interval_ms = ::buffa::types::decode_int64(buf)?;
2718            }
2719            4u32 => {
2720                ::buffa::encoding::check_wire_type(
2721                    tag,
2722                    ::buffa::encoding::WireType::LengthDelimited,
2723                )?;
2724                if let ::core::option::Option::Some(
2725                    __buffa::oneof::twap_trigger::Execution::MarketIoc(ref mut existing),
2726                ) = self.execution
2727                {
2728                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
2729                } else {
2730                    let mut val = ::core::default::Default::default();
2731                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
2732                    self.execution = ::core::option::Option::Some(
2733                        __buffa::oneof::twap_trigger::Execution::MarketIoc(
2734                            ::buffa::alloc::boxed::Box::new(val),
2735                        ),
2736                    );
2737                }
2738            }
2739            5u32 => {
2740                ::buffa::encoding::check_wire_type(
2741                    tag,
2742                    ::buffa::encoding::WireType::LengthDelimited,
2743                )?;
2744                if let ::core::option::Option::Some(
2745                    __buffa::oneof::twap_trigger::Execution::LimitGtc(ref mut existing),
2746                ) = self.execution
2747                {
2748                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
2749                } else {
2750                    let mut val = ::core::default::Default::default();
2751                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
2752                    self.execution = ::core::option::Option::Some(
2753                        __buffa::oneof::twap_trigger::Execution::LimitGtc(
2754                            ::buffa::alloc::boxed::Box::new(val),
2755                        ),
2756                    );
2757                }
2758            }
2759            _ => {
2760                self.__buffa_unknown_fields
2761                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2762            }
2763        }
2764        ::core::result::Result::Ok(())
2765    }
2766    fn clear(&mut self) {
2767        self.side = ::buffa::EnumValue::from(0);
2768        self.duration_ms = 0i64;
2769        self.slice_interval_ms = 0i64;
2770        self.execution = ::core::option::Option::None;
2771        self.__buffa_unknown_fields.clear();
2772    }
2773}
2774impl ::buffa::ExtensionSet for TwapTrigger {
2775    const PROTO_FQN: &'static str = "triggers.v1.TwapTrigger";
2776    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2777        &self.__buffa_unknown_fields
2778    }
2779    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2780        &mut self.__buffa_unknown_fields
2781    }
2782}
2783impl<'de> serde::Deserialize<'de> for TwapTrigger {
2784    fn deserialize<D: serde::Deserializer<'de>>(
2785        d: D,
2786    ) -> ::core::result::Result<Self, D::Error> {
2787        struct _V;
2788        impl<'de> serde::de::Visitor<'de> for _V {
2789            type Value = TwapTrigger;
2790            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2791                f.write_str("struct TwapTrigger")
2792            }
2793            #[allow(clippy::field_reassign_with_default)]
2794            fn visit_map<A: serde::de::MapAccess<'de>>(
2795                self,
2796                mut map: A,
2797            ) -> ::core::result::Result<TwapTrigger, A::Error> {
2798                let mut __f_side: ::core::option::Option<
2799                    ::buffa::EnumValue<super::super::orders::v1::Side>,
2800                > = None;
2801                let mut __f_duration_ms: ::core::option::Option<i64> = None;
2802                let mut __f_slice_interval_ms: ::core::option::Option<i64> = None;
2803                let mut __oneof_execution: ::core::option::Option<
2804                    __buffa::oneof::twap_trigger::Execution,
2805                > = None;
2806                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
2807                    match key.as_str() {
2808                        "side" => {
2809                            __f_side = Some({
2810                                struct _S;
2811                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2812                                    type Value = ::buffa::EnumValue<
2813                                        super::super::orders::v1::Side,
2814                                    >;
2815                                    fn deserialize<D: serde::Deserializer<'de>>(
2816                                        self,
2817                                        d: D,
2818                                    ) -> ::core::result::Result<
2819                                        ::buffa::EnumValue<super::super::orders::v1::Side>,
2820                                        D::Error,
2821                                    > {
2822                                        ::buffa::json_helpers::proto_enum::deserialize(d)
2823                                    }
2824                                }
2825                                map.next_value_seed(_S)?
2826                            });
2827                        }
2828                        "durationMs" | "duration_ms" => {
2829                            __f_duration_ms = Some({
2830                                struct _S;
2831                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2832                                    type Value = i64;
2833                                    fn deserialize<D: serde::Deserializer<'de>>(
2834                                        self,
2835                                        d: D,
2836                                    ) -> ::core::result::Result<i64, D::Error> {
2837                                        ::buffa::json_helpers::int64::deserialize(d)
2838                                    }
2839                                }
2840                                map.next_value_seed(_S)?
2841                            });
2842                        }
2843                        "sliceIntervalMs" | "slice_interval_ms" => {
2844                            __f_slice_interval_ms = Some({
2845                                struct _S;
2846                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
2847                                    type Value = i64;
2848                                    fn deserialize<D: serde::Deserializer<'de>>(
2849                                        self,
2850                                        d: D,
2851                                    ) -> ::core::result::Result<i64, D::Error> {
2852                                        ::buffa::json_helpers::int64::deserialize(d)
2853                                    }
2854                                }
2855                                map.next_value_seed(_S)?
2856                            });
2857                        }
2858                        "marketIoc" | "market_ioc" => {
2859                            let v: ::core::option::Option<TwapMarketIoc> = map
2860                                .next_value_seed(
2861                                    ::buffa::json_helpers::NullableDeserializeSeed(
2862                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
2863                                            TwapMarketIoc,
2864                                        >::new(),
2865                                    ),
2866                                )?;
2867                            if let Some(v) = v {
2868                                if __oneof_execution.is_some() {
2869                                    return Err(
2870                                        serde::de::Error::custom(
2871                                            "multiple oneof fields set for 'execution'",
2872                                        ),
2873                                    );
2874                                }
2875                                __oneof_execution = Some(
2876                                    __buffa::oneof::twap_trigger::Execution::MarketIoc(
2877                                        ::buffa::alloc::boxed::Box::new(v),
2878                                    ),
2879                                );
2880                            }
2881                        }
2882                        "limitGtc" | "limit_gtc" => {
2883                            let v: ::core::option::Option<TwapLimitGtc> = map
2884                                .next_value_seed(
2885                                    ::buffa::json_helpers::NullableDeserializeSeed(
2886                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
2887                                            TwapLimitGtc,
2888                                        >::new(),
2889                                    ),
2890                                )?;
2891                            if let Some(v) = v {
2892                                if __oneof_execution.is_some() {
2893                                    return Err(
2894                                        serde::de::Error::custom(
2895                                            "multiple oneof fields set for 'execution'",
2896                                        ),
2897                                    );
2898                                }
2899                                __oneof_execution = Some(
2900                                    __buffa::oneof::twap_trigger::Execution::LimitGtc(
2901                                        ::buffa::alloc::boxed::Box::new(v),
2902                                    ),
2903                                );
2904                            }
2905                        }
2906                        _ => {
2907                            map.next_value::<serde::de::IgnoredAny>()?;
2908                        }
2909                    }
2910                }
2911                let mut __r = <TwapTrigger as ::core::default::Default>::default();
2912                if let ::core::option::Option::Some(v) = __f_side {
2913                    __r.side = v;
2914                }
2915                if let ::core::option::Option::Some(v) = __f_duration_ms {
2916                    __r.duration_ms = v;
2917                }
2918                if let ::core::option::Option::Some(v) = __f_slice_interval_ms {
2919                    __r.slice_interval_ms = v;
2920                }
2921                __r.execution = __oneof_execution;
2922                Ok(__r)
2923            }
2924        }
2925        d.deserialize_map(_V)
2926    }
2927}
2928impl ::buffa::json_helpers::ProtoElemJson for TwapTrigger {
2929    fn serialize_proto_json<S: ::serde::Serializer>(
2930        v: &Self,
2931        s: S,
2932    ) -> ::core::result::Result<S::Ok, S::Error> {
2933        ::serde::Serialize::serialize(v, s)
2934    }
2935    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2936        d: D,
2937    ) -> ::core::result::Result<Self, D::Error> {
2938        <Self as ::serde::Deserialize>::deserialize(d)
2939    }
2940}
2941#[doc(hidden)]
2942pub const __TWAP_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2943    type_url: "type.googleapis.com/triggers.v1.TwapTrigger",
2944    to_json: ::buffa::type_registry::any_to_json::<TwapTrigger>,
2945    from_json: ::buffa::type_registry::any_from_json::<TwapTrigger>,
2946    is_wkt: false,
2947};
2948pub mod twap_trigger {
2949    #[allow(unused_imports)]
2950    use super::*;
2951    #[doc(inline)]
2952    pub use super::__buffa::oneof::twap_trigger::Execution;
2953    #[doc(inline)]
2954    pub use super::__buffa::view::oneof::twap_trigger::Execution as ExecutionView;
2955}
2956/// LadderTrigger configures the supported LINEAR limit-GTC ladder. All levels
2957/// are admitted immediately and may rest concurrently.
2958#[derive(Clone, PartialEq, Default)]
2959#[derive(::serde::Serialize, ::serde::Deserialize)]
2960#[serde(default)]
2961pub struct LadderTrigger {
2962    /// Child side.
2963    ///
2964    /// Field 1: `side`
2965    #[serde(
2966        rename = "side",
2967        with = "::buffa::json_helpers::proto_enum",
2968        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2969    )]
2970    pub side: ::buffa::EnumValue<super::super::orders::v1::Side>,
2971    /// Minimum generated level price in quote units scaled by 1e6.
2972    ///
2973    /// Field 2: `price_min_ticks`
2974    #[serde(
2975        rename = "priceMinTicks",
2976        alias = "price_min_ticks",
2977        with = "::buffa::json_helpers::int64",
2978        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2979    )]
2980    pub price_min_ticks: i64,
2981    /// Maximum generated level price in quote units scaled by 1e6.
2982    ///
2983    /// Field 3: `price_max_ticks`
2984    #[serde(
2985        rename = "priceMaxTicks",
2986        alias = "price_max_ticks",
2987        with = "::buffa::json_helpers::int64",
2988        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
2989    )]
2990    pub price_max_ticks: i64,
2991    /// Number of linearly distributed levels.
2992    ///
2993    /// Field 4: `levels`
2994    #[serde(
2995        rename = "levels",
2996        with = "::buffa::json_helpers::int32",
2997        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
2998    )]
2999    pub levels: i32,
3000    /// Reject each level instead of taking liquidity.
3001    ///
3002    /// Field 5: `post_only`
3003    #[serde(
3004        rename = "postOnly",
3005        alias = "post_only",
3006        with = "::buffa::json_helpers::proto_bool",
3007        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
3008    )]
3009    pub post_only: bool,
3010    #[serde(skip)]
3011    #[doc(hidden)]
3012    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3013}
3014impl ::core::fmt::Debug for LadderTrigger {
3015    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3016        f.debug_struct("LadderTrigger")
3017            .field("side", &self.side)
3018            .field("price_min_ticks", &self.price_min_ticks)
3019            .field("price_max_ticks", &self.price_max_ticks)
3020            .field("levels", &self.levels)
3021            .field("post_only", &self.post_only)
3022            .finish()
3023    }
3024}
3025impl LadderTrigger {
3026    /// Protobuf type URL for this message, for use with `Any::pack` and
3027    /// `Any::unpack_if`.
3028    ///
3029    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3030    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
3031}
3032::buffa::impl_default_instance!(LadderTrigger);
3033impl ::buffa::MessageName for LadderTrigger {
3034    const PACKAGE: &'static str = "triggers.v1";
3035    const NAME: &'static str = "LadderTrigger";
3036    const FULL_NAME: &'static str = "triggers.v1.LadderTrigger";
3037    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
3038}
3039impl ::buffa::Message for LadderTrigger {
3040    /// Returns the total encoded size in bytes.
3041    ///
3042    /// The result is a `u32`; the protobuf specification requires all
3043    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3044    /// compliant message will never overflow this type.
3045    #[allow(clippy::let_and_return)]
3046    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3047        #[allow(unused_imports)]
3048        use ::buffa::Enumeration as _;
3049        let mut size = 0u32;
3050        {
3051            let val = self.side.to_i32();
3052            if val != 0 {
3053                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3054            }
3055        }
3056        if self.price_min_ticks != 0i64 {
3057            size
3058                += 1u32 + ::buffa::types::int64_encoded_len(self.price_min_ticks) as u32;
3059        }
3060        if self.price_max_ticks != 0i64 {
3061            size
3062                += 1u32 + ::buffa::types::int64_encoded_len(self.price_max_ticks) as u32;
3063        }
3064        if self.levels != 0i32 {
3065            size += 1u32 + ::buffa::types::int32_encoded_len(self.levels) as u32;
3066        }
3067        if self.post_only {
3068            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
3069        }
3070        size += self.__buffa_unknown_fields.encoded_len() as u32;
3071        size
3072    }
3073    fn write_to(
3074        &self,
3075        _cache: &mut ::buffa::SizeCache,
3076        buf: &mut impl ::buffa::bytes::BufMut,
3077    ) {
3078        #[allow(unused_imports)]
3079        use ::buffa::Enumeration as _;
3080        {
3081            let val = self.side.to_i32();
3082            if val != 0 {
3083                ::buffa::types::put_int32_field(1u32, val, buf);
3084            }
3085        }
3086        if self.price_min_ticks != 0i64 {
3087            ::buffa::types::put_int64_field(2u32, self.price_min_ticks, buf);
3088        }
3089        if self.price_max_ticks != 0i64 {
3090            ::buffa::types::put_int64_field(3u32, self.price_max_ticks, buf);
3091        }
3092        if self.levels != 0i32 {
3093            ::buffa::types::put_int32_field(4u32, self.levels, buf);
3094        }
3095        if self.post_only {
3096            ::buffa::types::put_bool_field(5u32, self.post_only, buf);
3097        }
3098        self.__buffa_unknown_fields.write_to(buf);
3099    }
3100    fn merge_field(
3101        &mut self,
3102        tag: ::buffa::encoding::Tag,
3103        buf: &mut impl ::buffa::bytes::Buf,
3104        ctx: ::buffa::DecodeContext<'_>,
3105    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3106        #[allow(unused_imports)]
3107        use ::buffa::bytes::Buf as _;
3108        #[allow(unused_imports)]
3109        use ::buffa::Enumeration as _;
3110        match tag.field_number() {
3111            1u32 => {
3112                ::buffa::encoding::check_wire_type(
3113                    tag,
3114                    ::buffa::encoding::WireType::Varint,
3115                )?;
3116                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
3117            }
3118            2u32 => {
3119                ::buffa::encoding::check_wire_type(
3120                    tag,
3121                    ::buffa::encoding::WireType::Varint,
3122                )?;
3123                self.price_min_ticks = ::buffa::types::decode_int64(buf)?;
3124            }
3125            3u32 => {
3126                ::buffa::encoding::check_wire_type(
3127                    tag,
3128                    ::buffa::encoding::WireType::Varint,
3129                )?;
3130                self.price_max_ticks = ::buffa::types::decode_int64(buf)?;
3131            }
3132            4u32 => {
3133                ::buffa::encoding::check_wire_type(
3134                    tag,
3135                    ::buffa::encoding::WireType::Varint,
3136                )?;
3137                self.levels = ::buffa::types::decode_int32(buf)?;
3138            }
3139            5u32 => {
3140                ::buffa::encoding::check_wire_type(
3141                    tag,
3142                    ::buffa::encoding::WireType::Varint,
3143                )?;
3144                self.post_only = ::buffa::types::decode_bool(buf)?;
3145            }
3146            _ => {
3147                self.__buffa_unknown_fields
3148                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3149            }
3150        }
3151        ::core::result::Result::Ok(())
3152    }
3153    fn clear(&mut self) {
3154        self.side = ::buffa::EnumValue::from(0);
3155        self.price_min_ticks = 0i64;
3156        self.price_max_ticks = 0i64;
3157        self.levels = 0i32;
3158        self.post_only = false;
3159        self.__buffa_unknown_fields.clear();
3160    }
3161}
3162impl ::buffa::ExtensionSet for LadderTrigger {
3163    const PROTO_FQN: &'static str = "triggers.v1.LadderTrigger";
3164    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3165        &self.__buffa_unknown_fields
3166    }
3167    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3168        &mut self.__buffa_unknown_fields
3169    }
3170}
3171impl ::buffa::json_helpers::ProtoElemJson for LadderTrigger {
3172    fn serialize_proto_json<S: ::serde::Serializer>(
3173        v: &Self,
3174        s: S,
3175    ) -> ::core::result::Result<S::Ok, S::Error> {
3176        ::serde::Serialize::serialize(v, s)
3177    }
3178    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3179        d: D,
3180    ) -> ::core::result::Result<Self, D::Error> {
3181        <Self as ::serde::Deserialize>::deserialize(d)
3182    }
3183}
3184#[doc(hidden)]
3185pub const __LADDER_TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3186    type_url: "type.googleapis.com/triggers.v1.LadderTrigger",
3187    to_json: ::buffa::type_registry::any_to_json::<LadderTrigger>,
3188    from_json: ::buffa::type_registry::any_from_json::<LadderTrigger>,
3189    is_wkt: false,
3190};
3191/// TriggerIntent contains one standalone trigger's immutable configuration.
3192#[derive(Clone, PartialEq, Default)]
3193#[derive(::serde::Serialize)]
3194#[serde(default)]
3195pub struct TriggerIntent {
3196    /// Symbol, for example "BTC-USDT".
3197    ///
3198    /// Field 1: `symbol`
3199    #[serde(
3200        rename = "symbol",
3201        with = "::buffa::json_helpers::proto_string",
3202        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3203    )]
3204    pub symbol: ::buffa::alloc::string::String,
3205    /// Total quantity scaled by the pair's base_quantity_scale.
3206    ///
3207    /// Field 2: `qty_scaled`
3208    #[serde(
3209        rename = "qtyScaled",
3210        alias = "qty_scaled",
3211        with = "::buffa::json_helpers::int64",
3212        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
3213    )]
3214    pub qty_scaled: i64,
3215    /// Fee asset for BUY children. SELL children must use QUOTE.
3216    ///
3217    /// Field 3: `fee_asset`
3218    #[serde(
3219        rename = "feeAsset",
3220        alias = "fee_asset",
3221        with = "::buffa::json_helpers::proto_enum",
3222        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3223    )]
3224    pub fee_asset: ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
3225    /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
3226    ///
3227    /// Field 4: `self_trade_prevention_mode`
3228    #[serde(
3229        rename = "selfTradePreventionMode",
3230        alias = "self_trade_prevention_mode",
3231        with = "::buffa::json_helpers::proto_enum",
3232        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3233    )]
3234    pub self_trade_prevention_mode: ::buffa::EnumValue<
3235        super::super::orders::v1::SelfTradePreventionMode,
3236    >,
3237    /// Client-provided trigger ID for idempotency.
3238    ///
3239    /// Field 5: `client_trigger_id`
3240    #[serde(
3241        rename = "clientTriggerId",
3242        alias = "client_trigger_id",
3243        with = "::buffa::json_helpers::proto_string",
3244        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3245    )]
3246    pub client_trigger_id: ::buffa::alloc::string::String,
3247    #[serde(flatten)]
3248    pub strategy: ::core::option::Option<__buffa::oneof::trigger_intent::Strategy>,
3249    #[serde(skip)]
3250    #[doc(hidden)]
3251    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3252}
3253impl ::core::fmt::Debug for TriggerIntent {
3254    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3255        f.debug_struct("TriggerIntent")
3256            .field("symbol", &self.symbol)
3257            .field("qty_scaled", &self.qty_scaled)
3258            .field("fee_asset", &self.fee_asset)
3259            .field("self_trade_prevention_mode", &self.self_trade_prevention_mode)
3260            .field("client_trigger_id", &self.client_trigger_id)
3261            .field("strategy", &self.strategy)
3262            .finish()
3263    }
3264}
3265impl TriggerIntent {
3266    /// Protobuf type URL for this message, for use with `Any::pack` and
3267    /// `Any::unpack_if`.
3268    ///
3269    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3270    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
3271}
3272::buffa::impl_default_instance!(TriggerIntent);
3273impl ::buffa::MessageName for TriggerIntent {
3274    const PACKAGE: &'static str = "triggers.v1";
3275    const NAME: &'static str = "TriggerIntent";
3276    const FULL_NAME: &'static str = "triggers.v1.TriggerIntent";
3277    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
3278}
3279impl ::buffa::Message for TriggerIntent {
3280    /// Returns the total encoded size in bytes.
3281    ///
3282    /// The result is a `u32`; the protobuf specification requires all
3283    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3284    /// compliant message will never overflow this type.
3285    #[allow(clippy::let_and_return)]
3286    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3287        #[allow(unused_imports)]
3288        use ::buffa::Enumeration as _;
3289        let mut size = 0u32;
3290        if !self.symbol.is_empty() {
3291            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
3292        }
3293        if self.qty_scaled != 0i64 {
3294            size += 1u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
3295        }
3296        {
3297            let val = self.fee_asset.to_i32();
3298            if val != 0 {
3299                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3300            }
3301        }
3302        {
3303            let val = self.self_trade_prevention_mode.to_i32();
3304            if val != 0 {
3305                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3306            }
3307        }
3308        if !self.client_trigger_id.is_empty() {
3309            size
3310                += 1u32
3311                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
3312        }
3313        if let ::core::option::Option::Some(ref v) = self.strategy {
3314            match v {
3315                __buffa::oneof::trigger_intent::Strategy::StopLoss(x) => {
3316                    let __slot = __cache.reserve();
3317                    let inner = x.compute_size(__cache);
3318                    __cache.set(__slot, inner);
3319                    size
3320                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3321                            + inner;
3322                }
3323                __buffa::oneof::trigger_intent::Strategy::TakeProfit(x) => {
3324                    let __slot = __cache.reserve();
3325                    let inner = x.compute_size(__cache);
3326                    __cache.set(__slot, inner);
3327                    size
3328                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3329                            + inner;
3330                }
3331                __buffa::oneof::trigger_intent::Strategy::TrailingStop(x) => {
3332                    let __slot = __cache.reserve();
3333                    let inner = x.compute_size(__cache);
3334                    __cache.set(__slot, inner);
3335                    size
3336                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3337                            + inner;
3338                }
3339                __buffa::oneof::trigger_intent::Strategy::Twap(x) => {
3340                    let __slot = __cache.reserve();
3341                    let inner = x.compute_size(__cache);
3342                    __cache.set(__slot, inner);
3343                    size
3344                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3345                            + inner;
3346                }
3347                __buffa::oneof::trigger_intent::Strategy::Ladder(x) => {
3348                    let __slot = __cache.reserve();
3349                    let inner = x.compute_size(__cache);
3350                    __cache.set(__slot, inner);
3351                    size
3352                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3353                            + inner;
3354                }
3355            }
3356        }
3357        size += self.__buffa_unknown_fields.encoded_len() as u32;
3358        size
3359    }
3360    fn write_to(
3361        &self,
3362        __cache: &mut ::buffa::SizeCache,
3363        buf: &mut impl ::buffa::bytes::BufMut,
3364    ) {
3365        #[allow(unused_imports)]
3366        use ::buffa::Enumeration as _;
3367        if !self.symbol.is_empty() {
3368            ::buffa::types::put_string_field(1u32, &self.symbol, buf);
3369        }
3370        if self.qty_scaled != 0i64 {
3371            ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
3372        }
3373        {
3374            let val = self.fee_asset.to_i32();
3375            if val != 0 {
3376                ::buffa::types::put_int32_field(3u32, val, buf);
3377            }
3378        }
3379        {
3380            let val = self.self_trade_prevention_mode.to_i32();
3381            if val != 0 {
3382                ::buffa::types::put_int32_field(4u32, val, buf);
3383            }
3384        }
3385        if !self.client_trigger_id.is_empty() {
3386            ::buffa::types::put_string_field(5u32, &self.client_trigger_id, buf);
3387        }
3388        if let ::core::option::Option::Some(ref v) = self.strategy {
3389            match v {
3390                __buffa::oneof::trigger_intent::Strategy::StopLoss(x) => {
3391                    ::buffa::types::put_len_delimited_header(
3392                        10u32,
3393                        __cache.consume_next(),
3394                        buf,
3395                    );
3396                    x.write_to(__cache, buf);
3397                }
3398                __buffa::oneof::trigger_intent::Strategy::TakeProfit(x) => {
3399                    ::buffa::types::put_len_delimited_header(
3400                        11u32,
3401                        __cache.consume_next(),
3402                        buf,
3403                    );
3404                    x.write_to(__cache, buf);
3405                }
3406                __buffa::oneof::trigger_intent::Strategy::TrailingStop(x) => {
3407                    ::buffa::types::put_len_delimited_header(
3408                        12u32,
3409                        __cache.consume_next(),
3410                        buf,
3411                    );
3412                    x.write_to(__cache, buf);
3413                }
3414                __buffa::oneof::trigger_intent::Strategy::Twap(x) => {
3415                    ::buffa::types::put_len_delimited_header(
3416                        13u32,
3417                        __cache.consume_next(),
3418                        buf,
3419                    );
3420                    x.write_to(__cache, buf);
3421                }
3422                __buffa::oneof::trigger_intent::Strategy::Ladder(x) => {
3423                    ::buffa::types::put_len_delimited_header(
3424                        14u32,
3425                        __cache.consume_next(),
3426                        buf,
3427                    );
3428                    x.write_to(__cache, buf);
3429                }
3430            }
3431        }
3432        self.__buffa_unknown_fields.write_to(buf);
3433    }
3434    fn merge_field(
3435        &mut self,
3436        tag: ::buffa::encoding::Tag,
3437        buf: &mut impl ::buffa::bytes::Buf,
3438        ctx: ::buffa::DecodeContext<'_>,
3439    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3440        #[allow(unused_imports)]
3441        use ::buffa::bytes::Buf as _;
3442        #[allow(unused_imports)]
3443        use ::buffa::Enumeration as _;
3444        match tag.field_number() {
3445            1u32 => {
3446                ::buffa::encoding::check_wire_type(
3447                    tag,
3448                    ::buffa::encoding::WireType::LengthDelimited,
3449                )?;
3450                ::buffa::types::merge_string(&mut self.symbol, buf)?;
3451            }
3452            2u32 => {
3453                ::buffa::encoding::check_wire_type(
3454                    tag,
3455                    ::buffa::encoding::WireType::Varint,
3456                )?;
3457                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
3458            }
3459            3u32 => {
3460                ::buffa::encoding::check_wire_type(
3461                    tag,
3462                    ::buffa::encoding::WireType::Varint,
3463                )?;
3464                self.fee_asset = ::buffa::EnumValue::from(
3465                    ::buffa::types::decode_int32(buf)?,
3466                );
3467            }
3468            4u32 => {
3469                ::buffa::encoding::check_wire_type(
3470                    tag,
3471                    ::buffa::encoding::WireType::Varint,
3472                )?;
3473                self.self_trade_prevention_mode = ::buffa::EnumValue::from(
3474                    ::buffa::types::decode_int32(buf)?,
3475                );
3476            }
3477            5u32 => {
3478                ::buffa::encoding::check_wire_type(
3479                    tag,
3480                    ::buffa::encoding::WireType::LengthDelimited,
3481                )?;
3482                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
3483            }
3484            10u32 => {
3485                ::buffa::encoding::check_wire_type(
3486                    tag,
3487                    ::buffa::encoding::WireType::LengthDelimited,
3488                )?;
3489                if let ::core::option::Option::Some(
3490                    __buffa::oneof::trigger_intent::Strategy::StopLoss(ref mut existing),
3491                ) = self.strategy
3492                {
3493                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3494                } else {
3495                    let mut val = ::core::default::Default::default();
3496                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3497                    self.strategy = ::core::option::Option::Some(
3498                        __buffa::oneof::trigger_intent::Strategy::StopLoss(
3499                            ::buffa::alloc::boxed::Box::new(val),
3500                        ),
3501                    );
3502                }
3503            }
3504            11u32 => {
3505                ::buffa::encoding::check_wire_type(
3506                    tag,
3507                    ::buffa::encoding::WireType::LengthDelimited,
3508                )?;
3509                if let ::core::option::Option::Some(
3510                    __buffa::oneof::trigger_intent::Strategy::TakeProfit(
3511                        ref mut existing,
3512                    ),
3513                ) = self.strategy
3514                {
3515                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3516                } else {
3517                    let mut val = ::core::default::Default::default();
3518                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3519                    self.strategy = ::core::option::Option::Some(
3520                        __buffa::oneof::trigger_intent::Strategy::TakeProfit(
3521                            ::buffa::alloc::boxed::Box::new(val),
3522                        ),
3523                    );
3524                }
3525            }
3526            12u32 => {
3527                ::buffa::encoding::check_wire_type(
3528                    tag,
3529                    ::buffa::encoding::WireType::LengthDelimited,
3530                )?;
3531                if let ::core::option::Option::Some(
3532                    __buffa::oneof::trigger_intent::Strategy::TrailingStop(
3533                        ref mut existing,
3534                    ),
3535                ) = self.strategy
3536                {
3537                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3538                } else {
3539                    let mut val = ::core::default::Default::default();
3540                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3541                    self.strategy = ::core::option::Option::Some(
3542                        __buffa::oneof::trigger_intent::Strategy::TrailingStop(
3543                            ::buffa::alloc::boxed::Box::new(val),
3544                        ),
3545                    );
3546                }
3547            }
3548            13u32 => {
3549                ::buffa::encoding::check_wire_type(
3550                    tag,
3551                    ::buffa::encoding::WireType::LengthDelimited,
3552                )?;
3553                if let ::core::option::Option::Some(
3554                    __buffa::oneof::trigger_intent::Strategy::Twap(ref mut existing),
3555                ) = self.strategy
3556                {
3557                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3558                } else {
3559                    let mut val = ::core::default::Default::default();
3560                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3561                    self.strategy = ::core::option::Option::Some(
3562                        __buffa::oneof::trigger_intent::Strategy::Twap(
3563                            ::buffa::alloc::boxed::Box::new(val),
3564                        ),
3565                    );
3566                }
3567            }
3568            14u32 => {
3569                ::buffa::encoding::check_wire_type(
3570                    tag,
3571                    ::buffa::encoding::WireType::LengthDelimited,
3572                )?;
3573                if let ::core::option::Option::Some(
3574                    __buffa::oneof::trigger_intent::Strategy::Ladder(ref mut existing),
3575                ) = self.strategy
3576                {
3577                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
3578                } else {
3579                    let mut val = ::core::default::Default::default();
3580                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
3581                    self.strategy = ::core::option::Option::Some(
3582                        __buffa::oneof::trigger_intent::Strategy::Ladder(
3583                            ::buffa::alloc::boxed::Box::new(val),
3584                        ),
3585                    );
3586                }
3587            }
3588            _ => {
3589                self.__buffa_unknown_fields
3590                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3591            }
3592        }
3593        ::core::result::Result::Ok(())
3594    }
3595    fn clear(&mut self) {
3596        self.symbol.clear();
3597        self.qty_scaled = 0i64;
3598        self.fee_asset = ::buffa::EnumValue::from(0);
3599        self.self_trade_prevention_mode = ::buffa::EnumValue::from(0);
3600        self.client_trigger_id.clear();
3601        self.strategy = ::core::option::Option::None;
3602        self.__buffa_unknown_fields.clear();
3603    }
3604}
3605impl ::buffa::ExtensionSet for TriggerIntent {
3606    const PROTO_FQN: &'static str = "triggers.v1.TriggerIntent";
3607    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3608        &self.__buffa_unknown_fields
3609    }
3610    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3611        &mut self.__buffa_unknown_fields
3612    }
3613}
3614impl<'de> serde::Deserialize<'de> for TriggerIntent {
3615    fn deserialize<D: serde::Deserializer<'de>>(
3616        d: D,
3617    ) -> ::core::result::Result<Self, D::Error> {
3618        struct _V;
3619        impl<'de> serde::de::Visitor<'de> for _V {
3620            type Value = TriggerIntent;
3621            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3622                f.write_str("struct TriggerIntent")
3623            }
3624            #[allow(clippy::field_reassign_with_default)]
3625            fn visit_map<A: serde::de::MapAccess<'de>>(
3626                self,
3627                mut map: A,
3628            ) -> ::core::result::Result<TriggerIntent, A::Error> {
3629                let mut __f_symbol: ::core::option::Option<
3630                    ::buffa::alloc::string::String,
3631                > = None;
3632                let mut __f_qty_scaled: ::core::option::Option<i64> = None;
3633                let mut __f_fee_asset: ::core::option::Option<
3634                    ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
3635                > = None;
3636                let mut __f_self_trade_prevention_mode: ::core::option::Option<
3637                    ::buffa::EnumValue<super::super::orders::v1::SelfTradePreventionMode>,
3638                > = None;
3639                let mut __f_client_trigger_id: ::core::option::Option<
3640                    ::buffa::alloc::string::String,
3641                > = None;
3642                let mut __oneof_strategy: ::core::option::Option<
3643                    __buffa::oneof::trigger_intent::Strategy,
3644                > = None;
3645                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
3646                    match key.as_str() {
3647                        "symbol" => {
3648                            __f_symbol = Some({
3649                                struct _S;
3650                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3651                                    type Value = ::buffa::alloc::string::String;
3652                                    fn deserialize<D: serde::Deserializer<'de>>(
3653                                        self,
3654                                        d: D,
3655                                    ) -> ::core::result::Result<
3656                                        ::buffa::alloc::string::String,
3657                                        D::Error,
3658                                    > {
3659                                        ::buffa::json_helpers::proto_string::deserialize(d)
3660                                    }
3661                                }
3662                                map.next_value_seed(_S)?
3663                            });
3664                        }
3665                        "qtyScaled" | "qty_scaled" => {
3666                            __f_qty_scaled = Some({
3667                                struct _S;
3668                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3669                                    type Value = i64;
3670                                    fn deserialize<D: serde::Deserializer<'de>>(
3671                                        self,
3672                                        d: D,
3673                                    ) -> ::core::result::Result<i64, D::Error> {
3674                                        ::buffa::json_helpers::int64::deserialize(d)
3675                                    }
3676                                }
3677                                map.next_value_seed(_S)?
3678                            });
3679                        }
3680                        "feeAsset" | "fee_asset" => {
3681                            __f_fee_asset = Some({
3682                                struct _S;
3683                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3684                                    type Value = ::buffa::EnumValue<
3685                                        super::super::orders::v1::FeeAsset,
3686                                    >;
3687                                    fn deserialize<D: serde::Deserializer<'de>>(
3688                                        self,
3689                                        d: D,
3690                                    ) -> ::core::result::Result<
3691                                        ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
3692                                        D::Error,
3693                                    > {
3694                                        ::buffa::json_helpers::proto_enum::deserialize(d)
3695                                    }
3696                                }
3697                                map.next_value_seed(_S)?
3698                            });
3699                        }
3700                        "selfTradePreventionMode" | "self_trade_prevention_mode" => {
3701                            __f_self_trade_prevention_mode = Some({
3702                                struct _S;
3703                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3704                                    type Value = ::buffa::EnumValue<
3705                                        super::super::orders::v1::SelfTradePreventionMode,
3706                                    >;
3707                                    fn deserialize<D: serde::Deserializer<'de>>(
3708                                        self,
3709                                        d: D,
3710                                    ) -> ::core::result::Result<
3711                                        ::buffa::EnumValue<
3712                                            super::super::orders::v1::SelfTradePreventionMode,
3713                                        >,
3714                                        D::Error,
3715                                    > {
3716                                        ::buffa::json_helpers::proto_enum::deserialize(d)
3717                                    }
3718                                }
3719                                map.next_value_seed(_S)?
3720                            });
3721                        }
3722                        "clientTriggerId" | "client_trigger_id" => {
3723                            __f_client_trigger_id = Some({
3724                                struct _S;
3725                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
3726                                    type Value = ::buffa::alloc::string::String;
3727                                    fn deserialize<D: serde::Deserializer<'de>>(
3728                                        self,
3729                                        d: D,
3730                                    ) -> ::core::result::Result<
3731                                        ::buffa::alloc::string::String,
3732                                        D::Error,
3733                                    > {
3734                                        ::buffa::json_helpers::proto_string::deserialize(d)
3735                                    }
3736                                }
3737                                map.next_value_seed(_S)?
3738                            });
3739                        }
3740                        "stopLoss" | "stop_loss" => {
3741                            let v: ::core::option::Option<ConditionalTrigger> = map
3742                                .next_value_seed(
3743                                    ::buffa::json_helpers::NullableDeserializeSeed(
3744                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3745                                            ConditionalTrigger,
3746                                        >::new(),
3747                                    ),
3748                                )?;
3749                            if let Some(v) = v {
3750                                if __oneof_strategy.is_some() {
3751                                    return Err(
3752                                        serde::de::Error::custom(
3753                                            "multiple oneof fields set for 'strategy'",
3754                                        ),
3755                                    );
3756                                }
3757                                __oneof_strategy = Some(
3758                                    __buffa::oneof::trigger_intent::Strategy::StopLoss(
3759                                        ::buffa::alloc::boxed::Box::new(v),
3760                                    ),
3761                                );
3762                            }
3763                        }
3764                        "takeProfit" | "take_profit" => {
3765                            let v: ::core::option::Option<ConditionalTrigger> = map
3766                                .next_value_seed(
3767                                    ::buffa::json_helpers::NullableDeserializeSeed(
3768                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3769                                            ConditionalTrigger,
3770                                        >::new(),
3771                                    ),
3772                                )?;
3773                            if let Some(v) = v {
3774                                if __oneof_strategy.is_some() {
3775                                    return Err(
3776                                        serde::de::Error::custom(
3777                                            "multiple oneof fields set for 'strategy'",
3778                                        ),
3779                                    );
3780                                }
3781                                __oneof_strategy = Some(
3782                                    __buffa::oneof::trigger_intent::Strategy::TakeProfit(
3783                                        ::buffa::alloc::boxed::Box::new(v),
3784                                    ),
3785                                );
3786                            }
3787                        }
3788                        "trailingStop" | "trailing_stop" => {
3789                            let v: ::core::option::Option<TrailingStopTrigger> = map
3790                                .next_value_seed(
3791                                    ::buffa::json_helpers::NullableDeserializeSeed(
3792                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3793                                            TrailingStopTrigger,
3794                                        >::new(),
3795                                    ),
3796                                )?;
3797                            if let Some(v) = v {
3798                                if __oneof_strategy.is_some() {
3799                                    return Err(
3800                                        serde::de::Error::custom(
3801                                            "multiple oneof fields set for 'strategy'",
3802                                        ),
3803                                    );
3804                                }
3805                                __oneof_strategy = Some(
3806                                    __buffa::oneof::trigger_intent::Strategy::TrailingStop(
3807                                        ::buffa::alloc::boxed::Box::new(v),
3808                                    ),
3809                                );
3810                            }
3811                        }
3812                        "twap" => {
3813                            let v: ::core::option::Option<TwapTrigger> = map
3814                                .next_value_seed(
3815                                    ::buffa::json_helpers::NullableDeserializeSeed(
3816                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3817                                            TwapTrigger,
3818                                        >::new(),
3819                                    ),
3820                                )?;
3821                            if let Some(v) = v {
3822                                if __oneof_strategy.is_some() {
3823                                    return Err(
3824                                        serde::de::Error::custom(
3825                                            "multiple oneof fields set for 'strategy'",
3826                                        ),
3827                                    );
3828                                }
3829                                __oneof_strategy = Some(
3830                                    __buffa::oneof::trigger_intent::Strategy::Twap(
3831                                        ::buffa::alloc::boxed::Box::new(v),
3832                                    ),
3833                                );
3834                            }
3835                        }
3836                        "ladder" => {
3837                            let v: ::core::option::Option<LadderTrigger> = map
3838                                .next_value_seed(
3839                                    ::buffa::json_helpers::NullableDeserializeSeed(
3840                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
3841                                            LadderTrigger,
3842                                        >::new(),
3843                                    ),
3844                                )?;
3845                            if let Some(v) = v {
3846                                if __oneof_strategy.is_some() {
3847                                    return Err(
3848                                        serde::de::Error::custom(
3849                                            "multiple oneof fields set for 'strategy'",
3850                                        ),
3851                                    );
3852                                }
3853                                __oneof_strategy = Some(
3854                                    __buffa::oneof::trigger_intent::Strategy::Ladder(
3855                                        ::buffa::alloc::boxed::Box::new(v),
3856                                    ),
3857                                );
3858                            }
3859                        }
3860                        _ => {
3861                            map.next_value::<serde::de::IgnoredAny>()?;
3862                        }
3863                    }
3864                }
3865                let mut __r = <TriggerIntent as ::core::default::Default>::default();
3866                if let ::core::option::Option::Some(v) = __f_symbol {
3867                    __r.symbol = v;
3868                }
3869                if let ::core::option::Option::Some(v) = __f_qty_scaled {
3870                    __r.qty_scaled = v;
3871                }
3872                if let ::core::option::Option::Some(v) = __f_fee_asset {
3873                    __r.fee_asset = v;
3874                }
3875                if let ::core::option::Option::Some(v) = __f_self_trade_prevention_mode {
3876                    __r.self_trade_prevention_mode = v;
3877                }
3878                if let ::core::option::Option::Some(v) = __f_client_trigger_id {
3879                    __r.client_trigger_id = v;
3880                }
3881                __r.strategy = __oneof_strategy;
3882                Ok(__r)
3883            }
3884        }
3885        d.deserialize_map(_V)
3886    }
3887}
3888impl ::buffa::json_helpers::ProtoElemJson for TriggerIntent {
3889    fn serialize_proto_json<S: ::serde::Serializer>(
3890        v: &Self,
3891        s: S,
3892    ) -> ::core::result::Result<S::Ok, S::Error> {
3893        ::serde::Serialize::serialize(v, s)
3894    }
3895    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3896        d: D,
3897    ) -> ::core::result::Result<Self, D::Error> {
3898        <Self as ::serde::Deserialize>::deserialize(d)
3899    }
3900}
3901#[doc(hidden)]
3902pub const __TRIGGER_INTENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3903    type_url: "type.googleapis.com/triggers.v1.TriggerIntent",
3904    to_json: ::buffa::type_registry::any_to_json::<TriggerIntent>,
3905    from_json: ::buffa::type_registry::any_from_json::<TriggerIntent>,
3906    is_wkt: false,
3907};
3908pub mod trigger_intent {
3909    #[allow(unused_imports)]
3910    use super::*;
3911    #[doc(inline)]
3912    pub use super::__buffa::oneof::trigger_intent::Strategy;
3913    #[doc(inline)]
3914    pub use super::__buffa::view::oneof::trigger_intent::Strategy as StrategyView;
3915}
3916/// CreateTriggerRequest submits one standalone trigger intent for admission.
3917#[derive(Clone, PartialEq, Default)]
3918#[derive(::serde::Serialize, ::serde::Deserialize)]
3919#[serde(default)]
3920pub struct CreateTriggerRequest {
3921    /// Target sub-account. When omitted, uses the caller's root account.
3922    ///
3923    /// Field 1: `subaccount_id`
3924    #[serde(
3925        rename = "subaccountId",
3926        alias = "subaccount_id",
3927        with = "::buffa::json_helpers::opt_uint64",
3928        skip_serializing_if = "::core::option::Option::is_none"
3929    )]
3930    pub subaccount_id: ::core::option::Option<u64>,
3931    /// Trigger to admit.
3932    ///
3933    /// Field 2: `trigger`
3934    #[serde(
3935        rename = "trigger",
3936        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
3937    )]
3938    pub trigger: ::buffa::MessageField<TriggerIntent>,
3939    #[serde(skip)]
3940    #[doc(hidden)]
3941    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3942}
3943impl ::core::fmt::Debug for CreateTriggerRequest {
3944    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3945        f.debug_struct("CreateTriggerRequest")
3946            .field("subaccount_id", &self.subaccount_id)
3947            .field("trigger", &self.trigger)
3948            .finish()
3949    }
3950}
3951impl CreateTriggerRequest {
3952    /// Protobuf type URL for this message, for use with `Any::pack` and
3953    /// `Any::unpack_if`.
3954    ///
3955    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3956    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
3957}
3958impl CreateTriggerRequest {
3959    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3960    #[inline]
3961    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
3962    pub fn with_subaccount_id(mut self, value: u64) -> Self {
3963        self.subaccount_id = Some(value);
3964        self
3965    }
3966}
3967::buffa::impl_default_instance!(CreateTriggerRequest);
3968impl ::buffa::MessageName for CreateTriggerRequest {
3969    const PACKAGE: &'static str = "triggers.v1";
3970    const NAME: &'static str = "CreateTriggerRequest";
3971    const FULL_NAME: &'static str = "triggers.v1.CreateTriggerRequest";
3972    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
3973}
3974impl ::buffa::Message for CreateTriggerRequest {
3975    /// Returns the total encoded size in bytes.
3976    ///
3977    /// The result is a `u32`; the protobuf specification requires all
3978    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3979    /// compliant message will never overflow this type.
3980    #[allow(clippy::let_and_return)]
3981    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3982        #[allow(unused_imports)]
3983        use ::buffa::Enumeration as _;
3984        let mut size = 0u32;
3985        if self.subaccount_id.is_some() {
3986            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
3987        }
3988        if self.trigger.is_set() {
3989            let __slot = __cache.reserve();
3990            let inner_size = self.trigger.compute_size(__cache);
3991            __cache.set(__slot, inner_size);
3992            size
3993                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3994                    + inner_size;
3995        }
3996        size += self.__buffa_unknown_fields.encoded_len() as u32;
3997        size
3998    }
3999    fn write_to(
4000        &self,
4001        __cache: &mut ::buffa::SizeCache,
4002        buf: &mut impl ::buffa::bytes::BufMut,
4003    ) {
4004        #[allow(unused_imports)]
4005        use ::buffa::Enumeration as _;
4006        if let Some(v) = self.subaccount_id {
4007            ::buffa::types::put_fixed64_field(1u32, v, buf);
4008        }
4009        if self.trigger.is_set() {
4010            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
4011            self.trigger.write_to(__cache, buf);
4012        }
4013        self.__buffa_unknown_fields.write_to(buf);
4014    }
4015    fn merge_field(
4016        &mut self,
4017        tag: ::buffa::encoding::Tag,
4018        buf: &mut impl ::buffa::bytes::Buf,
4019        ctx: ::buffa::DecodeContext<'_>,
4020    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4021        #[allow(unused_imports)]
4022        use ::buffa::bytes::Buf as _;
4023        #[allow(unused_imports)]
4024        use ::buffa::Enumeration as _;
4025        match tag.field_number() {
4026            1u32 => {
4027                ::buffa::encoding::check_wire_type(
4028                    tag,
4029                    ::buffa::encoding::WireType::Fixed64,
4030                )?;
4031                self.subaccount_id = ::core::option::Option::Some(
4032                    ::buffa::types::decode_fixed64(buf)?,
4033                );
4034            }
4035            2u32 => {
4036                ::buffa::encoding::check_wire_type(
4037                    tag,
4038                    ::buffa::encoding::WireType::LengthDelimited,
4039                )?;
4040                ::buffa::Message::merge_length_delimited(
4041                    self.trigger.get_or_insert_default(),
4042                    buf,
4043                    ctx,
4044                )?;
4045            }
4046            _ => {
4047                self.__buffa_unknown_fields
4048                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4049            }
4050        }
4051        ::core::result::Result::Ok(())
4052    }
4053    fn clear(&mut self) {
4054        self.subaccount_id = ::core::option::Option::None;
4055        self.trigger = ::buffa::MessageField::none();
4056        self.__buffa_unknown_fields.clear();
4057    }
4058}
4059impl ::buffa::ExtensionSet for CreateTriggerRequest {
4060    const PROTO_FQN: &'static str = "triggers.v1.CreateTriggerRequest";
4061    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4062        &self.__buffa_unknown_fields
4063    }
4064    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4065        &mut self.__buffa_unknown_fields
4066    }
4067}
4068impl ::buffa::json_helpers::ProtoElemJson for CreateTriggerRequest {
4069    fn serialize_proto_json<S: ::serde::Serializer>(
4070        v: &Self,
4071        s: S,
4072    ) -> ::core::result::Result<S::Ok, S::Error> {
4073        ::serde::Serialize::serialize(v, s)
4074    }
4075    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4076        d: D,
4077    ) -> ::core::result::Result<Self, D::Error> {
4078        <Self as ::serde::Deserialize>::deserialize(d)
4079    }
4080}
4081#[doc(hidden)]
4082pub const __CREATE_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4083    type_url: "type.googleapis.com/triggers.v1.CreateTriggerRequest",
4084    to_json: ::buffa::type_registry::any_to_json::<CreateTriggerRequest>,
4085    from_json: ::buffa::type_registry::any_from_json::<CreateTriggerRequest>,
4086    is_wkt: false,
4087};
4088/// CreateTriggerResponse acknowledges trigger creation only. Arming and child
4089/// execution happen asynchronously and are visible through trigger reads/events.
4090#[derive(Clone, PartialEq, Default)]
4091#[derive(::serde::Serialize, ::serde::Deserialize)]
4092#[serde(default)]
4093pub struct CreateTriggerResponse {
4094    /// Assigned trigger ID.
4095    ///
4096    /// Field 1: `trigger_id`
4097    #[serde(
4098        rename = "triggerId",
4099        alias = "trigger_id",
4100        with = "::buffa::json_helpers::uint64",
4101        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4102    )]
4103    pub trigger_id: u64,
4104    /// Echoed client trigger ID.
4105    ///
4106    /// Field 2: `client_trigger_id`
4107    #[serde(
4108        rename = "clientTriggerId",
4109        alias = "client_trigger_id",
4110        with = "::buffa::json_helpers::proto_string",
4111        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4112    )]
4113    pub client_trigger_id: ::buffa::alloc::string::String,
4114    /// Time creation admission completed.
4115    ///
4116    /// Field 3: `accepted_at`
4117    #[serde(
4118        rename = "acceptedAt",
4119        alias = "accepted_at",
4120        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4121    )]
4122    pub accepted_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
4123    /// Admission completion time in nanoseconds since epoch (UTC).
4124    ///
4125    /// Field 4: `accepted_at_ts_ns`
4126    #[serde(
4127        rename = "acceptedAtTsNs",
4128        alias = "accepted_at_ts_ns",
4129        with = "::buffa::json_helpers::uint64",
4130        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4131    )]
4132    pub accepted_at_ts_ns: u64,
4133    #[serde(skip)]
4134    #[doc(hidden)]
4135    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4136}
4137impl ::core::fmt::Debug for CreateTriggerResponse {
4138    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4139        f.debug_struct("CreateTriggerResponse")
4140            .field("trigger_id", &self.trigger_id)
4141            .field("client_trigger_id", &self.client_trigger_id)
4142            .field("accepted_at", &self.accepted_at)
4143            .field("accepted_at_ts_ns", &self.accepted_at_ts_ns)
4144            .finish()
4145    }
4146}
4147impl CreateTriggerResponse {
4148    /// Protobuf type URL for this message, for use with `Any::pack` and
4149    /// `Any::unpack_if`.
4150    ///
4151    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4152    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
4153}
4154::buffa::impl_default_instance!(CreateTriggerResponse);
4155impl ::buffa::MessageName for CreateTriggerResponse {
4156    const PACKAGE: &'static str = "triggers.v1";
4157    const NAME: &'static str = "CreateTriggerResponse";
4158    const FULL_NAME: &'static str = "triggers.v1.CreateTriggerResponse";
4159    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
4160}
4161impl ::buffa::Message for CreateTriggerResponse {
4162    /// Returns the total encoded size in bytes.
4163    ///
4164    /// The result is a `u32`; the protobuf specification requires all
4165    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4166    /// compliant message will never overflow this type.
4167    #[allow(clippy::let_and_return)]
4168    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4169        #[allow(unused_imports)]
4170        use ::buffa::Enumeration as _;
4171        let mut size = 0u32;
4172        if self.trigger_id != 0u64 {
4173            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4174        }
4175        if !self.client_trigger_id.is_empty() {
4176            size
4177                += 1u32
4178                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
4179        }
4180        if self.accepted_at.is_set() {
4181            let __slot = __cache.reserve();
4182            let inner_size = self.accepted_at.compute_size(__cache);
4183            __cache.set(__slot, inner_size);
4184            size
4185                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4186                    + inner_size;
4187        }
4188        if self.accepted_at_ts_ns != 0u64 {
4189            size
4190                += 1u32
4191                    + ::buffa::types::uint64_encoded_len(self.accepted_at_ts_ns) as u32;
4192        }
4193        size += self.__buffa_unknown_fields.encoded_len() as u32;
4194        size
4195    }
4196    fn write_to(
4197        &self,
4198        __cache: &mut ::buffa::SizeCache,
4199        buf: &mut impl ::buffa::bytes::BufMut,
4200    ) {
4201        #[allow(unused_imports)]
4202        use ::buffa::Enumeration as _;
4203        if self.trigger_id != 0u64 {
4204            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
4205        }
4206        if !self.client_trigger_id.is_empty() {
4207            ::buffa::types::put_string_field(2u32, &self.client_trigger_id, buf);
4208        }
4209        if self.accepted_at.is_set() {
4210            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
4211            self.accepted_at.write_to(__cache, buf);
4212        }
4213        if self.accepted_at_ts_ns != 0u64 {
4214            ::buffa::types::put_uint64_field(4u32, self.accepted_at_ts_ns, buf);
4215        }
4216        self.__buffa_unknown_fields.write_to(buf);
4217    }
4218    fn merge_field(
4219        &mut self,
4220        tag: ::buffa::encoding::Tag,
4221        buf: &mut impl ::buffa::bytes::Buf,
4222        ctx: ::buffa::DecodeContext<'_>,
4223    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4224        #[allow(unused_imports)]
4225        use ::buffa::bytes::Buf as _;
4226        #[allow(unused_imports)]
4227        use ::buffa::Enumeration as _;
4228        match tag.field_number() {
4229            1u32 => {
4230                ::buffa::encoding::check_wire_type(
4231                    tag,
4232                    ::buffa::encoding::WireType::Fixed64,
4233                )?;
4234                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
4235            }
4236            2u32 => {
4237                ::buffa::encoding::check_wire_type(
4238                    tag,
4239                    ::buffa::encoding::WireType::LengthDelimited,
4240                )?;
4241                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
4242            }
4243            3u32 => {
4244                ::buffa::encoding::check_wire_type(
4245                    tag,
4246                    ::buffa::encoding::WireType::LengthDelimited,
4247                )?;
4248                ::buffa::Message::merge_length_delimited(
4249                    self.accepted_at.get_or_insert_default(),
4250                    buf,
4251                    ctx,
4252                )?;
4253            }
4254            4u32 => {
4255                ::buffa::encoding::check_wire_type(
4256                    tag,
4257                    ::buffa::encoding::WireType::Varint,
4258                )?;
4259                self.accepted_at_ts_ns = ::buffa::types::decode_uint64(buf)?;
4260            }
4261            _ => {
4262                self.__buffa_unknown_fields
4263                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4264            }
4265        }
4266        ::core::result::Result::Ok(())
4267    }
4268    fn clear(&mut self) {
4269        self.trigger_id = 0u64;
4270        self.client_trigger_id.clear();
4271        self.accepted_at = ::buffa::MessageField::none();
4272        self.accepted_at_ts_ns = 0u64;
4273        self.__buffa_unknown_fields.clear();
4274    }
4275}
4276impl ::buffa::ExtensionSet for CreateTriggerResponse {
4277    const PROTO_FQN: &'static str = "triggers.v1.CreateTriggerResponse";
4278    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4279        &self.__buffa_unknown_fields
4280    }
4281    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4282        &mut self.__buffa_unknown_fields
4283    }
4284}
4285impl ::buffa::json_helpers::ProtoElemJson for CreateTriggerResponse {
4286    fn serialize_proto_json<S: ::serde::Serializer>(
4287        v: &Self,
4288        s: S,
4289    ) -> ::core::result::Result<S::Ok, S::Error> {
4290        ::serde::Serialize::serialize(v, s)
4291    }
4292    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4293        d: D,
4294    ) -> ::core::result::Result<Self, D::Error> {
4295        <Self as ::serde::Deserialize>::deserialize(d)
4296    }
4297}
4298#[doc(hidden)]
4299pub const __CREATE_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4300    type_url: "type.googleapis.com/triggers.v1.CreateTriggerResponse",
4301    to_json: ::buffa::type_registry::any_to_json::<CreateTriggerResponse>,
4302    from_json: ::buffa::type_registry::any_from_json::<CreateTriggerResponse>,
4303    is_wkt: false,
4304};
4305/// =============================================================================
4306/// Get Trigger
4307/// =============================================================================
4308///
4309/// GetTriggerRequest retrieves one trigger by ID.
4310#[derive(Clone, PartialEq, Default)]
4311#[derive(::serde::Serialize, ::serde::Deserialize)]
4312#[serde(default)]
4313pub struct GetTriggerRequest {
4314    /// Trigger ID to retrieve.
4315    ///
4316    /// Field 1: `trigger_id`
4317    #[serde(
4318        rename = "triggerId",
4319        alias = "trigger_id",
4320        with = "::buffa::json_helpers::uint64",
4321        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
4322    )]
4323    pub trigger_id: u64,
4324    /// Optional sub-account for authorization.
4325    ///
4326    /// Field 2: `subaccount_id`
4327    #[serde(
4328        rename = "subaccountId",
4329        alias = "subaccount_id",
4330        with = "::buffa::json_helpers::opt_uint64",
4331        skip_serializing_if = "::core::option::Option::is_none"
4332    )]
4333    pub subaccount_id: ::core::option::Option<u64>,
4334    #[serde(skip)]
4335    #[doc(hidden)]
4336    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4337}
4338impl ::core::fmt::Debug for GetTriggerRequest {
4339    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4340        f.debug_struct("GetTriggerRequest")
4341            .field("trigger_id", &self.trigger_id)
4342            .field("subaccount_id", &self.subaccount_id)
4343            .finish()
4344    }
4345}
4346impl GetTriggerRequest {
4347    /// Protobuf type URL for this message, for use with `Any::pack` and
4348    /// `Any::unpack_if`.
4349    ///
4350    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4351    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
4352}
4353impl GetTriggerRequest {
4354    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4355    #[inline]
4356    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
4357    pub fn with_subaccount_id(mut self, value: u64) -> Self {
4358        self.subaccount_id = Some(value);
4359        self
4360    }
4361}
4362::buffa::impl_default_instance!(GetTriggerRequest);
4363impl ::buffa::MessageName for GetTriggerRequest {
4364    const PACKAGE: &'static str = "triggers.v1";
4365    const NAME: &'static str = "GetTriggerRequest";
4366    const FULL_NAME: &'static str = "triggers.v1.GetTriggerRequest";
4367    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
4368}
4369impl ::buffa::Message for GetTriggerRequest {
4370    /// Returns the total encoded size in bytes.
4371    ///
4372    /// The result is a `u32`; the protobuf specification requires all
4373    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4374    /// compliant message will never overflow this type.
4375    #[allow(clippy::let_and_return)]
4376    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4377        #[allow(unused_imports)]
4378        use ::buffa::Enumeration as _;
4379        let mut size = 0u32;
4380        if self.trigger_id != 0u64 {
4381            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4382        }
4383        if self.subaccount_id.is_some() {
4384            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4385        }
4386        size += self.__buffa_unknown_fields.encoded_len() as u32;
4387        size
4388    }
4389    fn write_to(
4390        &self,
4391        _cache: &mut ::buffa::SizeCache,
4392        buf: &mut impl ::buffa::bytes::BufMut,
4393    ) {
4394        #[allow(unused_imports)]
4395        use ::buffa::Enumeration as _;
4396        if self.trigger_id != 0u64 {
4397            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
4398        }
4399        if let Some(v) = self.subaccount_id {
4400            ::buffa::types::put_fixed64_field(2u32, v, buf);
4401        }
4402        self.__buffa_unknown_fields.write_to(buf);
4403    }
4404    fn merge_field(
4405        &mut self,
4406        tag: ::buffa::encoding::Tag,
4407        buf: &mut impl ::buffa::bytes::Buf,
4408        ctx: ::buffa::DecodeContext<'_>,
4409    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4410        #[allow(unused_imports)]
4411        use ::buffa::bytes::Buf as _;
4412        #[allow(unused_imports)]
4413        use ::buffa::Enumeration as _;
4414        match tag.field_number() {
4415            1u32 => {
4416                ::buffa::encoding::check_wire_type(
4417                    tag,
4418                    ::buffa::encoding::WireType::Fixed64,
4419                )?;
4420                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
4421            }
4422            2u32 => {
4423                ::buffa::encoding::check_wire_type(
4424                    tag,
4425                    ::buffa::encoding::WireType::Fixed64,
4426                )?;
4427                self.subaccount_id = ::core::option::Option::Some(
4428                    ::buffa::types::decode_fixed64(buf)?,
4429                );
4430            }
4431            _ => {
4432                self.__buffa_unknown_fields
4433                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4434            }
4435        }
4436        ::core::result::Result::Ok(())
4437    }
4438    fn clear(&mut self) {
4439        self.trigger_id = 0u64;
4440        self.subaccount_id = ::core::option::Option::None;
4441        self.__buffa_unknown_fields.clear();
4442    }
4443}
4444impl ::buffa::ExtensionSet for GetTriggerRequest {
4445    const PROTO_FQN: &'static str = "triggers.v1.GetTriggerRequest";
4446    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4447        &self.__buffa_unknown_fields
4448    }
4449    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4450        &mut self.__buffa_unknown_fields
4451    }
4452}
4453impl ::buffa::json_helpers::ProtoElemJson for GetTriggerRequest {
4454    fn serialize_proto_json<S: ::serde::Serializer>(
4455        v: &Self,
4456        s: S,
4457    ) -> ::core::result::Result<S::Ok, S::Error> {
4458        ::serde::Serialize::serialize(v, s)
4459    }
4460    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4461        d: D,
4462    ) -> ::core::result::Result<Self, D::Error> {
4463        <Self as ::serde::Deserialize>::deserialize(d)
4464    }
4465}
4466#[doc(hidden)]
4467pub const __GET_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4468    type_url: "type.googleapis.com/triggers.v1.GetTriggerRequest",
4469    to_json: ::buffa::type_registry::any_to_json::<GetTriggerRequest>,
4470    from_json: ::buffa::type_registry::any_from_json::<GetTriggerRequest>,
4471    is_wkt: false,
4472};
4473/// GetTriggerResponse returns the requested trigger.
4474#[derive(Clone, PartialEq, Default)]
4475#[derive(::serde::Serialize, ::serde::Deserialize)]
4476#[serde(default)]
4477pub struct GetTriggerResponse {
4478    /// Trigger state and configuration.
4479    ///
4480    /// Field 1: `trigger`
4481    #[serde(
4482        rename = "trigger",
4483        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4484    )]
4485    pub trigger: ::buffa::MessageField<Trigger>,
4486    #[serde(skip)]
4487    #[doc(hidden)]
4488    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4489}
4490impl ::core::fmt::Debug for GetTriggerResponse {
4491    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4492        f.debug_struct("GetTriggerResponse").field("trigger", &self.trigger).finish()
4493    }
4494}
4495impl GetTriggerResponse {
4496    /// Protobuf type URL for this message, for use with `Any::pack` and
4497    /// `Any::unpack_if`.
4498    ///
4499    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4500    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
4501}
4502::buffa::impl_default_instance!(GetTriggerResponse);
4503impl ::buffa::MessageName for GetTriggerResponse {
4504    const PACKAGE: &'static str = "triggers.v1";
4505    const NAME: &'static str = "GetTriggerResponse";
4506    const FULL_NAME: &'static str = "triggers.v1.GetTriggerResponse";
4507    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
4508}
4509impl ::buffa::Message for GetTriggerResponse {
4510    /// Returns the total encoded size in bytes.
4511    ///
4512    /// The result is a `u32`; the protobuf specification requires all
4513    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4514    /// compliant message will never overflow this type.
4515    #[allow(clippy::let_and_return)]
4516    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4517        #[allow(unused_imports)]
4518        use ::buffa::Enumeration as _;
4519        let mut size = 0u32;
4520        if self.trigger.is_set() {
4521            let __slot = __cache.reserve();
4522            let inner_size = self.trigger.compute_size(__cache);
4523            __cache.set(__slot, inner_size);
4524            size
4525                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4526                    + inner_size;
4527        }
4528        size += self.__buffa_unknown_fields.encoded_len() as u32;
4529        size
4530    }
4531    fn write_to(
4532        &self,
4533        __cache: &mut ::buffa::SizeCache,
4534        buf: &mut impl ::buffa::bytes::BufMut,
4535    ) {
4536        #[allow(unused_imports)]
4537        use ::buffa::Enumeration as _;
4538        if self.trigger.is_set() {
4539            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
4540            self.trigger.write_to(__cache, buf);
4541        }
4542        self.__buffa_unknown_fields.write_to(buf);
4543    }
4544    fn merge_field(
4545        &mut self,
4546        tag: ::buffa::encoding::Tag,
4547        buf: &mut impl ::buffa::bytes::Buf,
4548        ctx: ::buffa::DecodeContext<'_>,
4549    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4550        #[allow(unused_imports)]
4551        use ::buffa::bytes::Buf as _;
4552        #[allow(unused_imports)]
4553        use ::buffa::Enumeration as _;
4554        match tag.field_number() {
4555            1u32 => {
4556                ::buffa::encoding::check_wire_type(
4557                    tag,
4558                    ::buffa::encoding::WireType::LengthDelimited,
4559                )?;
4560                ::buffa::Message::merge_length_delimited(
4561                    self.trigger.get_or_insert_default(),
4562                    buf,
4563                    ctx,
4564                )?;
4565            }
4566            _ => {
4567                self.__buffa_unknown_fields
4568                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4569            }
4570        }
4571        ::core::result::Result::Ok(())
4572    }
4573    fn clear(&mut self) {
4574        self.trigger = ::buffa::MessageField::none();
4575        self.__buffa_unknown_fields.clear();
4576    }
4577}
4578impl ::buffa::ExtensionSet for GetTriggerResponse {
4579    const PROTO_FQN: &'static str = "triggers.v1.GetTriggerResponse";
4580    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4581        &self.__buffa_unknown_fields
4582    }
4583    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4584        &mut self.__buffa_unknown_fields
4585    }
4586}
4587impl ::buffa::json_helpers::ProtoElemJson for GetTriggerResponse {
4588    fn serialize_proto_json<S: ::serde::Serializer>(
4589        v: &Self,
4590        s: S,
4591    ) -> ::core::result::Result<S::Ok, S::Error> {
4592        ::serde::Serialize::serialize(v, s)
4593    }
4594    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4595        d: D,
4596    ) -> ::core::result::Result<Self, D::Error> {
4597        <Self as ::serde::Deserialize>::deserialize(d)
4598    }
4599}
4600#[doc(hidden)]
4601pub const __GET_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4602    type_url: "type.googleapis.com/triggers.v1.GetTriggerResponse",
4603    to_json: ::buffa::type_registry::any_to_json::<GetTriggerResponse>,
4604    from_json: ::buffa::type_registry::any_from_json::<GetTriggerResponse>,
4605    is_wkt: false,
4606};
4607/// =============================================================================
4608/// List Triggers
4609/// =============================================================================
4610///
4611/// ListTriggersRequest lists triggers for an account.
4612#[derive(Clone, PartialEq, Default)]
4613#[derive(::serde::Serialize, ::serde::Deserialize)]
4614#[serde(default)]
4615pub struct ListTriggersRequest {
4616    /// Optional sub-account to list triggers for. When empty or omitted, uses the
4617    /// caller's root account.
4618    ///
4619    /// Field 1: `subaccount_id`
4620    #[serde(
4621        rename = "subaccountId",
4622        alias = "subaccount_id",
4623        with = "::buffa::json_helpers::opt_uint64",
4624        skip_serializing_if = "::core::option::Option::is_none"
4625    )]
4626    pub subaccount_id: ::core::option::Option<u64>,
4627    /// Optional filter by symbol.
4628    ///
4629    /// Field 2: `symbol`
4630    #[serde(
4631        rename = "symbol",
4632        with = "::buffa::json_helpers::proto_string",
4633        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4634    )]
4635    pub symbol: ::buffa::alloc::string::String,
4636    /// Optional filter by status (can specify multiple).
4637    ///
4638    /// Field 3: `status`
4639    #[serde(
4640        rename = "status",
4641        with = "::buffa::json_helpers::repeated_enum",
4642        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
4643    )]
4644    pub status: ::buffa::alloc::vec::Vec<::buffa::EnumValue<TriggerStatus>>,
4645    /// Optional filter by type.
4646    ///
4647    /// Field 4: `trigger_type`
4648    #[serde(
4649        rename = "triggerType",
4650        alias = "trigger_type",
4651        with = "::buffa::json_helpers::proto_enum",
4652        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
4653    )]
4654    pub trigger_type: ::buffa::EnumValue<TriggerType>,
4655    /// Optional filter by attached parent order ID.
4656    ///
4657    /// Field 5: `parent_order_id`
4658    #[serde(
4659        rename = "parentOrderId",
4660        alias = "parent_order_id",
4661        with = "::buffa::json_helpers::opt_uint64",
4662        skip_serializing_if = "::core::option::Option::is_none"
4663    )]
4664    pub parent_order_id: ::core::option::Option<u64>,
4665    /// Maximum number of triggers to return. Defaults to 100 when omitted;
4666    /// maximum is 1000.
4667    ///
4668    /// Field 10: `limit`
4669    #[serde(
4670        rename = "limit",
4671        with = "::buffa::json_helpers::uint32",
4672        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4673    )]
4674    pub limit: u32,
4675    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
4676    /// bound to the authenticated account, sub-account scope, filters, and newest
4677    /// first sort order.
4678    ///
4679    /// Field 12: `page_token`
4680    #[serde(
4681        rename = "pageToken",
4682        alias = "page_token",
4683        with = "::buffa::json_helpers::proto_string",
4684        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4685    )]
4686    pub page_token: ::buffa::alloc::string::String,
4687    #[serde(skip)]
4688    #[doc(hidden)]
4689    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4690}
4691impl ::core::fmt::Debug for ListTriggersRequest {
4692    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4693        f.debug_struct("ListTriggersRequest")
4694            .field("subaccount_id", &self.subaccount_id)
4695            .field("symbol", &self.symbol)
4696            .field("status", &self.status)
4697            .field("trigger_type", &self.trigger_type)
4698            .field("parent_order_id", &self.parent_order_id)
4699            .field("limit", &self.limit)
4700            .field("page_token", &self.page_token)
4701            .finish()
4702    }
4703}
4704impl ListTriggersRequest {
4705    /// Protobuf type URL for this message, for use with `Any::pack` and
4706    /// `Any::unpack_if`.
4707    ///
4708    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4709    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
4710}
4711impl ListTriggersRequest {
4712    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4713    #[inline]
4714    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
4715    pub fn with_subaccount_id(mut self, value: u64) -> Self {
4716        self.subaccount_id = Some(value);
4717        self
4718    }
4719    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4720    #[inline]
4721    ///Sets [`Self::parent_order_id`] to `Some(value)`, consuming and returning `self`.
4722    pub fn with_parent_order_id(mut self, value: u64) -> Self {
4723        self.parent_order_id = Some(value);
4724        self
4725    }
4726}
4727::buffa::impl_default_instance!(ListTriggersRequest);
4728impl ::buffa::MessageName for ListTriggersRequest {
4729    const PACKAGE: &'static str = "triggers.v1";
4730    const NAME: &'static str = "ListTriggersRequest";
4731    const FULL_NAME: &'static str = "triggers.v1.ListTriggersRequest";
4732    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
4733}
4734impl ::buffa::Message for ListTriggersRequest {
4735    /// Returns the total encoded size in bytes.
4736    ///
4737    /// The result is a `u32`; the protobuf specification requires all
4738    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4739    /// compliant message will never overflow this type.
4740    #[allow(clippy::let_and_return)]
4741    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4742        #[allow(unused_imports)]
4743        use ::buffa::Enumeration as _;
4744        let mut size = 0u32;
4745        if self.subaccount_id.is_some() {
4746            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4747        }
4748        if !self.symbol.is_empty() {
4749            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
4750        }
4751        if !self.status.is_empty() {
4752            let payload: u32 = self
4753                .status
4754                .iter()
4755                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
4756                .sum::<u32>();
4757            size
4758                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
4759        }
4760        {
4761            let val = self.trigger_type.to_i32();
4762            if val != 0 {
4763                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4764            }
4765        }
4766        if self.parent_order_id.is_some() {
4767            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
4768        }
4769        if self.limit != 0u32 {
4770            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
4771        }
4772        if !self.page_token.is_empty() {
4773            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
4774        }
4775        size += self.__buffa_unknown_fields.encoded_len() as u32;
4776        size
4777    }
4778    fn write_to(
4779        &self,
4780        _cache: &mut ::buffa::SizeCache,
4781        buf: &mut impl ::buffa::bytes::BufMut,
4782    ) {
4783        #[allow(unused_imports)]
4784        use ::buffa::Enumeration as _;
4785        if let Some(v) = self.subaccount_id {
4786            ::buffa::types::put_fixed64_field(1u32, v, buf);
4787        }
4788        if !self.symbol.is_empty() {
4789            ::buffa::types::put_string_field(2u32, &self.symbol, buf);
4790        }
4791        if !self.status.is_empty() {
4792            let payload: u32 = self
4793                .status
4794                .iter()
4795                .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
4796                .sum::<u32>();
4797            ::buffa::types::put_len_delimited_header(3u32, payload, buf);
4798            for v in &self.status {
4799                ::buffa::types::encode_int32(v.to_i32(), buf);
4800            }
4801        }
4802        {
4803            let val = self.trigger_type.to_i32();
4804            if val != 0 {
4805                ::buffa::types::put_int32_field(4u32, val, buf);
4806            }
4807        }
4808        if let Some(v) = self.parent_order_id {
4809            ::buffa::types::put_fixed64_field(5u32, v, buf);
4810        }
4811        if self.limit != 0u32 {
4812            ::buffa::types::put_uint32_field(10u32, self.limit, buf);
4813        }
4814        if !self.page_token.is_empty() {
4815            ::buffa::types::put_string_field(12u32, &self.page_token, buf);
4816        }
4817        self.__buffa_unknown_fields.write_to(buf);
4818    }
4819    fn merge_field(
4820        &mut self,
4821        tag: ::buffa::encoding::Tag,
4822        buf: &mut impl ::buffa::bytes::Buf,
4823        ctx: ::buffa::DecodeContext<'_>,
4824    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4825        #[allow(unused_imports)]
4826        use ::buffa::bytes::Buf as _;
4827        #[allow(unused_imports)]
4828        use ::buffa::Enumeration as _;
4829        match tag.field_number() {
4830            1u32 => {
4831                ::buffa::encoding::check_wire_type(
4832                    tag,
4833                    ::buffa::encoding::WireType::Fixed64,
4834                )?;
4835                self.subaccount_id = ::core::option::Option::Some(
4836                    ::buffa::types::decode_fixed64(buf)?,
4837                );
4838            }
4839            2u32 => {
4840                ::buffa::encoding::check_wire_type(
4841                    tag,
4842                    ::buffa::encoding::WireType::LengthDelimited,
4843                )?;
4844                ::buffa::types::merge_string(&mut self.symbol, buf)?;
4845            }
4846            3u32 => {
4847                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
4848                    let len = ::buffa::encoding::decode_varint(buf)?;
4849                    let len = usize::try_from(len)
4850                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
4851                    if buf.remaining() < len {
4852                        return ::core::result::Result::Err(
4853                            ::buffa::DecodeError::UnexpectedEof,
4854                        );
4855                    }
4856                    self.status.reserve(len);
4857                    let mut limited = buf.take(len);
4858                    while limited.has_remaining() {
4859                        self.status
4860                            .push(
4861                                ::buffa::EnumValue::from(
4862                                    ::buffa::types::decode_int32(&mut limited)?,
4863                                ),
4864                            );
4865                    }
4866                    let leftover = limited.remaining();
4867                    if leftover > 0 {
4868                        limited.advance(leftover);
4869                    }
4870                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
4871                    self.status
4872                        .push(
4873                            ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
4874                        );
4875                } else {
4876                    return ::core::result::Result::Err(
4877                        ::buffa::encoding::wire_type_mismatch(
4878                            tag,
4879                            ::buffa::encoding::WireType::LengthDelimited,
4880                        ),
4881                    );
4882                }
4883            }
4884            4u32 => {
4885                ::buffa::encoding::check_wire_type(
4886                    tag,
4887                    ::buffa::encoding::WireType::Varint,
4888                )?;
4889                self.trigger_type = ::buffa::EnumValue::from(
4890                    ::buffa::types::decode_int32(buf)?,
4891                );
4892            }
4893            5u32 => {
4894                ::buffa::encoding::check_wire_type(
4895                    tag,
4896                    ::buffa::encoding::WireType::Fixed64,
4897                )?;
4898                self.parent_order_id = ::core::option::Option::Some(
4899                    ::buffa::types::decode_fixed64(buf)?,
4900                );
4901            }
4902            10u32 => {
4903                ::buffa::encoding::check_wire_type(
4904                    tag,
4905                    ::buffa::encoding::WireType::Varint,
4906                )?;
4907                self.limit = ::buffa::types::decode_uint32(buf)?;
4908            }
4909            12u32 => {
4910                ::buffa::encoding::check_wire_type(
4911                    tag,
4912                    ::buffa::encoding::WireType::LengthDelimited,
4913                )?;
4914                ::buffa::types::merge_string(&mut self.page_token, buf)?;
4915            }
4916            _ => {
4917                self.__buffa_unknown_fields
4918                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4919            }
4920        }
4921        ::core::result::Result::Ok(())
4922    }
4923    fn clear(&mut self) {
4924        self.subaccount_id = ::core::option::Option::None;
4925        self.symbol.clear();
4926        self.status.clear();
4927        self.trigger_type = ::buffa::EnumValue::from(0);
4928        self.parent_order_id = ::core::option::Option::None;
4929        self.limit = 0u32;
4930        self.page_token.clear();
4931        self.__buffa_unknown_fields.clear();
4932    }
4933}
4934impl ::buffa::ExtensionSet for ListTriggersRequest {
4935    const PROTO_FQN: &'static str = "triggers.v1.ListTriggersRequest";
4936    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4937        &self.__buffa_unknown_fields
4938    }
4939    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4940        &mut self.__buffa_unknown_fields
4941    }
4942}
4943impl ::buffa::json_helpers::ProtoElemJson for ListTriggersRequest {
4944    fn serialize_proto_json<S: ::serde::Serializer>(
4945        v: &Self,
4946        s: S,
4947    ) -> ::core::result::Result<S::Ok, S::Error> {
4948        ::serde::Serialize::serialize(v, s)
4949    }
4950    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4951        d: D,
4952    ) -> ::core::result::Result<Self, D::Error> {
4953        <Self as ::serde::Deserialize>::deserialize(d)
4954    }
4955}
4956#[doc(hidden)]
4957pub const __LIST_TRIGGERS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4958    type_url: "type.googleapis.com/triggers.v1.ListTriggersRequest",
4959    to_json: ::buffa::type_registry::any_to_json::<ListTriggersRequest>,
4960    from_json: ::buffa::type_registry::any_from_json::<ListTriggersRequest>,
4961    is_wkt: false,
4962};
4963/// ListTriggersResponse returns triggers ordered newest-first.
4964#[derive(Clone, PartialEq, Default)]
4965#[derive(::serde::Serialize, ::serde::Deserialize)]
4966#[serde(default)]
4967pub struct ListTriggersResponse {
4968    /// Triggers ordered by creation time descending, then trigger ID descending.
4969    ///
4970    /// Field 1: `triggers`
4971    #[serde(
4972        rename = "triggers",
4973        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
4974        deserialize_with = "::buffa::json_helpers::null_as_default"
4975    )]
4976    pub triggers: ::buffa::alloc::vec::Vec<Trigger>,
4977    /// Opaque cursor for the next page. Empty when no more results exist.
4978    ///
4979    /// Field 3: `next_page_token`
4980    #[serde(
4981        rename = "nextPageToken",
4982        alias = "next_page_token",
4983        with = "::buffa::json_helpers::proto_string",
4984        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4985    )]
4986    pub next_page_token: ::buffa::alloc::string::String,
4987    #[serde(skip)]
4988    #[doc(hidden)]
4989    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4990}
4991impl ::core::fmt::Debug for ListTriggersResponse {
4992    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4993        f.debug_struct("ListTriggersResponse")
4994            .field("triggers", &self.triggers)
4995            .field("next_page_token", &self.next_page_token)
4996            .finish()
4997    }
4998}
4999impl ListTriggersResponse {
5000    /// Protobuf type URL for this message, for use with `Any::pack` and
5001    /// `Any::unpack_if`.
5002    ///
5003    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5004    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
5005}
5006::buffa::impl_default_instance!(ListTriggersResponse);
5007impl ::buffa::MessageName for ListTriggersResponse {
5008    const PACKAGE: &'static str = "triggers.v1";
5009    const NAME: &'static str = "ListTriggersResponse";
5010    const FULL_NAME: &'static str = "triggers.v1.ListTriggersResponse";
5011    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
5012}
5013impl ::buffa::Message for ListTriggersResponse {
5014    /// Returns the total encoded size in bytes.
5015    ///
5016    /// The result is a `u32`; the protobuf specification requires all
5017    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5018    /// compliant message will never overflow this type.
5019    #[allow(clippy::let_and_return)]
5020    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5021        #[allow(unused_imports)]
5022        use ::buffa::Enumeration as _;
5023        let mut size = 0u32;
5024        for v in &self.triggers {
5025            let __slot = __cache.reserve();
5026            let inner_size = v.compute_size(__cache);
5027            __cache.set(__slot, inner_size);
5028            size
5029                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5030                    + inner_size;
5031        }
5032        if !self.next_page_token.is_empty() {
5033            size
5034                += 1u32
5035                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5036        }
5037        size += self.__buffa_unknown_fields.encoded_len() as u32;
5038        size
5039    }
5040    fn write_to(
5041        &self,
5042        __cache: &mut ::buffa::SizeCache,
5043        buf: &mut impl ::buffa::bytes::BufMut,
5044    ) {
5045        #[allow(unused_imports)]
5046        use ::buffa::Enumeration as _;
5047        for v in &self.triggers {
5048            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
5049            v.write_to(__cache, buf);
5050        }
5051        if !self.next_page_token.is_empty() {
5052            ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
5053        }
5054        self.__buffa_unknown_fields.write_to(buf);
5055    }
5056    fn merge_field(
5057        &mut self,
5058        tag: ::buffa::encoding::Tag,
5059        buf: &mut impl ::buffa::bytes::Buf,
5060        ctx: ::buffa::DecodeContext<'_>,
5061    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5062        #[allow(unused_imports)]
5063        use ::buffa::bytes::Buf as _;
5064        #[allow(unused_imports)]
5065        use ::buffa::Enumeration as _;
5066        match tag.field_number() {
5067            1u32 => {
5068                ::buffa::encoding::check_wire_type(
5069                    tag,
5070                    ::buffa::encoding::WireType::LengthDelimited,
5071                )?;
5072                let mut elem = ::core::default::Default::default();
5073                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5074                self.triggers.push(elem);
5075            }
5076            3u32 => {
5077                ::buffa::encoding::check_wire_type(
5078                    tag,
5079                    ::buffa::encoding::WireType::LengthDelimited,
5080                )?;
5081                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5082            }
5083            _ => {
5084                self.__buffa_unknown_fields
5085                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5086            }
5087        }
5088        ::core::result::Result::Ok(())
5089    }
5090    fn clear(&mut self) {
5091        self.triggers.clear();
5092        self.next_page_token.clear();
5093        self.__buffa_unknown_fields.clear();
5094    }
5095}
5096impl ::buffa::ExtensionSet for ListTriggersResponse {
5097    const PROTO_FQN: &'static str = "triggers.v1.ListTriggersResponse";
5098    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5099        &self.__buffa_unknown_fields
5100    }
5101    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5102        &mut self.__buffa_unknown_fields
5103    }
5104}
5105impl ::buffa::json_helpers::ProtoElemJson for ListTriggersResponse {
5106    fn serialize_proto_json<S: ::serde::Serializer>(
5107        v: &Self,
5108        s: S,
5109    ) -> ::core::result::Result<S::Ok, S::Error> {
5110        ::serde::Serialize::serialize(v, s)
5111    }
5112    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5113        d: D,
5114    ) -> ::core::result::Result<Self, D::Error> {
5115        <Self as ::serde::Deserialize>::deserialize(d)
5116    }
5117}
5118#[doc(hidden)]
5119pub const __LIST_TRIGGERS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5120    type_url: "type.googleapis.com/triggers.v1.ListTriggersResponse",
5121    to_json: ::buffa::type_registry::any_to_json::<ListTriggersResponse>,
5122    from_json: ::buffa::type_registry::any_from_json::<ListTriggersResponse>,
5123    is_wkt: false,
5124};
5125/// =============================================================================
5126/// Trigger Events (History / Audit)
5127/// =============================================================================
5128///
5129/// ListTriggerEventsRequest lists historical events for one trigger.
5130#[derive(Clone, PartialEq, Default)]
5131#[derive(::serde::Serialize, ::serde::Deserialize)]
5132#[serde(default)]
5133pub struct ListTriggerEventsRequest {
5134    /// Trigger ID to list events for.
5135    ///
5136    /// Field 1: `trigger_id`
5137    #[serde(
5138        rename = "triggerId",
5139        alias = "trigger_id",
5140        with = "::buffa::json_helpers::uint64",
5141        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5142    )]
5143    pub trigger_id: u64,
5144    /// Optional sub-account (authorization). When empty or omitted, uses the
5145    /// caller's root account.
5146    ///
5147    /// Field 2: `subaccount_id`
5148    #[serde(
5149        rename = "subaccountId",
5150        alias = "subaccount_id",
5151        with = "::buffa::json_helpers::opt_uint64",
5152        skip_serializing_if = "::core::option::Option::is_none"
5153    )]
5154    pub subaccount_id: ::core::option::Option<u64>,
5155    /// Maximum number of events to return. Defaults to 100 when omitted; maximum
5156    /// is 1000.
5157    ///
5158    /// Field 3: `limit`
5159    #[serde(
5160        rename = "limit",
5161        with = "::buffa::json_helpers::uint32",
5162        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5163    )]
5164    pub limit: u32,
5165    /// Optional event category filter. When unspecified, returns all event
5166    /// categories. Use EVENT_FIRED to enumerate child-order actions.
5167    ///
5168    /// Field 4: `event_type`
5169    #[serde(
5170        rename = "eventType",
5171        alias = "event_type",
5172        with = "::buffa::json_helpers::proto_enum",
5173        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5174    )]
5175    pub event_type: ::buffa::EnumValue<TriggerEventType>,
5176    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
5177    /// bound to the authenticated account, trigger, sub-account scope, event
5178    /// filter, and newest-first sort order.
5179    ///
5180    /// Field 5: `page_token`
5181    #[serde(
5182        rename = "pageToken",
5183        alias = "page_token",
5184        with = "::buffa::json_helpers::proto_string",
5185        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5186    )]
5187    pub page_token: ::buffa::alloc::string::String,
5188    #[serde(skip)]
5189    #[doc(hidden)]
5190    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5191}
5192impl ::core::fmt::Debug for ListTriggerEventsRequest {
5193    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5194        f.debug_struct("ListTriggerEventsRequest")
5195            .field("trigger_id", &self.trigger_id)
5196            .field("subaccount_id", &self.subaccount_id)
5197            .field("limit", &self.limit)
5198            .field("event_type", &self.event_type)
5199            .field("page_token", &self.page_token)
5200            .finish()
5201    }
5202}
5203impl ListTriggerEventsRequest {
5204    /// Protobuf type URL for this message, for use with `Any::pack` and
5205    /// `Any::unpack_if`.
5206    ///
5207    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5208    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
5209}
5210impl ListTriggerEventsRequest {
5211    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5212    #[inline]
5213    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
5214    pub fn with_subaccount_id(mut self, value: u64) -> Self {
5215        self.subaccount_id = Some(value);
5216        self
5217    }
5218}
5219::buffa::impl_default_instance!(ListTriggerEventsRequest);
5220impl ::buffa::MessageName for ListTriggerEventsRequest {
5221    const PACKAGE: &'static str = "triggers.v1";
5222    const NAME: &'static str = "ListTriggerEventsRequest";
5223    const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsRequest";
5224    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
5225}
5226impl ::buffa::Message for ListTriggerEventsRequest {
5227    /// Returns the total encoded size in bytes.
5228    ///
5229    /// The result is a `u32`; the protobuf specification requires all
5230    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5231    /// compliant message will never overflow this type.
5232    #[allow(clippy::let_and_return)]
5233    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5234        #[allow(unused_imports)]
5235        use ::buffa::Enumeration as _;
5236        let mut size = 0u32;
5237        if self.trigger_id != 0u64 {
5238            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5239        }
5240        if self.subaccount_id.is_some() {
5241            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5242        }
5243        if self.limit != 0u32 {
5244            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
5245        }
5246        {
5247            let val = self.event_type.to_i32();
5248            if val != 0 {
5249                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5250            }
5251        }
5252        if !self.page_token.is_empty() {
5253            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
5254        }
5255        size += self.__buffa_unknown_fields.encoded_len() as u32;
5256        size
5257    }
5258    fn write_to(
5259        &self,
5260        _cache: &mut ::buffa::SizeCache,
5261        buf: &mut impl ::buffa::bytes::BufMut,
5262    ) {
5263        #[allow(unused_imports)]
5264        use ::buffa::Enumeration as _;
5265        if self.trigger_id != 0u64 {
5266            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5267        }
5268        if let Some(v) = self.subaccount_id {
5269            ::buffa::types::put_fixed64_field(2u32, v, buf);
5270        }
5271        if self.limit != 0u32 {
5272            ::buffa::types::put_uint32_field(3u32, self.limit, buf);
5273        }
5274        {
5275            let val = self.event_type.to_i32();
5276            if val != 0 {
5277                ::buffa::types::put_int32_field(4u32, val, buf);
5278            }
5279        }
5280        if !self.page_token.is_empty() {
5281            ::buffa::types::put_string_field(5u32, &self.page_token, buf);
5282        }
5283        self.__buffa_unknown_fields.write_to(buf);
5284    }
5285    fn merge_field(
5286        &mut self,
5287        tag: ::buffa::encoding::Tag,
5288        buf: &mut impl ::buffa::bytes::Buf,
5289        ctx: ::buffa::DecodeContext<'_>,
5290    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5291        #[allow(unused_imports)]
5292        use ::buffa::bytes::Buf as _;
5293        #[allow(unused_imports)]
5294        use ::buffa::Enumeration as _;
5295        match tag.field_number() {
5296            1u32 => {
5297                ::buffa::encoding::check_wire_type(
5298                    tag,
5299                    ::buffa::encoding::WireType::Fixed64,
5300                )?;
5301                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5302            }
5303            2u32 => {
5304                ::buffa::encoding::check_wire_type(
5305                    tag,
5306                    ::buffa::encoding::WireType::Fixed64,
5307                )?;
5308                self.subaccount_id = ::core::option::Option::Some(
5309                    ::buffa::types::decode_fixed64(buf)?,
5310                );
5311            }
5312            3u32 => {
5313                ::buffa::encoding::check_wire_type(
5314                    tag,
5315                    ::buffa::encoding::WireType::Varint,
5316                )?;
5317                self.limit = ::buffa::types::decode_uint32(buf)?;
5318            }
5319            4u32 => {
5320                ::buffa::encoding::check_wire_type(
5321                    tag,
5322                    ::buffa::encoding::WireType::Varint,
5323                )?;
5324                self.event_type = ::buffa::EnumValue::from(
5325                    ::buffa::types::decode_int32(buf)?,
5326                );
5327            }
5328            5u32 => {
5329                ::buffa::encoding::check_wire_type(
5330                    tag,
5331                    ::buffa::encoding::WireType::LengthDelimited,
5332                )?;
5333                ::buffa::types::merge_string(&mut self.page_token, buf)?;
5334            }
5335            _ => {
5336                self.__buffa_unknown_fields
5337                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5338            }
5339        }
5340        ::core::result::Result::Ok(())
5341    }
5342    fn clear(&mut self) {
5343        self.trigger_id = 0u64;
5344        self.subaccount_id = ::core::option::Option::None;
5345        self.limit = 0u32;
5346        self.event_type = ::buffa::EnumValue::from(0);
5347        self.page_token.clear();
5348        self.__buffa_unknown_fields.clear();
5349    }
5350}
5351impl ::buffa::ExtensionSet for ListTriggerEventsRequest {
5352    const PROTO_FQN: &'static str = "triggers.v1.ListTriggerEventsRequest";
5353    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5354        &self.__buffa_unknown_fields
5355    }
5356    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5357        &mut self.__buffa_unknown_fields
5358    }
5359}
5360impl ::buffa::json_helpers::ProtoElemJson for ListTriggerEventsRequest {
5361    fn serialize_proto_json<S: ::serde::Serializer>(
5362        v: &Self,
5363        s: S,
5364    ) -> ::core::result::Result<S::Ok, S::Error> {
5365        ::serde::Serialize::serialize(v, s)
5366    }
5367    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5368        d: D,
5369    ) -> ::core::result::Result<Self, D::Error> {
5370        <Self as ::serde::Deserialize>::deserialize(d)
5371    }
5372}
5373#[doc(hidden)]
5374pub const __LIST_TRIGGER_EVENTS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5375    type_url: "type.googleapis.com/triggers.v1.ListTriggerEventsRequest",
5376    to_json: ::buffa::type_registry::any_to_json::<ListTriggerEventsRequest>,
5377    from_json: ::buffa::type_registry::any_from_json::<ListTriggerEventsRequest>,
5378    is_wkt: false,
5379};
5380/// TriggerEvent describes one historical trigger lifecycle event.
5381#[derive(Clone, PartialEq, Default)]
5382#[derive(::serde::Serialize, ::serde::Deserialize)]
5383#[serde(default)]
5384pub struct TriggerEvent {
5385    /// Trigger ID associated with the event.
5386    ///
5387    /// Field 1: `trigger_id`
5388    #[serde(
5389        rename = "triggerId",
5390        alias = "trigger_id",
5391        with = "::buffa::json_helpers::uint64",
5392        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5393    )]
5394    pub trigger_id: u64,
5395    /// Public account or sub-account ID associated with the trigger.
5396    ///
5397    /// Field 2: `subaccount_id`
5398    #[serde(
5399        rename = "subaccountId",
5400        alias = "subaccount_id",
5401        with = "::buffa::json_helpers::uint64",
5402        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5403    )]
5404    pub subaccount_id: u64,
5405    /// Trading symbol numeric identifier.
5406    ///
5407    /// Field 3: `symbol_id`
5408    #[serde(
5409        rename = "symbolId",
5410        alias = "symbol_id",
5411        with = "::buffa::json_helpers::uint32",
5412        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5413    )]
5414    pub symbol_id: u32,
5415    /// Trigger type at the time of the event.
5416    ///
5417    /// Field 4: `trigger_type`
5418    #[serde(
5419        rename = "triggerType",
5420        alias = "trigger_type",
5421        with = "::buffa::json_helpers::proto_enum",
5422        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5423    )]
5424    pub trigger_type: ::buffa::EnumValue<TriggerType>,
5425    /// Event category.
5426    ///
5427    /// Field 5: `event_type`
5428    #[serde(
5429        rename = "eventType",
5430        alias = "event_type",
5431        with = "::buffa::json_helpers::proto_enum",
5432        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5433    )]
5434    pub event_type: ::buffa::EnumValue<TriggerEventType>,
5435    /// Event timestamp in nanoseconds since epoch (UTC).
5436    ///
5437    /// Field 10: `ts_ns`
5438    #[serde(
5439        rename = "tsNs",
5440        alias = "ts_ns",
5441        with = "::buffa::json_helpers::uint64",
5442        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5443    )]
5444    pub ts_ns: u64,
5445    /// Child sequence number for multi-child trigger strategies.
5446    ///
5447    /// Field 11: `child_seq`
5448    #[serde(
5449        rename = "childSeq",
5450        alias = "child_seq",
5451        with = "::buffa::json_helpers::int32",
5452        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
5453    )]
5454    pub child_seq: i32,
5455    /// Child order ID created by this event, if any.
5456    ///
5457    /// Field 12: `child_order_id`
5458    #[serde(
5459        rename = "childOrderId",
5460        alias = "child_order_id",
5461        with = "::buffa::json_helpers::uint64",
5462        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5463    )]
5464    pub child_order_id: u64,
5465    /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
5466    /// when not applicable.
5467    ///
5468    /// Field 13: `fire_price_ticks`
5469    #[serde(
5470        rename = "firePriceTicks",
5471        alias = "fire_price_ticks",
5472        with = "::buffa::json_helpers::int64",
5473        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5474    )]
5475    pub fire_price_ticks: i64,
5476    /// Optional cancel reason.
5477    ///
5478    /// Field 20: `reason`
5479    #[serde(
5480        rename = "reason",
5481        with = "::buffa::json_helpers::proto_string",
5482        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5483    )]
5484    pub reason: ::buffa::alloc::string::String,
5485    #[serde(skip)]
5486    #[doc(hidden)]
5487    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5488}
5489impl ::core::fmt::Debug for TriggerEvent {
5490    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5491        f.debug_struct("TriggerEvent")
5492            .field("trigger_id", &self.trigger_id)
5493            .field("subaccount_id", &self.subaccount_id)
5494            .field("symbol_id", &self.symbol_id)
5495            .field("trigger_type", &self.trigger_type)
5496            .field("event_type", &self.event_type)
5497            .field("ts_ns", &self.ts_ns)
5498            .field("child_seq", &self.child_seq)
5499            .field("child_order_id", &self.child_order_id)
5500            .field("fire_price_ticks", &self.fire_price_ticks)
5501            .field("reason", &self.reason)
5502            .finish()
5503    }
5504}
5505impl TriggerEvent {
5506    /// Protobuf type URL for this message, for use with `Any::pack` and
5507    /// `Any::unpack_if`.
5508    ///
5509    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5510    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
5511}
5512::buffa::impl_default_instance!(TriggerEvent);
5513impl ::buffa::MessageName for TriggerEvent {
5514    const PACKAGE: &'static str = "triggers.v1";
5515    const NAME: &'static str = "TriggerEvent";
5516    const FULL_NAME: &'static str = "triggers.v1.TriggerEvent";
5517    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
5518}
5519impl ::buffa::Message for TriggerEvent {
5520    /// Returns the total encoded size in bytes.
5521    ///
5522    /// The result is a `u32`; the protobuf specification requires all
5523    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5524    /// compliant message will never overflow this type.
5525    #[allow(clippy::let_and_return)]
5526    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5527        #[allow(unused_imports)]
5528        use ::buffa::Enumeration as _;
5529        let mut size = 0u32;
5530        if self.trigger_id != 0u64 {
5531            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5532        }
5533        if self.subaccount_id != 0u64 {
5534            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5535        }
5536        if self.symbol_id != 0u32 {
5537            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
5538        }
5539        {
5540            let val = self.trigger_type.to_i32();
5541            if val != 0 {
5542                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5543            }
5544        }
5545        {
5546            let val = self.event_type.to_i32();
5547            if val != 0 {
5548                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5549            }
5550        }
5551        if self.ts_ns != 0u64 {
5552            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
5553        }
5554        if self.child_seq != 0i32 {
5555            size += 1u32 + ::buffa::types::int32_encoded_len(self.child_seq) as u32;
5556        }
5557        if self.child_order_id != 0u64 {
5558            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5559        }
5560        if self.fire_price_ticks != 0i64 {
5561            size
5562                += 1u32
5563                    + ::buffa::types::int64_encoded_len(self.fire_price_ticks) as u32;
5564        }
5565        if !self.reason.is_empty() {
5566            size += 2u32 + ::buffa::types::string_encoded_len(&self.reason) as u32;
5567        }
5568        size += self.__buffa_unknown_fields.encoded_len() as u32;
5569        size
5570    }
5571    fn write_to(
5572        &self,
5573        _cache: &mut ::buffa::SizeCache,
5574        buf: &mut impl ::buffa::bytes::BufMut,
5575    ) {
5576        #[allow(unused_imports)]
5577        use ::buffa::Enumeration as _;
5578        if self.trigger_id != 0u64 {
5579            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5580        }
5581        if self.subaccount_id != 0u64 {
5582            ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
5583        }
5584        if self.symbol_id != 0u32 {
5585            ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
5586        }
5587        {
5588            let val = self.trigger_type.to_i32();
5589            if val != 0 {
5590                ::buffa::types::put_int32_field(4u32, val, buf);
5591            }
5592        }
5593        {
5594            let val = self.event_type.to_i32();
5595            if val != 0 {
5596                ::buffa::types::put_int32_field(5u32, val, buf);
5597            }
5598        }
5599        if self.ts_ns != 0u64 {
5600            ::buffa::types::put_uint64_field(10u32, self.ts_ns, buf);
5601        }
5602        if self.child_seq != 0i32 {
5603            ::buffa::types::put_int32_field(11u32, self.child_seq, buf);
5604        }
5605        if self.child_order_id != 0u64 {
5606            ::buffa::types::put_fixed64_field(12u32, self.child_order_id, buf);
5607        }
5608        if self.fire_price_ticks != 0i64 {
5609            ::buffa::types::put_int64_field(13u32, self.fire_price_ticks, buf);
5610        }
5611        if !self.reason.is_empty() {
5612            ::buffa::types::put_string_field(20u32, &self.reason, buf);
5613        }
5614        self.__buffa_unknown_fields.write_to(buf);
5615    }
5616    fn merge_field(
5617        &mut self,
5618        tag: ::buffa::encoding::Tag,
5619        buf: &mut impl ::buffa::bytes::Buf,
5620        ctx: ::buffa::DecodeContext<'_>,
5621    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5622        #[allow(unused_imports)]
5623        use ::buffa::bytes::Buf as _;
5624        #[allow(unused_imports)]
5625        use ::buffa::Enumeration as _;
5626        match tag.field_number() {
5627            1u32 => {
5628                ::buffa::encoding::check_wire_type(
5629                    tag,
5630                    ::buffa::encoding::WireType::Fixed64,
5631                )?;
5632                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5633            }
5634            2u32 => {
5635                ::buffa::encoding::check_wire_type(
5636                    tag,
5637                    ::buffa::encoding::WireType::Fixed64,
5638                )?;
5639                self.subaccount_id = ::buffa::types::decode_fixed64(buf)?;
5640            }
5641            3u32 => {
5642                ::buffa::encoding::check_wire_type(
5643                    tag,
5644                    ::buffa::encoding::WireType::Varint,
5645                )?;
5646                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
5647            }
5648            4u32 => {
5649                ::buffa::encoding::check_wire_type(
5650                    tag,
5651                    ::buffa::encoding::WireType::Varint,
5652                )?;
5653                self.trigger_type = ::buffa::EnumValue::from(
5654                    ::buffa::types::decode_int32(buf)?,
5655                );
5656            }
5657            5u32 => {
5658                ::buffa::encoding::check_wire_type(
5659                    tag,
5660                    ::buffa::encoding::WireType::Varint,
5661                )?;
5662                self.event_type = ::buffa::EnumValue::from(
5663                    ::buffa::types::decode_int32(buf)?,
5664                );
5665            }
5666            10u32 => {
5667                ::buffa::encoding::check_wire_type(
5668                    tag,
5669                    ::buffa::encoding::WireType::Varint,
5670                )?;
5671                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
5672            }
5673            11u32 => {
5674                ::buffa::encoding::check_wire_type(
5675                    tag,
5676                    ::buffa::encoding::WireType::Varint,
5677                )?;
5678                self.child_seq = ::buffa::types::decode_int32(buf)?;
5679            }
5680            12u32 => {
5681                ::buffa::encoding::check_wire_type(
5682                    tag,
5683                    ::buffa::encoding::WireType::Fixed64,
5684                )?;
5685                self.child_order_id = ::buffa::types::decode_fixed64(buf)?;
5686            }
5687            13u32 => {
5688                ::buffa::encoding::check_wire_type(
5689                    tag,
5690                    ::buffa::encoding::WireType::Varint,
5691                )?;
5692                self.fire_price_ticks = ::buffa::types::decode_int64(buf)?;
5693            }
5694            20u32 => {
5695                ::buffa::encoding::check_wire_type(
5696                    tag,
5697                    ::buffa::encoding::WireType::LengthDelimited,
5698                )?;
5699                ::buffa::types::merge_string(&mut self.reason, buf)?;
5700            }
5701            _ => {
5702                self.__buffa_unknown_fields
5703                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5704            }
5705        }
5706        ::core::result::Result::Ok(())
5707    }
5708    fn clear(&mut self) {
5709        self.trigger_id = 0u64;
5710        self.subaccount_id = 0u64;
5711        self.symbol_id = 0u32;
5712        self.trigger_type = ::buffa::EnumValue::from(0);
5713        self.event_type = ::buffa::EnumValue::from(0);
5714        self.ts_ns = 0u64;
5715        self.child_seq = 0i32;
5716        self.child_order_id = 0u64;
5717        self.fire_price_ticks = 0i64;
5718        self.reason.clear();
5719        self.__buffa_unknown_fields.clear();
5720    }
5721}
5722impl ::buffa::ExtensionSet for TriggerEvent {
5723    const PROTO_FQN: &'static str = "triggers.v1.TriggerEvent";
5724    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5725        &self.__buffa_unknown_fields
5726    }
5727    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5728        &mut self.__buffa_unknown_fields
5729    }
5730}
5731impl ::buffa::json_helpers::ProtoElemJson for TriggerEvent {
5732    fn serialize_proto_json<S: ::serde::Serializer>(
5733        v: &Self,
5734        s: S,
5735    ) -> ::core::result::Result<S::Ok, S::Error> {
5736        ::serde::Serialize::serialize(v, s)
5737    }
5738    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5739        d: D,
5740    ) -> ::core::result::Result<Self, D::Error> {
5741        <Self as ::serde::Deserialize>::deserialize(d)
5742    }
5743}
5744#[doc(hidden)]
5745pub const __TRIGGER_EVENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5746    type_url: "type.googleapis.com/triggers.v1.TriggerEvent",
5747    to_json: ::buffa::type_registry::any_to_json::<TriggerEvent>,
5748    from_json: ::buffa::type_registry::any_from_json::<TriggerEvent>,
5749    is_wkt: false,
5750};
5751/// ListTriggerEventsResponse returns historical events ordered newest-first.
5752#[derive(Clone, PartialEq, Default)]
5753#[derive(::serde::Serialize, ::serde::Deserialize)]
5754#[serde(default)]
5755pub struct ListTriggerEventsResponse {
5756    /// Events ordered by event time descending, child sequence descending, and
5757    /// stable event tie-breakers descending.
5758    ///
5759    /// Field 1: `events`
5760    #[serde(
5761        rename = "events",
5762        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5763        deserialize_with = "::buffa::json_helpers::null_as_default"
5764    )]
5765    pub events: ::buffa::alloc::vec::Vec<TriggerEvent>,
5766    /// Opaque cursor for the next page. Empty when no more results exist.
5767    ///
5768    /// Field 3: `next_page_token`
5769    #[serde(
5770        rename = "nextPageToken",
5771        alias = "next_page_token",
5772        with = "::buffa::json_helpers::proto_string",
5773        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5774    )]
5775    pub next_page_token: ::buffa::alloc::string::String,
5776    #[serde(skip)]
5777    #[doc(hidden)]
5778    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5779}
5780impl ::core::fmt::Debug for ListTriggerEventsResponse {
5781    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5782        f.debug_struct("ListTriggerEventsResponse")
5783            .field("events", &self.events)
5784            .field("next_page_token", &self.next_page_token)
5785            .finish()
5786    }
5787}
5788impl ListTriggerEventsResponse {
5789    /// Protobuf type URL for this message, for use with `Any::pack` and
5790    /// `Any::unpack_if`.
5791    ///
5792    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5793    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
5794}
5795::buffa::impl_default_instance!(ListTriggerEventsResponse);
5796impl ::buffa::MessageName for ListTriggerEventsResponse {
5797    const PACKAGE: &'static str = "triggers.v1";
5798    const NAME: &'static str = "ListTriggerEventsResponse";
5799    const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsResponse";
5800    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
5801}
5802impl ::buffa::Message for ListTriggerEventsResponse {
5803    /// Returns the total encoded size in bytes.
5804    ///
5805    /// The result is a `u32`; the protobuf specification requires all
5806    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5807    /// compliant message will never overflow this type.
5808    #[allow(clippy::let_and_return)]
5809    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5810        #[allow(unused_imports)]
5811        use ::buffa::Enumeration as _;
5812        let mut size = 0u32;
5813        for v in &self.events {
5814            let __slot = __cache.reserve();
5815            let inner_size = v.compute_size(__cache);
5816            __cache.set(__slot, inner_size);
5817            size
5818                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5819                    + inner_size;
5820        }
5821        if !self.next_page_token.is_empty() {
5822            size
5823                += 1u32
5824                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5825        }
5826        size += self.__buffa_unknown_fields.encoded_len() as u32;
5827        size
5828    }
5829    fn write_to(
5830        &self,
5831        __cache: &mut ::buffa::SizeCache,
5832        buf: &mut impl ::buffa::bytes::BufMut,
5833    ) {
5834        #[allow(unused_imports)]
5835        use ::buffa::Enumeration as _;
5836        for v in &self.events {
5837            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
5838            v.write_to(__cache, buf);
5839        }
5840        if !self.next_page_token.is_empty() {
5841            ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
5842        }
5843        self.__buffa_unknown_fields.write_to(buf);
5844    }
5845    fn merge_field(
5846        &mut self,
5847        tag: ::buffa::encoding::Tag,
5848        buf: &mut impl ::buffa::bytes::Buf,
5849        ctx: ::buffa::DecodeContext<'_>,
5850    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5851        #[allow(unused_imports)]
5852        use ::buffa::bytes::Buf as _;
5853        #[allow(unused_imports)]
5854        use ::buffa::Enumeration as _;
5855        match tag.field_number() {
5856            1u32 => {
5857                ::buffa::encoding::check_wire_type(
5858                    tag,
5859                    ::buffa::encoding::WireType::LengthDelimited,
5860                )?;
5861                let mut elem = ::core::default::Default::default();
5862                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5863                self.events.push(elem);
5864            }
5865            3u32 => {
5866                ::buffa::encoding::check_wire_type(
5867                    tag,
5868                    ::buffa::encoding::WireType::LengthDelimited,
5869                )?;
5870                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5871            }
5872            _ => {
5873                self.__buffa_unknown_fields
5874                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5875            }
5876        }
5877        ::core::result::Result::Ok(())
5878    }
5879    fn clear(&mut self) {
5880        self.events.clear();
5881        self.next_page_token.clear();
5882        self.__buffa_unknown_fields.clear();
5883    }
5884}
5885impl ::buffa::ExtensionSet for ListTriggerEventsResponse {
5886    const PROTO_FQN: &'static str = "triggers.v1.ListTriggerEventsResponse";
5887    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5888        &self.__buffa_unknown_fields
5889    }
5890    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5891        &mut self.__buffa_unknown_fields
5892    }
5893}
5894impl ::buffa::json_helpers::ProtoElemJson for ListTriggerEventsResponse {
5895    fn serialize_proto_json<S: ::serde::Serializer>(
5896        v: &Self,
5897        s: S,
5898    ) -> ::core::result::Result<S::Ok, S::Error> {
5899        ::serde::Serialize::serialize(v, s)
5900    }
5901    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5902        d: D,
5903    ) -> ::core::result::Result<Self, D::Error> {
5904        <Self as ::serde::Deserialize>::deserialize(d)
5905    }
5906}
5907#[doc(hidden)]
5908pub const __LIST_TRIGGER_EVENTS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5909    type_url: "type.googleapis.com/triggers.v1.ListTriggerEventsResponse",
5910    to_json: ::buffa::type_registry::any_to_json::<ListTriggerEventsResponse>,
5911    from_json: ::buffa::type_registry::any_from_json::<ListTriggerEventsResponse>,
5912    is_wkt: false,
5913};
5914/// =============================================================================
5915/// Cancel Trigger
5916/// =============================================================================
5917///
5918/// CancelTriggerRequest cancels an active trigger by ID.
5919#[derive(Clone, PartialEq, Default)]
5920#[derive(::serde::Serialize, ::serde::Deserialize)]
5921#[serde(default)]
5922pub struct CancelTriggerRequest {
5923    /// Trigger ID to cancel.
5924    ///
5925    /// Field 1: `trigger_id`
5926    #[serde(
5927        rename = "triggerId",
5928        alias = "trigger_id",
5929        with = "::buffa::json_helpers::uint64",
5930        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5931    )]
5932    pub trigger_id: u64,
5933    /// Optional sub-account for authorization.
5934    ///
5935    /// Field 2: `subaccount_id`
5936    #[serde(
5937        rename = "subaccountId",
5938        alias = "subaccount_id",
5939        with = "::buffa::json_helpers::opt_uint64",
5940        skip_serializing_if = "::core::option::Option::is_none"
5941    )]
5942    pub subaccount_id: ::core::option::Option<u64>,
5943    #[serde(skip)]
5944    #[doc(hidden)]
5945    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5946}
5947impl ::core::fmt::Debug for CancelTriggerRequest {
5948    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5949        f.debug_struct("CancelTriggerRequest")
5950            .field("trigger_id", &self.trigger_id)
5951            .field("subaccount_id", &self.subaccount_id)
5952            .finish()
5953    }
5954}
5955impl CancelTriggerRequest {
5956    /// Protobuf type URL for this message, for use with `Any::pack` and
5957    /// `Any::unpack_if`.
5958    ///
5959    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5960    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
5961}
5962impl CancelTriggerRequest {
5963    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5964    #[inline]
5965    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
5966    pub fn with_subaccount_id(mut self, value: u64) -> Self {
5967        self.subaccount_id = Some(value);
5968        self
5969    }
5970}
5971::buffa::impl_default_instance!(CancelTriggerRequest);
5972impl ::buffa::MessageName for CancelTriggerRequest {
5973    const PACKAGE: &'static str = "triggers.v1";
5974    const NAME: &'static str = "CancelTriggerRequest";
5975    const FULL_NAME: &'static str = "triggers.v1.CancelTriggerRequest";
5976    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
5977}
5978impl ::buffa::Message for CancelTriggerRequest {
5979    /// Returns the total encoded size in bytes.
5980    ///
5981    /// The result is a `u32`; the protobuf specification requires all
5982    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5983    /// compliant message will never overflow this type.
5984    #[allow(clippy::let_and_return)]
5985    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5986        #[allow(unused_imports)]
5987        use ::buffa::Enumeration as _;
5988        let mut size = 0u32;
5989        if self.trigger_id != 0u64 {
5990            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5991        }
5992        if self.subaccount_id.is_some() {
5993            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5994        }
5995        size += self.__buffa_unknown_fields.encoded_len() as u32;
5996        size
5997    }
5998    fn write_to(
5999        &self,
6000        _cache: &mut ::buffa::SizeCache,
6001        buf: &mut impl ::buffa::bytes::BufMut,
6002    ) {
6003        #[allow(unused_imports)]
6004        use ::buffa::Enumeration as _;
6005        if self.trigger_id != 0u64 {
6006            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6007        }
6008        if let Some(v) = self.subaccount_id {
6009            ::buffa::types::put_fixed64_field(2u32, v, buf);
6010        }
6011        self.__buffa_unknown_fields.write_to(buf);
6012    }
6013    fn merge_field(
6014        &mut self,
6015        tag: ::buffa::encoding::Tag,
6016        buf: &mut impl ::buffa::bytes::Buf,
6017        ctx: ::buffa::DecodeContext<'_>,
6018    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6019        #[allow(unused_imports)]
6020        use ::buffa::bytes::Buf as _;
6021        #[allow(unused_imports)]
6022        use ::buffa::Enumeration as _;
6023        match tag.field_number() {
6024            1u32 => {
6025                ::buffa::encoding::check_wire_type(
6026                    tag,
6027                    ::buffa::encoding::WireType::Fixed64,
6028                )?;
6029                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6030            }
6031            2u32 => {
6032                ::buffa::encoding::check_wire_type(
6033                    tag,
6034                    ::buffa::encoding::WireType::Fixed64,
6035                )?;
6036                self.subaccount_id = ::core::option::Option::Some(
6037                    ::buffa::types::decode_fixed64(buf)?,
6038                );
6039            }
6040            _ => {
6041                self.__buffa_unknown_fields
6042                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6043            }
6044        }
6045        ::core::result::Result::Ok(())
6046    }
6047    fn clear(&mut self) {
6048        self.trigger_id = 0u64;
6049        self.subaccount_id = ::core::option::Option::None;
6050        self.__buffa_unknown_fields.clear();
6051    }
6052}
6053impl ::buffa::ExtensionSet for CancelTriggerRequest {
6054    const PROTO_FQN: &'static str = "triggers.v1.CancelTriggerRequest";
6055    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6056        &self.__buffa_unknown_fields
6057    }
6058    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6059        &mut self.__buffa_unknown_fields
6060    }
6061}
6062impl ::buffa::json_helpers::ProtoElemJson for CancelTriggerRequest {
6063    fn serialize_proto_json<S: ::serde::Serializer>(
6064        v: &Self,
6065        s: S,
6066    ) -> ::core::result::Result<S::Ok, S::Error> {
6067        ::serde::Serialize::serialize(v, s)
6068    }
6069    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6070        d: D,
6071    ) -> ::core::result::Result<Self, D::Error> {
6072        <Self as ::serde::Deserialize>::deserialize(d)
6073    }
6074}
6075#[doc(hidden)]
6076pub const __CANCEL_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6077    type_url: "type.googleapis.com/triggers.v1.CancelTriggerRequest",
6078    to_json: ::buffa::type_registry::any_to_json::<CancelTriggerRequest>,
6079    from_json: ::buffa::type_registry::any_from_json::<CancelTriggerRequest>,
6080    is_wkt: false,
6081};
6082/// CancelTriggerResponse returns the final status after cancellation.
6083#[derive(Clone, PartialEq, Default)]
6084#[derive(::serde::Serialize, ::serde::Deserialize)]
6085#[serde(default)]
6086pub struct CancelTriggerResponse {
6087    /// Trigger ID that was canceled.
6088    ///
6089    /// Field 1: `trigger_id`
6090    #[serde(
6091        rename = "triggerId",
6092        alias = "trigger_id",
6093        with = "::buffa::json_helpers::uint64",
6094        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6095    )]
6096    pub trigger_id: u64,
6097    /// Final status (should be STATUS_CANCELED).
6098    ///
6099    /// Field 2: `status`
6100    #[serde(
6101        rename = "status",
6102        with = "::buffa::json_helpers::proto_enum",
6103        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6104    )]
6105    pub status: ::buffa::EnumValue<TriggerStatus>,
6106    /// Server timestamp.
6107    ///
6108    /// Field 3: `ts`
6109    #[serde(
6110        rename = "ts",
6111        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6112    )]
6113    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
6114    /// Server timestamp in nanoseconds since epoch (UTC).
6115    ///
6116    /// Field 4: `ts_ns`
6117    #[serde(
6118        rename = "tsNs",
6119        alias = "ts_ns",
6120        with = "::buffa::json_helpers::uint64",
6121        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6122    )]
6123    pub ts_ns: u64,
6124    #[serde(skip)]
6125    #[doc(hidden)]
6126    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6127}
6128impl ::core::fmt::Debug for CancelTriggerResponse {
6129    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6130        f.debug_struct("CancelTriggerResponse")
6131            .field("trigger_id", &self.trigger_id)
6132            .field("status", &self.status)
6133            .field("ts", &self.ts)
6134            .field("ts_ns", &self.ts_ns)
6135            .finish()
6136    }
6137}
6138impl CancelTriggerResponse {
6139    /// Protobuf type URL for this message, for use with `Any::pack` and
6140    /// `Any::unpack_if`.
6141    ///
6142    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6143    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
6144}
6145::buffa::impl_default_instance!(CancelTriggerResponse);
6146impl ::buffa::MessageName for CancelTriggerResponse {
6147    const PACKAGE: &'static str = "triggers.v1";
6148    const NAME: &'static str = "CancelTriggerResponse";
6149    const FULL_NAME: &'static str = "triggers.v1.CancelTriggerResponse";
6150    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
6151}
6152impl ::buffa::Message for CancelTriggerResponse {
6153    /// Returns the total encoded size in bytes.
6154    ///
6155    /// The result is a `u32`; the protobuf specification requires all
6156    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6157    /// compliant message will never overflow this type.
6158    #[allow(clippy::let_and_return)]
6159    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6160        #[allow(unused_imports)]
6161        use ::buffa::Enumeration as _;
6162        let mut size = 0u32;
6163        if self.trigger_id != 0u64 {
6164            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6165        }
6166        {
6167            let val = self.status.to_i32();
6168            if val != 0 {
6169                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
6170            }
6171        }
6172        if self.ts.is_set() {
6173            let __slot = __cache.reserve();
6174            let inner_size = self.ts.compute_size(__cache);
6175            __cache.set(__slot, inner_size);
6176            size
6177                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6178                    + inner_size;
6179        }
6180        if self.ts_ns != 0u64 {
6181            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
6182        }
6183        size += self.__buffa_unknown_fields.encoded_len() as u32;
6184        size
6185    }
6186    fn write_to(
6187        &self,
6188        __cache: &mut ::buffa::SizeCache,
6189        buf: &mut impl ::buffa::bytes::BufMut,
6190    ) {
6191        #[allow(unused_imports)]
6192        use ::buffa::Enumeration as _;
6193        if self.trigger_id != 0u64 {
6194            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6195        }
6196        {
6197            let val = self.status.to_i32();
6198            if val != 0 {
6199                ::buffa::types::put_int32_field(2u32, val, buf);
6200            }
6201        }
6202        if self.ts.is_set() {
6203            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
6204            self.ts.write_to(__cache, buf);
6205        }
6206        if self.ts_ns != 0u64 {
6207            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
6208        }
6209        self.__buffa_unknown_fields.write_to(buf);
6210    }
6211    fn merge_field(
6212        &mut self,
6213        tag: ::buffa::encoding::Tag,
6214        buf: &mut impl ::buffa::bytes::Buf,
6215        ctx: ::buffa::DecodeContext<'_>,
6216    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6217        #[allow(unused_imports)]
6218        use ::buffa::bytes::Buf as _;
6219        #[allow(unused_imports)]
6220        use ::buffa::Enumeration as _;
6221        match tag.field_number() {
6222            1u32 => {
6223                ::buffa::encoding::check_wire_type(
6224                    tag,
6225                    ::buffa::encoding::WireType::Fixed64,
6226                )?;
6227                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6228            }
6229            2u32 => {
6230                ::buffa::encoding::check_wire_type(
6231                    tag,
6232                    ::buffa::encoding::WireType::Varint,
6233                )?;
6234                self.status = ::buffa::EnumValue::from(
6235                    ::buffa::types::decode_int32(buf)?,
6236                );
6237            }
6238            3u32 => {
6239                ::buffa::encoding::check_wire_type(
6240                    tag,
6241                    ::buffa::encoding::WireType::LengthDelimited,
6242                )?;
6243                ::buffa::Message::merge_length_delimited(
6244                    self.ts.get_or_insert_default(),
6245                    buf,
6246                    ctx,
6247                )?;
6248            }
6249            4u32 => {
6250                ::buffa::encoding::check_wire_type(
6251                    tag,
6252                    ::buffa::encoding::WireType::Varint,
6253                )?;
6254                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
6255            }
6256            _ => {
6257                self.__buffa_unknown_fields
6258                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6259            }
6260        }
6261        ::core::result::Result::Ok(())
6262    }
6263    fn clear(&mut self) {
6264        self.trigger_id = 0u64;
6265        self.status = ::buffa::EnumValue::from(0);
6266        self.ts = ::buffa::MessageField::none();
6267        self.ts_ns = 0u64;
6268        self.__buffa_unknown_fields.clear();
6269    }
6270}
6271impl ::buffa::ExtensionSet for CancelTriggerResponse {
6272    const PROTO_FQN: &'static str = "triggers.v1.CancelTriggerResponse";
6273    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6274        &self.__buffa_unknown_fields
6275    }
6276    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6277        &mut self.__buffa_unknown_fields
6278    }
6279}
6280impl ::buffa::json_helpers::ProtoElemJson for CancelTriggerResponse {
6281    fn serialize_proto_json<S: ::serde::Serializer>(
6282        v: &Self,
6283        s: S,
6284    ) -> ::core::result::Result<S::Ok, S::Error> {
6285        ::serde::Serialize::serialize(v, s)
6286    }
6287    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6288        d: D,
6289    ) -> ::core::result::Result<Self, D::Error> {
6290        <Self as ::serde::Deserialize>::deserialize(d)
6291    }
6292}
6293#[doc(hidden)]
6294pub const __CANCEL_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6295    type_url: "type.googleapis.com/triggers.v1.CancelTriggerResponse",
6296    to_json: ::buffa::type_registry::any_to_json::<CancelTriggerResponse>,
6297    from_json: ::buffa::type_registry::any_from_json::<CancelTriggerResponse>,
6298    is_wkt: false,
6299};
6300/// =============================================================================
6301/// Modify / Pause / Resume Trigger
6302/// =============================================================================
6303///
6304/// ModifyTriggerRequest applies a limited patch to an existing trigger.
6305#[derive(Clone, PartialEq, Default)]
6306#[derive(::serde::Serialize)]
6307#[serde(default)]
6308pub struct ModifyTriggerRequest {
6309    /// Trigger ID to modify.
6310    ///
6311    /// Field 1: `trigger_id`
6312    #[serde(
6313        rename = "triggerId",
6314        alias = "trigger_id",
6315        with = "::buffa::json_helpers::uint64",
6316        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6317    )]
6318    pub trigger_id: u64,
6319    /// Optional sub-account for authorization.
6320    ///
6321    /// Field 2: `subaccount_id`
6322    #[serde(
6323        rename = "subaccountId",
6324        alias = "subaccount_id",
6325        with = "::buffa::json_helpers::opt_uint64",
6326        skip_serializing_if = "::core::option::Option::is_none"
6327    )]
6328    pub subaccount_id: ::core::option::Option<u64>,
6329    /// Patch fields for safe price, trailing-distance, and slippage edits.
6330    /// For stop/take-profit:
6331    /// Updated trigger price in quote units scaled by 1e6.
6332    ///
6333    /// Field 10: `trigger_price_ticks`
6334    #[serde(
6335        rename = "triggerPriceTicks",
6336        alias = "trigger_price_ticks",
6337        with = "::buffa::json_helpers::opt_int64",
6338        skip_serializing_if = "::core::option::Option::is_none"
6339    )]
6340    pub trigger_price_ticks: ::core::option::Option<i64>,
6341    /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
6342    ///
6343    /// Field 11: `limit_price_ticks`
6344    #[serde(
6345        rename = "limitPriceTicks",
6346        alias = "limit_price_ticks",
6347        with = "::buffa::json_helpers::opt_int64",
6348        skip_serializing_if = "::core::option::Option::is_none"
6349    )]
6350    pub limit_price_ticks: ::core::option::Option<i64>,
6351    /// Updated activation price in quote units scaled by 1e6.
6352    ///
6353    /// Field 14: `activation_price_ticks`
6354    #[serde(
6355        rename = "activationPriceTicks",
6356        alias = "activation_price_ticks",
6357        with = "::buffa::json_helpers::opt_int64",
6358        skip_serializing_if = "::core::option::Option::is_none"
6359    )]
6360    pub activation_price_ticks: ::core::option::Option<i64>,
6361    #[serde(flatten)]
6362    pub trailing_distance: ::core::option::Option<
6363        __buffa::oneof::modify_trigger_request::TrailingDistance,
6364    >,
6365    #[serde(flatten)]
6366    pub max_slippage: ::core::option::Option<
6367        __buffa::oneof::modify_trigger_request::MaxSlippage,
6368    >,
6369    #[serde(skip)]
6370    #[doc(hidden)]
6371    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6372}
6373impl ::core::fmt::Debug for ModifyTriggerRequest {
6374    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6375        f.debug_struct("ModifyTriggerRequest")
6376            .field("trigger_id", &self.trigger_id)
6377            .field("subaccount_id", &self.subaccount_id)
6378            .field("trigger_price_ticks", &self.trigger_price_ticks)
6379            .field("limit_price_ticks", &self.limit_price_ticks)
6380            .field("activation_price_ticks", &self.activation_price_ticks)
6381            .field("trailing_distance", &self.trailing_distance)
6382            .field("max_slippage", &self.max_slippage)
6383            .finish()
6384    }
6385}
6386impl ModifyTriggerRequest {
6387    /// Protobuf type URL for this message, for use with `Any::pack` and
6388    /// `Any::unpack_if`.
6389    ///
6390    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6391    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
6392}
6393impl ModifyTriggerRequest {
6394    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6395    #[inline]
6396    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
6397    pub fn with_subaccount_id(mut self, value: u64) -> Self {
6398        self.subaccount_id = Some(value);
6399        self
6400    }
6401    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6402    #[inline]
6403    ///Sets [`Self::trigger_price_ticks`] to `Some(value)`, consuming and returning `self`.
6404    pub fn with_trigger_price_ticks(mut self, value: i64) -> Self {
6405        self.trigger_price_ticks = Some(value);
6406        self
6407    }
6408    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6409    #[inline]
6410    ///Sets [`Self::limit_price_ticks`] to `Some(value)`, consuming and returning `self`.
6411    pub fn with_limit_price_ticks(mut self, value: i64) -> Self {
6412        self.limit_price_ticks = Some(value);
6413        self
6414    }
6415    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6416    #[inline]
6417    ///Sets [`Self::activation_price_ticks`] to `Some(value)`, consuming and returning `self`.
6418    pub fn with_activation_price_ticks(mut self, value: i64) -> Self {
6419        self.activation_price_ticks = Some(value);
6420        self
6421    }
6422}
6423::buffa::impl_default_instance!(ModifyTriggerRequest);
6424impl ::buffa::MessageName for ModifyTriggerRequest {
6425    const PACKAGE: &'static str = "triggers.v1";
6426    const NAME: &'static str = "ModifyTriggerRequest";
6427    const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerRequest";
6428    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
6429}
6430impl ::buffa::Message for ModifyTriggerRequest {
6431    /// Returns the total encoded size in bytes.
6432    ///
6433    /// The result is a `u32`; the protobuf specification requires all
6434    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6435    /// compliant message will never overflow this type.
6436    #[allow(clippy::let_and_return)]
6437    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6438        #[allow(unused_imports)]
6439        use ::buffa::Enumeration as _;
6440        let mut size = 0u32;
6441        if self.trigger_id != 0u64 {
6442            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6443        }
6444        if self.subaccount_id.is_some() {
6445            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6446        }
6447        if let Some(v) = self.trigger_price_ticks {
6448            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6449        }
6450        if let Some(v) = self.limit_price_ticks {
6451            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6452        }
6453        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
6454            match v {
6455                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6456                    v,
6457                ) => {
6458                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
6459                }
6460                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6461                    v,
6462                ) => {
6463                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6464                }
6465            }
6466        }
6467        if let Some(v) = self.activation_price_ticks {
6468            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6469        }
6470        if let ::core::option::Option::Some(ref v) = self.max_slippage {
6471            match v {
6472                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6473                    v,
6474                ) => {
6475                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6476                }
6477                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6478                    v,
6479                ) => {
6480                    size += 2u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6481                }
6482            }
6483        }
6484        size += self.__buffa_unknown_fields.encoded_len() as u32;
6485        size
6486    }
6487    fn write_to(
6488        &self,
6489        _cache: &mut ::buffa::SizeCache,
6490        buf: &mut impl ::buffa::bytes::BufMut,
6491    ) {
6492        #[allow(unused_imports)]
6493        use ::buffa::Enumeration as _;
6494        if self.trigger_id != 0u64 {
6495            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6496        }
6497        if let Some(v) = self.subaccount_id {
6498            ::buffa::types::put_fixed64_field(2u32, v, buf);
6499        }
6500        if let Some(v) = self.trigger_price_ticks {
6501            ::buffa::types::put_int64_field(10u32, v, buf);
6502        }
6503        if let Some(v) = self.limit_price_ticks {
6504            ::buffa::types::put_int64_field(11u32, v, buf);
6505        }
6506        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
6507            match v {
6508                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6509                    x,
6510                ) => {
6511                    ::buffa::types::put_int64_field(12u32, *x, buf);
6512                }
6513                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6514                    x,
6515                ) => {
6516                    ::buffa::types::put_int32_field(13u32, *x, buf);
6517                }
6518            }
6519        }
6520        if let Some(v) = self.activation_price_ticks {
6521            ::buffa::types::put_int64_field(14u32, v, buf);
6522        }
6523        if let ::core::option::Option::Some(ref v) = self.max_slippage {
6524            match v {
6525                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6526                    x,
6527                ) => {
6528                    ::buffa::types::put_int32_field(15u32, *x, buf);
6529                }
6530                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6531                    x,
6532                ) => {
6533                    ::buffa::types::put_int32_field(16u32, *x, buf);
6534                }
6535            }
6536        }
6537        self.__buffa_unknown_fields.write_to(buf);
6538    }
6539    fn merge_field(
6540        &mut self,
6541        tag: ::buffa::encoding::Tag,
6542        buf: &mut impl ::buffa::bytes::Buf,
6543        ctx: ::buffa::DecodeContext<'_>,
6544    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6545        #[allow(unused_imports)]
6546        use ::buffa::bytes::Buf as _;
6547        #[allow(unused_imports)]
6548        use ::buffa::Enumeration as _;
6549        match tag.field_number() {
6550            1u32 => {
6551                ::buffa::encoding::check_wire_type(
6552                    tag,
6553                    ::buffa::encoding::WireType::Fixed64,
6554                )?;
6555                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6556            }
6557            2u32 => {
6558                ::buffa::encoding::check_wire_type(
6559                    tag,
6560                    ::buffa::encoding::WireType::Fixed64,
6561                )?;
6562                self.subaccount_id = ::core::option::Option::Some(
6563                    ::buffa::types::decode_fixed64(buf)?,
6564                );
6565            }
6566            10u32 => {
6567                ::buffa::encoding::check_wire_type(
6568                    tag,
6569                    ::buffa::encoding::WireType::Varint,
6570                )?;
6571                self.trigger_price_ticks = ::core::option::Option::Some(
6572                    ::buffa::types::decode_int64(buf)?,
6573                );
6574            }
6575            11u32 => {
6576                ::buffa::encoding::check_wire_type(
6577                    tag,
6578                    ::buffa::encoding::WireType::Varint,
6579                )?;
6580                self.limit_price_ticks = ::core::option::Option::Some(
6581                    ::buffa::types::decode_int64(buf)?,
6582                );
6583            }
6584            12u32 => {
6585                ::buffa::encoding::check_wire_type(
6586                    tag,
6587                    ::buffa::encoding::WireType::Varint,
6588                )?;
6589                self.trailing_distance = ::core::option::Option::Some(
6590                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6591                        ::buffa::types::decode_int64(buf)?,
6592                    ),
6593                );
6594            }
6595            13u32 => {
6596                ::buffa::encoding::check_wire_type(
6597                    tag,
6598                    ::buffa::encoding::WireType::Varint,
6599                )?;
6600                self.trailing_distance = ::core::option::Option::Some(
6601                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6602                        ::buffa::types::decode_int32(buf)?,
6603                    ),
6604                );
6605            }
6606            14u32 => {
6607                ::buffa::encoding::check_wire_type(
6608                    tag,
6609                    ::buffa::encoding::WireType::Varint,
6610                )?;
6611                self.activation_price_ticks = ::core::option::Option::Some(
6612                    ::buffa::types::decode_int64(buf)?,
6613                );
6614            }
6615            15u32 => {
6616                ::buffa::encoding::check_wire_type(
6617                    tag,
6618                    ::buffa::encoding::WireType::Varint,
6619                )?;
6620                self.max_slippage = ::core::option::Option::Some(
6621                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6622                        ::buffa::types::decode_int32(buf)?,
6623                    ),
6624                );
6625            }
6626            16u32 => {
6627                ::buffa::encoding::check_wire_type(
6628                    tag,
6629                    ::buffa::encoding::WireType::Varint,
6630                )?;
6631                self.max_slippage = ::core::option::Option::Some(
6632                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6633                        ::buffa::types::decode_int32(buf)?,
6634                    ),
6635                );
6636            }
6637            _ => {
6638                self.__buffa_unknown_fields
6639                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6640            }
6641        }
6642        ::core::result::Result::Ok(())
6643    }
6644    fn clear(&mut self) {
6645        self.trigger_id = 0u64;
6646        self.subaccount_id = ::core::option::Option::None;
6647        self.trigger_price_ticks = ::core::option::Option::None;
6648        self.limit_price_ticks = ::core::option::Option::None;
6649        self.trailing_distance = ::core::option::Option::None;
6650        self.activation_price_ticks = ::core::option::Option::None;
6651        self.max_slippage = ::core::option::Option::None;
6652        self.__buffa_unknown_fields.clear();
6653    }
6654}
6655impl ::buffa::ExtensionSet for ModifyTriggerRequest {
6656    const PROTO_FQN: &'static str = "triggers.v1.ModifyTriggerRequest";
6657    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6658        &self.__buffa_unknown_fields
6659    }
6660    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6661        &mut self.__buffa_unknown_fields
6662    }
6663}
6664impl<'de> serde::Deserialize<'de> for ModifyTriggerRequest {
6665    fn deserialize<D: serde::Deserializer<'de>>(
6666        d: D,
6667    ) -> ::core::result::Result<Self, D::Error> {
6668        struct _V;
6669        impl<'de> serde::de::Visitor<'de> for _V {
6670            type Value = ModifyTriggerRequest;
6671            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
6672                f.write_str("struct ModifyTriggerRequest")
6673            }
6674            #[allow(clippy::field_reassign_with_default)]
6675            fn visit_map<A: serde::de::MapAccess<'de>>(
6676                self,
6677                mut map: A,
6678            ) -> ::core::result::Result<ModifyTriggerRequest, A::Error> {
6679                let mut __f_trigger_id: ::core::option::Option<u64> = None;
6680                let mut __f_subaccount_id: ::core::option::Option<
6681                    ::core::option::Option<u64>,
6682                > = None;
6683                let mut __f_trigger_price_ticks: ::core::option::Option<
6684                    ::core::option::Option<i64>,
6685                > = None;
6686                let mut __f_limit_price_ticks: ::core::option::Option<
6687                    ::core::option::Option<i64>,
6688                > = None;
6689                let mut __f_activation_price_ticks: ::core::option::Option<
6690                    ::core::option::Option<i64>,
6691                > = None;
6692                let mut __oneof_trailing_distance: ::core::option::Option<
6693                    __buffa::oneof::modify_trigger_request::TrailingDistance,
6694                > = None;
6695                let mut __oneof_max_slippage: ::core::option::Option<
6696                    __buffa::oneof::modify_trigger_request::MaxSlippage,
6697                > = None;
6698                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
6699                    match key.as_str() {
6700                        "triggerId" | "trigger_id" => {
6701                            __f_trigger_id = Some({
6702                                struct _S;
6703                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6704                                    type Value = u64;
6705                                    fn deserialize<D: serde::Deserializer<'de>>(
6706                                        self,
6707                                        d: D,
6708                                    ) -> ::core::result::Result<u64, D::Error> {
6709                                        ::buffa::json_helpers::uint64::deserialize(d)
6710                                    }
6711                                }
6712                                map.next_value_seed(_S)?
6713                            });
6714                        }
6715                        "subaccountId" | "subaccount_id" => {
6716                            __f_subaccount_id = Some({
6717                                struct _S;
6718                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6719                                    type Value = ::core::option::Option<u64>;
6720                                    fn deserialize<D: serde::Deserializer<'de>>(
6721                                        self,
6722                                        d: D,
6723                                    ) -> ::core::result::Result<
6724                                        ::core::option::Option<u64>,
6725                                        D::Error,
6726                                    > {
6727                                        ::buffa::json_helpers::opt_uint64::deserialize(d)
6728                                    }
6729                                }
6730                                map.next_value_seed(_S)?
6731                            });
6732                        }
6733                        "triggerPriceTicks" | "trigger_price_ticks" => {
6734                            __f_trigger_price_ticks = Some({
6735                                struct _S;
6736                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6737                                    type Value = ::core::option::Option<i64>;
6738                                    fn deserialize<D: serde::Deserializer<'de>>(
6739                                        self,
6740                                        d: D,
6741                                    ) -> ::core::result::Result<
6742                                        ::core::option::Option<i64>,
6743                                        D::Error,
6744                                    > {
6745                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6746                                    }
6747                                }
6748                                map.next_value_seed(_S)?
6749                            });
6750                        }
6751                        "limitPriceTicks" | "limit_price_ticks" => {
6752                            __f_limit_price_ticks = Some({
6753                                struct _S;
6754                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6755                                    type Value = ::core::option::Option<i64>;
6756                                    fn deserialize<D: serde::Deserializer<'de>>(
6757                                        self,
6758                                        d: D,
6759                                    ) -> ::core::result::Result<
6760                                        ::core::option::Option<i64>,
6761                                        D::Error,
6762                                    > {
6763                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6764                                    }
6765                                }
6766                                map.next_value_seed(_S)?
6767                            });
6768                        }
6769                        "activationPriceTicks" | "activation_price_ticks" => {
6770                            __f_activation_price_ticks = Some({
6771                                struct _S;
6772                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6773                                    type Value = ::core::option::Option<i64>;
6774                                    fn deserialize<D: serde::Deserializer<'de>>(
6775                                        self,
6776                                        d: D,
6777                                    ) -> ::core::result::Result<
6778                                        ::core::option::Option<i64>,
6779                                        D::Error,
6780                                    > {
6781                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6782                                    }
6783                                }
6784                                map.next_value_seed(_S)?
6785                            });
6786                        }
6787                        "trailingDistanceTicks" | "trailing_distance_ticks" => {
6788                            struct _DeserSeed;
6789                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6790                                type Value = i64;
6791                                fn deserialize<D: serde::Deserializer<'de>>(
6792                                    self,
6793                                    d: D,
6794                                ) -> ::core::result::Result<i64, D::Error> {
6795                                    ::buffa::json_helpers::int64::deserialize(d)
6796                                }
6797                            }
6798                            let v: ::core::option::Option<i64> = map
6799                                .next_value_seed(
6800                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6801                                )?;
6802                            if let Some(v) = v {
6803                                if __oneof_trailing_distance.is_some() {
6804                                    return Err(
6805                                        serde::de::Error::custom(
6806                                            "multiple oneof fields set for 'trailing_distance'",
6807                                        ),
6808                                    );
6809                                }
6810                                __oneof_trailing_distance = Some(
6811                                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6812                                        v,
6813                                    ),
6814                                );
6815                            }
6816                        }
6817                        "trailingDistanceBps" | "trailing_distance_bps" => {
6818                            struct _DeserSeed;
6819                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6820                                type Value = i32;
6821                                fn deserialize<D: serde::Deserializer<'de>>(
6822                                    self,
6823                                    d: D,
6824                                ) -> ::core::result::Result<i32, D::Error> {
6825                                    ::buffa::json_helpers::int32::deserialize(d)
6826                                }
6827                            }
6828                            let v: ::core::option::Option<i32> = map
6829                                .next_value_seed(
6830                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6831                                )?;
6832                            if let Some(v) = v {
6833                                if __oneof_trailing_distance.is_some() {
6834                                    return Err(
6835                                        serde::de::Error::custom(
6836                                            "multiple oneof fields set for 'trailing_distance'",
6837                                        ),
6838                                    );
6839                                }
6840                                __oneof_trailing_distance = Some(
6841                                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6842                                        v,
6843                                    ),
6844                                );
6845                            }
6846                        }
6847                        "maxSlippageTicks" | "max_slippage_ticks" => {
6848                            struct _DeserSeed;
6849                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6850                                type Value = i32;
6851                                fn deserialize<D: serde::Deserializer<'de>>(
6852                                    self,
6853                                    d: D,
6854                                ) -> ::core::result::Result<i32, D::Error> {
6855                                    ::buffa::json_helpers::int32::deserialize(d)
6856                                }
6857                            }
6858                            let v: ::core::option::Option<i32> = map
6859                                .next_value_seed(
6860                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6861                                )?;
6862                            if let Some(v) = v {
6863                                if __oneof_max_slippage.is_some() {
6864                                    return Err(
6865                                        serde::de::Error::custom(
6866                                            "multiple oneof fields set for 'max_slippage'",
6867                                        ),
6868                                    );
6869                                }
6870                                __oneof_max_slippage = Some(
6871                                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6872                                        v,
6873                                    ),
6874                                );
6875                            }
6876                        }
6877                        "maxSlippageBps" | "max_slippage_bps" => {
6878                            struct _DeserSeed;
6879                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6880                                type Value = i32;
6881                                fn deserialize<D: serde::Deserializer<'de>>(
6882                                    self,
6883                                    d: D,
6884                                ) -> ::core::result::Result<i32, D::Error> {
6885                                    ::buffa::json_helpers::int32::deserialize(d)
6886                                }
6887                            }
6888                            let v: ::core::option::Option<i32> = map
6889                                .next_value_seed(
6890                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6891                                )?;
6892                            if let Some(v) = v {
6893                                if __oneof_max_slippage.is_some() {
6894                                    return Err(
6895                                        serde::de::Error::custom(
6896                                            "multiple oneof fields set for 'max_slippage'",
6897                                        ),
6898                                    );
6899                                }
6900                                __oneof_max_slippage = Some(
6901                                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6902                                        v,
6903                                    ),
6904                                );
6905                            }
6906                        }
6907                        _ => {
6908                            map.next_value::<serde::de::IgnoredAny>()?;
6909                        }
6910                    }
6911                }
6912                let mut __r = <ModifyTriggerRequest as ::core::default::Default>::default();
6913                if let ::core::option::Option::Some(v) = __f_trigger_id {
6914                    __r.trigger_id = v;
6915                }
6916                if let ::core::option::Option::Some(v) = __f_subaccount_id {
6917                    __r.subaccount_id = v;
6918                }
6919                if let ::core::option::Option::Some(v) = __f_trigger_price_ticks {
6920                    __r.trigger_price_ticks = v;
6921                }
6922                if let ::core::option::Option::Some(v) = __f_limit_price_ticks {
6923                    __r.limit_price_ticks = v;
6924                }
6925                if let ::core::option::Option::Some(v) = __f_activation_price_ticks {
6926                    __r.activation_price_ticks = v;
6927                }
6928                __r.trailing_distance = __oneof_trailing_distance;
6929                __r.max_slippage = __oneof_max_slippage;
6930                Ok(__r)
6931            }
6932        }
6933        d.deserialize_map(_V)
6934    }
6935}
6936impl ::buffa::json_helpers::ProtoElemJson for ModifyTriggerRequest {
6937    fn serialize_proto_json<S: ::serde::Serializer>(
6938        v: &Self,
6939        s: S,
6940    ) -> ::core::result::Result<S::Ok, S::Error> {
6941        ::serde::Serialize::serialize(v, s)
6942    }
6943    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6944        d: D,
6945    ) -> ::core::result::Result<Self, D::Error> {
6946        <Self as ::serde::Deserialize>::deserialize(d)
6947    }
6948}
6949#[doc(hidden)]
6950pub const __MODIFY_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6951    type_url: "type.googleapis.com/triggers.v1.ModifyTriggerRequest",
6952    to_json: ::buffa::type_registry::any_to_json::<ModifyTriggerRequest>,
6953    from_json: ::buffa::type_registry::any_from_json::<ModifyTriggerRequest>,
6954    is_wkt: false,
6955};
6956pub mod modify_trigger_request {
6957    #[allow(unused_imports)]
6958    use super::*;
6959    #[doc(inline)]
6960    pub use super::__buffa::oneof::modify_trigger_request::TrailingDistance;
6961    #[doc(inline)]
6962    pub use super::__buffa::oneof::modify_trigger_request::MaxSlippage;
6963    #[doc(inline)]
6964    pub use super::__buffa::view::oneof::modify_trigger_request::TrailingDistance as TrailingDistanceView;
6965    #[doc(inline)]
6966    pub use super::__buffa::view::oneof::modify_trigger_request::MaxSlippage as MaxSlippageView;
6967}
6968/// ModifyTriggerResponse returns the trigger status after modification.
6969#[derive(Clone, PartialEq, Default)]
6970#[derive(::serde::Serialize, ::serde::Deserialize)]
6971#[serde(default)]
6972pub struct ModifyTriggerResponse {
6973    /// Modified trigger ID.
6974    ///
6975    /// Field 1: `trigger_id`
6976    #[serde(
6977        rename = "triggerId",
6978        alias = "trigger_id",
6979        with = "::buffa::json_helpers::uint64",
6980        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6981    )]
6982    pub trigger_id: u64,
6983    /// Current trigger status after modification.
6984    ///
6985    /// Field 2: `status`
6986    #[serde(
6987        rename = "status",
6988        with = "::buffa::json_helpers::proto_enum",
6989        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6990    )]
6991    pub status: ::buffa::EnumValue<TriggerStatus>,
6992    /// Server timestamp.
6993    ///
6994    /// Field 3: `ts`
6995    #[serde(
6996        rename = "ts",
6997        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6998    )]
6999    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7000    /// Server timestamp in nanoseconds since epoch (UTC).
7001    ///
7002    /// Field 4: `ts_ns`
7003    #[serde(
7004        rename = "tsNs",
7005        alias = "ts_ns",
7006        with = "::buffa::json_helpers::uint64",
7007        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7008    )]
7009    pub ts_ns: u64,
7010    #[serde(skip)]
7011    #[doc(hidden)]
7012    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7013}
7014impl ::core::fmt::Debug for ModifyTriggerResponse {
7015    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7016        f.debug_struct("ModifyTriggerResponse")
7017            .field("trigger_id", &self.trigger_id)
7018            .field("status", &self.status)
7019            .field("ts", &self.ts)
7020            .field("ts_ns", &self.ts_ns)
7021            .finish()
7022    }
7023}
7024impl ModifyTriggerResponse {
7025    /// Protobuf type URL for this message, for use with `Any::pack` and
7026    /// `Any::unpack_if`.
7027    ///
7028    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7029    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
7030}
7031::buffa::impl_default_instance!(ModifyTriggerResponse);
7032impl ::buffa::MessageName for ModifyTriggerResponse {
7033    const PACKAGE: &'static str = "triggers.v1";
7034    const NAME: &'static str = "ModifyTriggerResponse";
7035    const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerResponse";
7036    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
7037}
7038impl ::buffa::Message for ModifyTriggerResponse {
7039    /// Returns the total encoded size in bytes.
7040    ///
7041    /// The result is a `u32`; the protobuf specification requires all
7042    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7043    /// compliant message will never overflow this type.
7044    #[allow(clippy::let_and_return)]
7045    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7046        #[allow(unused_imports)]
7047        use ::buffa::Enumeration as _;
7048        let mut size = 0u32;
7049        if self.trigger_id != 0u64 {
7050            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7051        }
7052        {
7053            let val = self.status.to_i32();
7054            if val != 0 {
7055                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7056            }
7057        }
7058        if self.ts.is_set() {
7059            let __slot = __cache.reserve();
7060            let inner_size = self.ts.compute_size(__cache);
7061            __cache.set(__slot, inner_size);
7062            size
7063                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7064                    + inner_size;
7065        }
7066        if self.ts_ns != 0u64 {
7067            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7068        }
7069        size += self.__buffa_unknown_fields.encoded_len() as u32;
7070        size
7071    }
7072    fn write_to(
7073        &self,
7074        __cache: &mut ::buffa::SizeCache,
7075        buf: &mut impl ::buffa::bytes::BufMut,
7076    ) {
7077        #[allow(unused_imports)]
7078        use ::buffa::Enumeration as _;
7079        if self.trigger_id != 0u64 {
7080            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7081        }
7082        {
7083            let val = self.status.to_i32();
7084            if val != 0 {
7085                ::buffa::types::put_int32_field(2u32, val, buf);
7086            }
7087        }
7088        if self.ts.is_set() {
7089            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7090            self.ts.write_to(__cache, buf);
7091        }
7092        if self.ts_ns != 0u64 {
7093            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7094        }
7095        self.__buffa_unknown_fields.write_to(buf);
7096    }
7097    fn merge_field(
7098        &mut self,
7099        tag: ::buffa::encoding::Tag,
7100        buf: &mut impl ::buffa::bytes::Buf,
7101        ctx: ::buffa::DecodeContext<'_>,
7102    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7103        #[allow(unused_imports)]
7104        use ::buffa::bytes::Buf as _;
7105        #[allow(unused_imports)]
7106        use ::buffa::Enumeration as _;
7107        match tag.field_number() {
7108            1u32 => {
7109                ::buffa::encoding::check_wire_type(
7110                    tag,
7111                    ::buffa::encoding::WireType::Fixed64,
7112                )?;
7113                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7114            }
7115            2u32 => {
7116                ::buffa::encoding::check_wire_type(
7117                    tag,
7118                    ::buffa::encoding::WireType::Varint,
7119                )?;
7120                self.status = ::buffa::EnumValue::from(
7121                    ::buffa::types::decode_int32(buf)?,
7122                );
7123            }
7124            3u32 => {
7125                ::buffa::encoding::check_wire_type(
7126                    tag,
7127                    ::buffa::encoding::WireType::LengthDelimited,
7128                )?;
7129                ::buffa::Message::merge_length_delimited(
7130                    self.ts.get_or_insert_default(),
7131                    buf,
7132                    ctx,
7133                )?;
7134            }
7135            4u32 => {
7136                ::buffa::encoding::check_wire_type(
7137                    tag,
7138                    ::buffa::encoding::WireType::Varint,
7139                )?;
7140                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7141            }
7142            _ => {
7143                self.__buffa_unknown_fields
7144                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7145            }
7146        }
7147        ::core::result::Result::Ok(())
7148    }
7149    fn clear(&mut self) {
7150        self.trigger_id = 0u64;
7151        self.status = ::buffa::EnumValue::from(0);
7152        self.ts = ::buffa::MessageField::none();
7153        self.ts_ns = 0u64;
7154        self.__buffa_unknown_fields.clear();
7155    }
7156}
7157impl ::buffa::ExtensionSet for ModifyTriggerResponse {
7158    const PROTO_FQN: &'static str = "triggers.v1.ModifyTriggerResponse";
7159    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7160        &self.__buffa_unknown_fields
7161    }
7162    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7163        &mut self.__buffa_unknown_fields
7164    }
7165}
7166impl ::buffa::json_helpers::ProtoElemJson for ModifyTriggerResponse {
7167    fn serialize_proto_json<S: ::serde::Serializer>(
7168        v: &Self,
7169        s: S,
7170    ) -> ::core::result::Result<S::Ok, S::Error> {
7171        ::serde::Serialize::serialize(v, s)
7172    }
7173    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7174        d: D,
7175    ) -> ::core::result::Result<Self, D::Error> {
7176        <Self as ::serde::Deserialize>::deserialize(d)
7177    }
7178}
7179#[doc(hidden)]
7180pub const __MODIFY_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7181    type_url: "type.googleapis.com/triggers.v1.ModifyTriggerResponse",
7182    to_json: ::buffa::type_registry::any_to_json::<ModifyTriggerResponse>,
7183    from_json: ::buffa::type_registry::any_from_json::<ModifyTriggerResponse>,
7184    is_wkt: false,
7185};
7186/// PauseTriggerRequest pauses an active trigger by ID.
7187#[derive(Clone, PartialEq, Default)]
7188#[derive(::serde::Serialize, ::serde::Deserialize)]
7189#[serde(default)]
7190pub struct PauseTriggerRequest {
7191    /// Trigger ID to pause.
7192    ///
7193    /// Field 1: `trigger_id`
7194    #[serde(
7195        rename = "triggerId",
7196        alias = "trigger_id",
7197        with = "::buffa::json_helpers::uint64",
7198        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7199    )]
7200    pub trigger_id: u64,
7201    /// Optional sub-account for authorization.
7202    ///
7203    /// Field 2: `subaccount_id`
7204    #[serde(
7205        rename = "subaccountId",
7206        alias = "subaccount_id",
7207        with = "::buffa::json_helpers::opt_uint64",
7208        skip_serializing_if = "::core::option::Option::is_none"
7209    )]
7210    pub subaccount_id: ::core::option::Option<u64>,
7211    #[serde(skip)]
7212    #[doc(hidden)]
7213    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7214}
7215impl ::core::fmt::Debug for PauseTriggerRequest {
7216    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7217        f.debug_struct("PauseTriggerRequest")
7218            .field("trigger_id", &self.trigger_id)
7219            .field("subaccount_id", &self.subaccount_id)
7220            .finish()
7221    }
7222}
7223impl PauseTriggerRequest {
7224    /// Protobuf type URL for this message, for use with `Any::pack` and
7225    /// `Any::unpack_if`.
7226    ///
7227    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7228    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
7229}
7230impl PauseTriggerRequest {
7231    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7232    #[inline]
7233    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
7234    pub fn with_subaccount_id(mut self, value: u64) -> Self {
7235        self.subaccount_id = Some(value);
7236        self
7237    }
7238}
7239::buffa::impl_default_instance!(PauseTriggerRequest);
7240impl ::buffa::MessageName for PauseTriggerRequest {
7241    const PACKAGE: &'static str = "triggers.v1";
7242    const NAME: &'static str = "PauseTriggerRequest";
7243    const FULL_NAME: &'static str = "triggers.v1.PauseTriggerRequest";
7244    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
7245}
7246impl ::buffa::Message for PauseTriggerRequest {
7247    /// Returns the total encoded size in bytes.
7248    ///
7249    /// The result is a `u32`; the protobuf specification requires all
7250    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7251    /// compliant message will never overflow this type.
7252    #[allow(clippy::let_and_return)]
7253    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7254        #[allow(unused_imports)]
7255        use ::buffa::Enumeration as _;
7256        let mut size = 0u32;
7257        if self.trigger_id != 0u64 {
7258            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7259        }
7260        if self.subaccount_id.is_some() {
7261            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7262        }
7263        size += self.__buffa_unknown_fields.encoded_len() as u32;
7264        size
7265    }
7266    fn write_to(
7267        &self,
7268        _cache: &mut ::buffa::SizeCache,
7269        buf: &mut impl ::buffa::bytes::BufMut,
7270    ) {
7271        #[allow(unused_imports)]
7272        use ::buffa::Enumeration as _;
7273        if self.trigger_id != 0u64 {
7274            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7275        }
7276        if let Some(v) = self.subaccount_id {
7277            ::buffa::types::put_fixed64_field(2u32, v, buf);
7278        }
7279        self.__buffa_unknown_fields.write_to(buf);
7280    }
7281    fn merge_field(
7282        &mut self,
7283        tag: ::buffa::encoding::Tag,
7284        buf: &mut impl ::buffa::bytes::Buf,
7285        ctx: ::buffa::DecodeContext<'_>,
7286    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7287        #[allow(unused_imports)]
7288        use ::buffa::bytes::Buf as _;
7289        #[allow(unused_imports)]
7290        use ::buffa::Enumeration as _;
7291        match tag.field_number() {
7292            1u32 => {
7293                ::buffa::encoding::check_wire_type(
7294                    tag,
7295                    ::buffa::encoding::WireType::Fixed64,
7296                )?;
7297                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7298            }
7299            2u32 => {
7300                ::buffa::encoding::check_wire_type(
7301                    tag,
7302                    ::buffa::encoding::WireType::Fixed64,
7303                )?;
7304                self.subaccount_id = ::core::option::Option::Some(
7305                    ::buffa::types::decode_fixed64(buf)?,
7306                );
7307            }
7308            _ => {
7309                self.__buffa_unknown_fields
7310                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7311            }
7312        }
7313        ::core::result::Result::Ok(())
7314    }
7315    fn clear(&mut self) {
7316        self.trigger_id = 0u64;
7317        self.subaccount_id = ::core::option::Option::None;
7318        self.__buffa_unknown_fields.clear();
7319    }
7320}
7321impl ::buffa::ExtensionSet for PauseTriggerRequest {
7322    const PROTO_FQN: &'static str = "triggers.v1.PauseTriggerRequest";
7323    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7324        &self.__buffa_unknown_fields
7325    }
7326    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7327        &mut self.__buffa_unknown_fields
7328    }
7329}
7330impl ::buffa::json_helpers::ProtoElemJson for PauseTriggerRequest {
7331    fn serialize_proto_json<S: ::serde::Serializer>(
7332        v: &Self,
7333        s: S,
7334    ) -> ::core::result::Result<S::Ok, S::Error> {
7335        ::serde::Serialize::serialize(v, s)
7336    }
7337    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7338        d: D,
7339    ) -> ::core::result::Result<Self, D::Error> {
7340        <Self as ::serde::Deserialize>::deserialize(d)
7341    }
7342}
7343#[doc(hidden)]
7344pub const __PAUSE_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7345    type_url: "type.googleapis.com/triggers.v1.PauseTriggerRequest",
7346    to_json: ::buffa::type_registry::any_to_json::<PauseTriggerRequest>,
7347    from_json: ::buffa::type_registry::any_from_json::<PauseTriggerRequest>,
7348    is_wkt: false,
7349};
7350/// PauseTriggerResponse returns the trigger status after pausing.
7351#[derive(Clone, PartialEq, Default)]
7352#[derive(::serde::Serialize, ::serde::Deserialize)]
7353#[serde(default)]
7354pub struct PauseTriggerResponse {
7355    /// Paused trigger ID.
7356    ///
7357    /// Field 1: `trigger_id`
7358    #[serde(
7359        rename = "triggerId",
7360        alias = "trigger_id",
7361        with = "::buffa::json_helpers::uint64",
7362        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7363    )]
7364    pub trigger_id: u64,
7365    /// Current trigger status after pausing.
7366    ///
7367    /// Field 2: `status`
7368    #[serde(
7369        rename = "status",
7370        with = "::buffa::json_helpers::proto_enum",
7371        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7372    )]
7373    pub status: ::buffa::EnumValue<TriggerStatus>,
7374    /// Server timestamp.
7375    ///
7376    /// Field 3: `ts`
7377    #[serde(
7378        rename = "ts",
7379        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7380    )]
7381    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7382    /// Server timestamp in nanoseconds since epoch (UTC).
7383    ///
7384    /// Field 4: `ts_ns`
7385    #[serde(
7386        rename = "tsNs",
7387        alias = "ts_ns",
7388        with = "::buffa::json_helpers::uint64",
7389        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7390    )]
7391    pub ts_ns: u64,
7392    #[serde(skip)]
7393    #[doc(hidden)]
7394    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7395}
7396impl ::core::fmt::Debug for PauseTriggerResponse {
7397    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7398        f.debug_struct("PauseTriggerResponse")
7399            .field("trigger_id", &self.trigger_id)
7400            .field("status", &self.status)
7401            .field("ts", &self.ts)
7402            .field("ts_ns", &self.ts_ns)
7403            .finish()
7404    }
7405}
7406impl PauseTriggerResponse {
7407    /// Protobuf type URL for this message, for use with `Any::pack` and
7408    /// `Any::unpack_if`.
7409    ///
7410    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7411    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
7412}
7413::buffa::impl_default_instance!(PauseTriggerResponse);
7414impl ::buffa::MessageName for PauseTriggerResponse {
7415    const PACKAGE: &'static str = "triggers.v1";
7416    const NAME: &'static str = "PauseTriggerResponse";
7417    const FULL_NAME: &'static str = "triggers.v1.PauseTriggerResponse";
7418    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
7419}
7420impl ::buffa::Message for PauseTriggerResponse {
7421    /// Returns the total encoded size in bytes.
7422    ///
7423    /// The result is a `u32`; the protobuf specification requires all
7424    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7425    /// compliant message will never overflow this type.
7426    #[allow(clippy::let_and_return)]
7427    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7428        #[allow(unused_imports)]
7429        use ::buffa::Enumeration as _;
7430        let mut size = 0u32;
7431        if self.trigger_id != 0u64 {
7432            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7433        }
7434        {
7435            let val = self.status.to_i32();
7436            if val != 0 {
7437                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7438            }
7439        }
7440        if self.ts.is_set() {
7441            let __slot = __cache.reserve();
7442            let inner_size = self.ts.compute_size(__cache);
7443            __cache.set(__slot, inner_size);
7444            size
7445                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7446                    + inner_size;
7447        }
7448        if self.ts_ns != 0u64 {
7449            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7450        }
7451        size += self.__buffa_unknown_fields.encoded_len() as u32;
7452        size
7453    }
7454    fn write_to(
7455        &self,
7456        __cache: &mut ::buffa::SizeCache,
7457        buf: &mut impl ::buffa::bytes::BufMut,
7458    ) {
7459        #[allow(unused_imports)]
7460        use ::buffa::Enumeration as _;
7461        if self.trigger_id != 0u64 {
7462            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7463        }
7464        {
7465            let val = self.status.to_i32();
7466            if val != 0 {
7467                ::buffa::types::put_int32_field(2u32, val, buf);
7468            }
7469        }
7470        if self.ts.is_set() {
7471            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7472            self.ts.write_to(__cache, buf);
7473        }
7474        if self.ts_ns != 0u64 {
7475            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7476        }
7477        self.__buffa_unknown_fields.write_to(buf);
7478    }
7479    fn merge_field(
7480        &mut self,
7481        tag: ::buffa::encoding::Tag,
7482        buf: &mut impl ::buffa::bytes::Buf,
7483        ctx: ::buffa::DecodeContext<'_>,
7484    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7485        #[allow(unused_imports)]
7486        use ::buffa::bytes::Buf as _;
7487        #[allow(unused_imports)]
7488        use ::buffa::Enumeration as _;
7489        match tag.field_number() {
7490            1u32 => {
7491                ::buffa::encoding::check_wire_type(
7492                    tag,
7493                    ::buffa::encoding::WireType::Fixed64,
7494                )?;
7495                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7496            }
7497            2u32 => {
7498                ::buffa::encoding::check_wire_type(
7499                    tag,
7500                    ::buffa::encoding::WireType::Varint,
7501                )?;
7502                self.status = ::buffa::EnumValue::from(
7503                    ::buffa::types::decode_int32(buf)?,
7504                );
7505            }
7506            3u32 => {
7507                ::buffa::encoding::check_wire_type(
7508                    tag,
7509                    ::buffa::encoding::WireType::LengthDelimited,
7510                )?;
7511                ::buffa::Message::merge_length_delimited(
7512                    self.ts.get_or_insert_default(),
7513                    buf,
7514                    ctx,
7515                )?;
7516            }
7517            4u32 => {
7518                ::buffa::encoding::check_wire_type(
7519                    tag,
7520                    ::buffa::encoding::WireType::Varint,
7521                )?;
7522                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7523            }
7524            _ => {
7525                self.__buffa_unknown_fields
7526                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7527            }
7528        }
7529        ::core::result::Result::Ok(())
7530    }
7531    fn clear(&mut self) {
7532        self.trigger_id = 0u64;
7533        self.status = ::buffa::EnumValue::from(0);
7534        self.ts = ::buffa::MessageField::none();
7535        self.ts_ns = 0u64;
7536        self.__buffa_unknown_fields.clear();
7537    }
7538}
7539impl ::buffa::ExtensionSet for PauseTriggerResponse {
7540    const PROTO_FQN: &'static str = "triggers.v1.PauseTriggerResponse";
7541    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7542        &self.__buffa_unknown_fields
7543    }
7544    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7545        &mut self.__buffa_unknown_fields
7546    }
7547}
7548impl ::buffa::json_helpers::ProtoElemJson for PauseTriggerResponse {
7549    fn serialize_proto_json<S: ::serde::Serializer>(
7550        v: &Self,
7551        s: S,
7552    ) -> ::core::result::Result<S::Ok, S::Error> {
7553        ::serde::Serialize::serialize(v, s)
7554    }
7555    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7556        d: D,
7557    ) -> ::core::result::Result<Self, D::Error> {
7558        <Self as ::serde::Deserialize>::deserialize(d)
7559    }
7560}
7561#[doc(hidden)]
7562pub const __PAUSE_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7563    type_url: "type.googleapis.com/triggers.v1.PauseTriggerResponse",
7564    to_json: ::buffa::type_registry::any_to_json::<PauseTriggerResponse>,
7565    from_json: ::buffa::type_registry::any_from_json::<PauseTriggerResponse>,
7566    is_wkt: false,
7567};
7568/// ResumeTriggerRequest resumes a paused trigger by ID.
7569#[derive(Clone, PartialEq, Default)]
7570#[derive(::serde::Serialize, ::serde::Deserialize)]
7571#[serde(default)]
7572pub struct ResumeTriggerRequest {
7573    /// Trigger ID to resume.
7574    ///
7575    /// Field 1: `trigger_id`
7576    #[serde(
7577        rename = "triggerId",
7578        alias = "trigger_id",
7579        with = "::buffa::json_helpers::uint64",
7580        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7581    )]
7582    pub trigger_id: u64,
7583    /// Optional sub-account for authorization.
7584    ///
7585    /// Field 2: `subaccount_id`
7586    #[serde(
7587        rename = "subaccountId",
7588        alias = "subaccount_id",
7589        with = "::buffa::json_helpers::opt_uint64",
7590        skip_serializing_if = "::core::option::Option::is_none"
7591    )]
7592    pub subaccount_id: ::core::option::Option<u64>,
7593    #[serde(skip)]
7594    #[doc(hidden)]
7595    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7596}
7597impl ::core::fmt::Debug for ResumeTriggerRequest {
7598    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7599        f.debug_struct("ResumeTriggerRequest")
7600            .field("trigger_id", &self.trigger_id)
7601            .field("subaccount_id", &self.subaccount_id)
7602            .finish()
7603    }
7604}
7605impl ResumeTriggerRequest {
7606    /// Protobuf type URL for this message, for use with `Any::pack` and
7607    /// `Any::unpack_if`.
7608    ///
7609    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7610    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
7611}
7612impl ResumeTriggerRequest {
7613    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7614    #[inline]
7615    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
7616    pub fn with_subaccount_id(mut self, value: u64) -> Self {
7617        self.subaccount_id = Some(value);
7618        self
7619    }
7620}
7621::buffa::impl_default_instance!(ResumeTriggerRequest);
7622impl ::buffa::MessageName for ResumeTriggerRequest {
7623    const PACKAGE: &'static str = "triggers.v1";
7624    const NAME: &'static str = "ResumeTriggerRequest";
7625    const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerRequest";
7626    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
7627}
7628impl ::buffa::Message for ResumeTriggerRequest {
7629    /// Returns the total encoded size in bytes.
7630    ///
7631    /// The result is a `u32`; the protobuf specification requires all
7632    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7633    /// compliant message will never overflow this type.
7634    #[allow(clippy::let_and_return)]
7635    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7636        #[allow(unused_imports)]
7637        use ::buffa::Enumeration as _;
7638        let mut size = 0u32;
7639        if self.trigger_id != 0u64 {
7640            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7641        }
7642        if self.subaccount_id.is_some() {
7643            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7644        }
7645        size += self.__buffa_unknown_fields.encoded_len() as u32;
7646        size
7647    }
7648    fn write_to(
7649        &self,
7650        _cache: &mut ::buffa::SizeCache,
7651        buf: &mut impl ::buffa::bytes::BufMut,
7652    ) {
7653        #[allow(unused_imports)]
7654        use ::buffa::Enumeration as _;
7655        if self.trigger_id != 0u64 {
7656            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7657        }
7658        if let Some(v) = self.subaccount_id {
7659            ::buffa::types::put_fixed64_field(2u32, v, buf);
7660        }
7661        self.__buffa_unknown_fields.write_to(buf);
7662    }
7663    fn merge_field(
7664        &mut self,
7665        tag: ::buffa::encoding::Tag,
7666        buf: &mut impl ::buffa::bytes::Buf,
7667        ctx: ::buffa::DecodeContext<'_>,
7668    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7669        #[allow(unused_imports)]
7670        use ::buffa::bytes::Buf as _;
7671        #[allow(unused_imports)]
7672        use ::buffa::Enumeration as _;
7673        match tag.field_number() {
7674            1u32 => {
7675                ::buffa::encoding::check_wire_type(
7676                    tag,
7677                    ::buffa::encoding::WireType::Fixed64,
7678                )?;
7679                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7680            }
7681            2u32 => {
7682                ::buffa::encoding::check_wire_type(
7683                    tag,
7684                    ::buffa::encoding::WireType::Fixed64,
7685                )?;
7686                self.subaccount_id = ::core::option::Option::Some(
7687                    ::buffa::types::decode_fixed64(buf)?,
7688                );
7689            }
7690            _ => {
7691                self.__buffa_unknown_fields
7692                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7693            }
7694        }
7695        ::core::result::Result::Ok(())
7696    }
7697    fn clear(&mut self) {
7698        self.trigger_id = 0u64;
7699        self.subaccount_id = ::core::option::Option::None;
7700        self.__buffa_unknown_fields.clear();
7701    }
7702}
7703impl ::buffa::ExtensionSet for ResumeTriggerRequest {
7704    const PROTO_FQN: &'static str = "triggers.v1.ResumeTriggerRequest";
7705    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7706        &self.__buffa_unknown_fields
7707    }
7708    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7709        &mut self.__buffa_unknown_fields
7710    }
7711}
7712impl ::buffa::json_helpers::ProtoElemJson for ResumeTriggerRequest {
7713    fn serialize_proto_json<S: ::serde::Serializer>(
7714        v: &Self,
7715        s: S,
7716    ) -> ::core::result::Result<S::Ok, S::Error> {
7717        ::serde::Serialize::serialize(v, s)
7718    }
7719    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7720        d: D,
7721    ) -> ::core::result::Result<Self, D::Error> {
7722        <Self as ::serde::Deserialize>::deserialize(d)
7723    }
7724}
7725#[doc(hidden)]
7726pub const __RESUME_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7727    type_url: "type.googleapis.com/triggers.v1.ResumeTriggerRequest",
7728    to_json: ::buffa::type_registry::any_to_json::<ResumeTriggerRequest>,
7729    from_json: ::buffa::type_registry::any_from_json::<ResumeTriggerRequest>,
7730    is_wkt: false,
7731};
7732/// ResumeTriggerResponse returns the trigger status after resuming.
7733#[derive(Clone, PartialEq, Default)]
7734#[derive(::serde::Serialize, ::serde::Deserialize)]
7735#[serde(default)]
7736pub struct ResumeTriggerResponse {
7737    /// Resumed trigger ID.
7738    ///
7739    /// Field 1: `trigger_id`
7740    #[serde(
7741        rename = "triggerId",
7742        alias = "trigger_id",
7743        with = "::buffa::json_helpers::uint64",
7744        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7745    )]
7746    pub trigger_id: u64,
7747    /// Current trigger status after resuming.
7748    ///
7749    /// Field 2: `status`
7750    #[serde(
7751        rename = "status",
7752        with = "::buffa::json_helpers::proto_enum",
7753        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7754    )]
7755    pub status: ::buffa::EnumValue<TriggerStatus>,
7756    /// Server timestamp.
7757    ///
7758    /// Field 3: `ts`
7759    #[serde(
7760        rename = "ts",
7761        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7762    )]
7763    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7764    /// Server timestamp in nanoseconds since epoch (UTC).
7765    ///
7766    /// Field 4: `ts_ns`
7767    #[serde(
7768        rename = "tsNs",
7769        alias = "ts_ns",
7770        with = "::buffa::json_helpers::uint64",
7771        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7772    )]
7773    pub ts_ns: u64,
7774    #[serde(skip)]
7775    #[doc(hidden)]
7776    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7777}
7778impl ::core::fmt::Debug for ResumeTriggerResponse {
7779    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7780        f.debug_struct("ResumeTriggerResponse")
7781            .field("trigger_id", &self.trigger_id)
7782            .field("status", &self.status)
7783            .field("ts", &self.ts)
7784            .field("ts_ns", &self.ts_ns)
7785            .finish()
7786    }
7787}
7788impl ResumeTriggerResponse {
7789    /// Protobuf type URL for this message, for use with `Any::pack` and
7790    /// `Any::unpack_if`.
7791    ///
7792    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7793    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
7794}
7795::buffa::impl_default_instance!(ResumeTriggerResponse);
7796impl ::buffa::MessageName for ResumeTriggerResponse {
7797    const PACKAGE: &'static str = "triggers.v1";
7798    const NAME: &'static str = "ResumeTriggerResponse";
7799    const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerResponse";
7800    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
7801}
7802impl ::buffa::Message for ResumeTriggerResponse {
7803    /// Returns the total encoded size in bytes.
7804    ///
7805    /// The result is a `u32`; the protobuf specification requires all
7806    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7807    /// compliant message will never overflow this type.
7808    #[allow(clippy::let_and_return)]
7809    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7810        #[allow(unused_imports)]
7811        use ::buffa::Enumeration as _;
7812        let mut size = 0u32;
7813        if self.trigger_id != 0u64 {
7814            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7815        }
7816        {
7817            let val = self.status.to_i32();
7818            if val != 0 {
7819                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7820            }
7821        }
7822        if self.ts.is_set() {
7823            let __slot = __cache.reserve();
7824            let inner_size = self.ts.compute_size(__cache);
7825            __cache.set(__slot, inner_size);
7826            size
7827                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7828                    + inner_size;
7829        }
7830        if self.ts_ns != 0u64 {
7831            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7832        }
7833        size += self.__buffa_unknown_fields.encoded_len() as u32;
7834        size
7835    }
7836    fn write_to(
7837        &self,
7838        __cache: &mut ::buffa::SizeCache,
7839        buf: &mut impl ::buffa::bytes::BufMut,
7840    ) {
7841        #[allow(unused_imports)]
7842        use ::buffa::Enumeration as _;
7843        if self.trigger_id != 0u64 {
7844            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7845        }
7846        {
7847            let val = self.status.to_i32();
7848            if val != 0 {
7849                ::buffa::types::put_int32_field(2u32, val, buf);
7850            }
7851        }
7852        if self.ts.is_set() {
7853            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7854            self.ts.write_to(__cache, buf);
7855        }
7856        if self.ts_ns != 0u64 {
7857            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7858        }
7859        self.__buffa_unknown_fields.write_to(buf);
7860    }
7861    fn merge_field(
7862        &mut self,
7863        tag: ::buffa::encoding::Tag,
7864        buf: &mut impl ::buffa::bytes::Buf,
7865        ctx: ::buffa::DecodeContext<'_>,
7866    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7867        #[allow(unused_imports)]
7868        use ::buffa::bytes::Buf as _;
7869        #[allow(unused_imports)]
7870        use ::buffa::Enumeration as _;
7871        match tag.field_number() {
7872            1u32 => {
7873                ::buffa::encoding::check_wire_type(
7874                    tag,
7875                    ::buffa::encoding::WireType::Fixed64,
7876                )?;
7877                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7878            }
7879            2u32 => {
7880                ::buffa::encoding::check_wire_type(
7881                    tag,
7882                    ::buffa::encoding::WireType::Varint,
7883                )?;
7884                self.status = ::buffa::EnumValue::from(
7885                    ::buffa::types::decode_int32(buf)?,
7886                );
7887            }
7888            3u32 => {
7889                ::buffa::encoding::check_wire_type(
7890                    tag,
7891                    ::buffa::encoding::WireType::LengthDelimited,
7892                )?;
7893                ::buffa::Message::merge_length_delimited(
7894                    self.ts.get_or_insert_default(),
7895                    buf,
7896                    ctx,
7897                )?;
7898            }
7899            4u32 => {
7900                ::buffa::encoding::check_wire_type(
7901                    tag,
7902                    ::buffa::encoding::WireType::Varint,
7903                )?;
7904                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7905            }
7906            _ => {
7907                self.__buffa_unknown_fields
7908                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7909            }
7910        }
7911        ::core::result::Result::Ok(())
7912    }
7913    fn clear(&mut self) {
7914        self.trigger_id = 0u64;
7915        self.status = ::buffa::EnumValue::from(0);
7916        self.ts = ::buffa::MessageField::none();
7917        self.ts_ns = 0u64;
7918        self.__buffa_unknown_fields.clear();
7919    }
7920}
7921impl ::buffa::ExtensionSet for ResumeTriggerResponse {
7922    const PROTO_FQN: &'static str = "triggers.v1.ResumeTriggerResponse";
7923    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7924        &self.__buffa_unknown_fields
7925    }
7926    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7927        &mut self.__buffa_unknown_fields
7928    }
7929}
7930impl ::buffa::json_helpers::ProtoElemJson for ResumeTriggerResponse {
7931    fn serialize_proto_json<S: ::serde::Serializer>(
7932        v: &Self,
7933        s: S,
7934    ) -> ::core::result::Result<S::Ok, S::Error> {
7935        ::serde::Serialize::serialize(v, s)
7936    }
7937    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7938        d: D,
7939    ) -> ::core::result::Result<Self, D::Error> {
7940        <Self as ::serde::Deserialize>::deserialize(d)
7941    }
7942}
7943#[doc(hidden)]
7944pub const __RESUME_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7945    type_url: "type.googleapis.com/triggers.v1.ResumeTriggerResponse",
7946    to_json: ::buffa::type_registry::any_to_json::<ResumeTriggerResponse>,
7947    from_json: ::buffa::type_registry::any_from_json::<ResumeTriggerResponse>,
7948    is_wkt: false,
7949};
7950/// =============================================================================
7951/// Trigger Model
7952/// =============================================================================
7953///
7954/// StopDetails contains configuration for STOP_LOSS and TAKE_PROFIT triggers.
7955#[derive(Clone, PartialEq, Default)]
7956#[derive(::serde::Serialize, ::serde::Deserialize)]
7957#[serde(default)]
7958pub struct StopDetails {
7959    /// Trigger threshold price in quote units scaled by 1e6.
7960    ///
7961    /// Field 1: `trigger_price_ticks`
7962    #[serde(
7963        rename = "triggerPriceTicks",
7964        alias = "trigger_price_ticks",
7965        with = "::buffa::json_helpers::int64",
7966        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
7967    )]
7968    pub trigger_price_ticks: i64,
7969    /// Price source used for trigger evaluation.
7970    ///
7971    /// Field 2: `trigger_price_source`
7972    #[serde(
7973        rename = "triggerPriceSource",
7974        alias = "trigger_price_source",
7975        with = "::buffa::json_helpers::proto_enum",
7976        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7977    )]
7978    pub trigger_price_source: ::buffa::EnumValue<
7979        super::super::orders::v1::TriggerPriceSource,
7980    >,
7981    /// Direction the price must cross to fire the trigger.
7982    ///
7983    /// Field 3: `trigger_direction`
7984    #[serde(
7985        rename = "triggerDirection",
7986        alias = "trigger_direction",
7987        with = "::buffa::json_helpers::proto_enum",
7988        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7989    )]
7990    pub trigger_direction: ::buffa::EnumValue<
7991        super::super::orders::v1::TriggerDirection,
7992    >,
7993    #[serde(skip)]
7994    #[doc(hidden)]
7995    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7996}
7997impl ::core::fmt::Debug for StopDetails {
7998    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7999        f.debug_struct("StopDetails")
8000            .field("trigger_price_ticks", &self.trigger_price_ticks)
8001            .field("trigger_price_source", &self.trigger_price_source)
8002            .field("trigger_direction", &self.trigger_direction)
8003            .finish()
8004    }
8005}
8006impl StopDetails {
8007    /// Protobuf type URL for this message, for use with `Any::pack` and
8008    /// `Any::unpack_if`.
8009    ///
8010    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8011    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
8012}
8013::buffa::impl_default_instance!(StopDetails);
8014impl ::buffa::MessageName for StopDetails {
8015    const PACKAGE: &'static str = "triggers.v1";
8016    const NAME: &'static str = "StopDetails";
8017    const FULL_NAME: &'static str = "triggers.v1.StopDetails";
8018    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
8019}
8020impl ::buffa::Message for StopDetails {
8021    /// Returns the total encoded size in bytes.
8022    ///
8023    /// The result is a `u32`; the protobuf specification requires all
8024    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8025    /// compliant message will never overflow this type.
8026    #[allow(clippy::let_and_return)]
8027    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8028        #[allow(unused_imports)]
8029        use ::buffa::Enumeration as _;
8030        let mut size = 0u32;
8031        if self.trigger_price_ticks != 0i64 {
8032            size
8033                += 1u32
8034                    + ::buffa::types::int64_encoded_len(self.trigger_price_ticks) as u32;
8035        }
8036        {
8037            let val = self.trigger_price_source.to_i32();
8038            if val != 0 {
8039                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8040            }
8041        }
8042        {
8043            let val = self.trigger_direction.to_i32();
8044            if val != 0 {
8045                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8046            }
8047        }
8048        size += self.__buffa_unknown_fields.encoded_len() as u32;
8049        size
8050    }
8051    fn write_to(
8052        &self,
8053        _cache: &mut ::buffa::SizeCache,
8054        buf: &mut impl ::buffa::bytes::BufMut,
8055    ) {
8056        #[allow(unused_imports)]
8057        use ::buffa::Enumeration as _;
8058        if self.trigger_price_ticks != 0i64 {
8059            ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
8060        }
8061        {
8062            let val = self.trigger_price_source.to_i32();
8063            if val != 0 {
8064                ::buffa::types::put_int32_field(2u32, val, buf);
8065            }
8066        }
8067        {
8068            let val = self.trigger_direction.to_i32();
8069            if val != 0 {
8070                ::buffa::types::put_int32_field(3u32, val, buf);
8071            }
8072        }
8073        self.__buffa_unknown_fields.write_to(buf);
8074    }
8075    fn merge_field(
8076        &mut self,
8077        tag: ::buffa::encoding::Tag,
8078        buf: &mut impl ::buffa::bytes::Buf,
8079        ctx: ::buffa::DecodeContext<'_>,
8080    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8081        #[allow(unused_imports)]
8082        use ::buffa::bytes::Buf as _;
8083        #[allow(unused_imports)]
8084        use ::buffa::Enumeration as _;
8085        match tag.field_number() {
8086            1u32 => {
8087                ::buffa::encoding::check_wire_type(
8088                    tag,
8089                    ::buffa::encoding::WireType::Varint,
8090                )?;
8091                self.trigger_price_ticks = ::buffa::types::decode_int64(buf)?;
8092            }
8093            2u32 => {
8094                ::buffa::encoding::check_wire_type(
8095                    tag,
8096                    ::buffa::encoding::WireType::Varint,
8097                )?;
8098                self.trigger_price_source = ::buffa::EnumValue::from(
8099                    ::buffa::types::decode_int32(buf)?,
8100                );
8101            }
8102            3u32 => {
8103                ::buffa::encoding::check_wire_type(
8104                    tag,
8105                    ::buffa::encoding::WireType::Varint,
8106                )?;
8107                self.trigger_direction = ::buffa::EnumValue::from(
8108                    ::buffa::types::decode_int32(buf)?,
8109                );
8110            }
8111            _ => {
8112                self.__buffa_unknown_fields
8113                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8114            }
8115        }
8116        ::core::result::Result::Ok(())
8117    }
8118    fn clear(&mut self) {
8119        self.trigger_price_ticks = 0i64;
8120        self.trigger_price_source = ::buffa::EnumValue::from(0);
8121        self.trigger_direction = ::buffa::EnumValue::from(0);
8122        self.__buffa_unknown_fields.clear();
8123    }
8124}
8125impl ::buffa::ExtensionSet for StopDetails {
8126    const PROTO_FQN: &'static str = "triggers.v1.StopDetails";
8127    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8128        &self.__buffa_unknown_fields
8129    }
8130    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8131        &mut self.__buffa_unknown_fields
8132    }
8133}
8134impl ::buffa::json_helpers::ProtoElemJson for StopDetails {
8135    fn serialize_proto_json<S: ::serde::Serializer>(
8136        v: &Self,
8137        s: S,
8138    ) -> ::core::result::Result<S::Ok, S::Error> {
8139        ::serde::Serialize::serialize(v, s)
8140    }
8141    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8142        d: D,
8143    ) -> ::core::result::Result<Self, D::Error> {
8144        <Self as ::serde::Deserialize>::deserialize(d)
8145    }
8146}
8147#[doc(hidden)]
8148pub const __STOP_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8149    type_url: "type.googleapis.com/triggers.v1.StopDetails",
8150    to_json: ::buffa::type_registry::any_to_json::<StopDetails>,
8151    from_json: ::buffa::type_registry::any_from_json::<StopDetails>,
8152    is_wkt: false,
8153};
8154/// TrailingDetails contains configuration and runtime state for TRAILING_STOP
8155/// triggers.
8156#[derive(Clone, PartialEq, Default)]
8157#[derive(::serde::Serialize, ::serde::Deserialize)]
8158#[serde(default)]
8159pub struct TrailingDetails {
8160    /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
8161    ///
8162    /// Field 1: `trailing_distance_ticks`
8163    #[serde(
8164        rename = "trailingDistanceTicks",
8165        alias = "trailing_distance_ticks",
8166        with = "::buffa::json_helpers::int64",
8167        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8168    )]
8169    pub trailing_distance_ticks: i64,
8170    /// Optional activation price: trailing only starts after this price is
8171    /// reached. Expressed in quote units scaled by 1e6.
8172    ///
8173    /// Field 2: `activation_price_ticks`
8174    #[serde(
8175        rename = "activationPriceTicks",
8176        alias = "activation_price_ticks",
8177        with = "::buffa::json_helpers::int64",
8178        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8179    )]
8180    pub activation_price_ticks: i64,
8181    /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
8182    ///
8183    /// Field 3: `peak_price_ticks`
8184    #[serde(
8185        rename = "peakPriceTicks",
8186        alias = "peak_price_ticks",
8187        with = "::buffa::json_helpers::int64",
8188        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8189    )]
8190    pub peak_price_ticks: i64,
8191    /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
8192    ///
8193    /// Field 4: `trough_price_ticks`
8194    #[serde(
8195        rename = "troughPriceTicks",
8196        alias = "trough_price_ticks",
8197        with = "::buffa::json_helpers::int64",
8198        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8199    )]
8200    pub trough_price_ticks: i64,
8201    /// Trailing distance in basis points (1 bp = 0.01%).
8202    ///
8203    /// Field 5: `trailing_distance_bps`
8204    #[serde(
8205        rename = "trailingDistanceBps",
8206        alias = "trailing_distance_bps",
8207        with = "::buffa::json_helpers::int32",
8208        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8209    )]
8210    pub trailing_distance_bps: i32,
8211    /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
8212    ///
8213    /// Field 6: `max_slippage_ticks`
8214    #[serde(
8215        rename = "maxSlippageTicks",
8216        alias = "max_slippage_ticks",
8217        with = "::buffa::json_helpers::int32",
8218        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8219    )]
8220    pub max_slippage_ticks: i32,
8221    /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
8222    ///
8223    /// Field 7: `max_slippage_bps`
8224    #[serde(
8225        rename = "maxSlippageBps",
8226        alias = "max_slippage_bps",
8227        with = "::buffa::json_helpers::int32",
8228        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8229    )]
8230    pub max_slippage_bps: i32,
8231    /// Price source used for trigger evaluation. Fixed for the lifetime of the
8232    /// trigger and exposed for completeness.
8233    ///
8234    /// Field 8: `trigger_price_source`
8235    #[serde(
8236        rename = "triggerPriceSource",
8237        alias = "trigger_price_source",
8238        with = "::buffa::json_helpers::proto_enum",
8239        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8240    )]
8241    pub trigger_price_source: ::buffa::EnumValue<
8242        super::super::orders::v1::TriggerPriceSource,
8243    >,
8244    /// Direction the price must cross to fire the trigger. Fixed for the lifetime
8245    /// of the trigger and exposed for completeness.
8246    ///
8247    /// Field 9: `trigger_direction`
8248    #[serde(
8249        rename = "triggerDirection",
8250        alias = "trigger_direction",
8251        with = "::buffa::json_helpers::proto_enum",
8252        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8253    )]
8254    pub trigger_direction: ::buffa::EnumValue<
8255        super::super::orders::v1::TriggerDirection,
8256    >,
8257    #[serde(skip)]
8258    #[doc(hidden)]
8259    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8260}
8261impl ::core::fmt::Debug for TrailingDetails {
8262    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8263        f.debug_struct("TrailingDetails")
8264            .field("trailing_distance_ticks", &self.trailing_distance_ticks)
8265            .field("activation_price_ticks", &self.activation_price_ticks)
8266            .field("peak_price_ticks", &self.peak_price_ticks)
8267            .field("trough_price_ticks", &self.trough_price_ticks)
8268            .field("trailing_distance_bps", &self.trailing_distance_bps)
8269            .field("max_slippage_ticks", &self.max_slippage_ticks)
8270            .field("max_slippage_bps", &self.max_slippage_bps)
8271            .field("trigger_price_source", &self.trigger_price_source)
8272            .field("trigger_direction", &self.trigger_direction)
8273            .finish()
8274    }
8275}
8276impl TrailingDetails {
8277    /// Protobuf type URL for this message, for use with `Any::pack` and
8278    /// `Any::unpack_if`.
8279    ///
8280    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8281    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
8282}
8283::buffa::impl_default_instance!(TrailingDetails);
8284impl ::buffa::MessageName for TrailingDetails {
8285    const PACKAGE: &'static str = "triggers.v1";
8286    const NAME: &'static str = "TrailingDetails";
8287    const FULL_NAME: &'static str = "triggers.v1.TrailingDetails";
8288    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
8289}
8290impl ::buffa::Message for TrailingDetails {
8291    /// Returns the total encoded size in bytes.
8292    ///
8293    /// The result is a `u32`; the protobuf specification requires all
8294    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8295    /// compliant message will never overflow this type.
8296    #[allow(clippy::let_and_return)]
8297    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8298        #[allow(unused_imports)]
8299        use ::buffa::Enumeration as _;
8300        let mut size = 0u32;
8301        if self.trailing_distance_ticks != 0i64 {
8302            size
8303                += 1u32
8304                    + ::buffa::types::int64_encoded_len(self.trailing_distance_ticks)
8305                        as u32;
8306        }
8307        if self.activation_price_ticks != 0i64 {
8308            size
8309                += 1u32
8310                    + ::buffa::types::int64_encoded_len(self.activation_price_ticks)
8311                        as u32;
8312        }
8313        if self.peak_price_ticks != 0i64 {
8314            size
8315                += 1u32
8316                    + ::buffa::types::int64_encoded_len(self.peak_price_ticks) as u32;
8317        }
8318        if self.trough_price_ticks != 0i64 {
8319            size
8320                += 1u32
8321                    + ::buffa::types::int64_encoded_len(self.trough_price_ticks) as u32;
8322        }
8323        if self.trailing_distance_bps != 0i32 {
8324            size
8325                += 1u32
8326                    + ::buffa::types::int32_encoded_len(self.trailing_distance_bps)
8327                        as u32;
8328        }
8329        if self.max_slippage_ticks != 0i32 {
8330            size
8331                += 1u32
8332                    + ::buffa::types::int32_encoded_len(self.max_slippage_ticks) as u32;
8333        }
8334        if self.max_slippage_bps != 0i32 {
8335            size
8336                += 1u32
8337                    + ::buffa::types::int32_encoded_len(self.max_slippage_bps) as u32;
8338        }
8339        {
8340            let val = self.trigger_price_source.to_i32();
8341            if val != 0 {
8342                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8343            }
8344        }
8345        {
8346            let val = self.trigger_direction.to_i32();
8347            if val != 0 {
8348                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8349            }
8350        }
8351        size += self.__buffa_unknown_fields.encoded_len() as u32;
8352        size
8353    }
8354    fn write_to(
8355        &self,
8356        _cache: &mut ::buffa::SizeCache,
8357        buf: &mut impl ::buffa::bytes::BufMut,
8358    ) {
8359        #[allow(unused_imports)]
8360        use ::buffa::Enumeration as _;
8361        if self.trailing_distance_ticks != 0i64 {
8362            ::buffa::types::put_int64_field(1u32, self.trailing_distance_ticks, buf);
8363        }
8364        if self.activation_price_ticks != 0i64 {
8365            ::buffa::types::put_int64_field(2u32, self.activation_price_ticks, buf);
8366        }
8367        if self.peak_price_ticks != 0i64 {
8368            ::buffa::types::put_int64_field(3u32, self.peak_price_ticks, buf);
8369        }
8370        if self.trough_price_ticks != 0i64 {
8371            ::buffa::types::put_int64_field(4u32, self.trough_price_ticks, buf);
8372        }
8373        if self.trailing_distance_bps != 0i32 {
8374            ::buffa::types::put_int32_field(5u32, self.trailing_distance_bps, buf);
8375        }
8376        if self.max_slippage_ticks != 0i32 {
8377            ::buffa::types::put_int32_field(6u32, self.max_slippage_ticks, buf);
8378        }
8379        if self.max_slippage_bps != 0i32 {
8380            ::buffa::types::put_int32_field(7u32, self.max_slippage_bps, buf);
8381        }
8382        {
8383            let val = self.trigger_price_source.to_i32();
8384            if val != 0 {
8385                ::buffa::types::put_int32_field(8u32, val, buf);
8386            }
8387        }
8388        {
8389            let val = self.trigger_direction.to_i32();
8390            if val != 0 {
8391                ::buffa::types::put_int32_field(9u32, val, buf);
8392            }
8393        }
8394        self.__buffa_unknown_fields.write_to(buf);
8395    }
8396    fn merge_field(
8397        &mut self,
8398        tag: ::buffa::encoding::Tag,
8399        buf: &mut impl ::buffa::bytes::Buf,
8400        ctx: ::buffa::DecodeContext<'_>,
8401    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8402        #[allow(unused_imports)]
8403        use ::buffa::bytes::Buf as _;
8404        #[allow(unused_imports)]
8405        use ::buffa::Enumeration as _;
8406        match tag.field_number() {
8407            1u32 => {
8408                ::buffa::encoding::check_wire_type(
8409                    tag,
8410                    ::buffa::encoding::WireType::Varint,
8411                )?;
8412                self.trailing_distance_ticks = ::buffa::types::decode_int64(buf)?;
8413            }
8414            2u32 => {
8415                ::buffa::encoding::check_wire_type(
8416                    tag,
8417                    ::buffa::encoding::WireType::Varint,
8418                )?;
8419                self.activation_price_ticks = ::buffa::types::decode_int64(buf)?;
8420            }
8421            3u32 => {
8422                ::buffa::encoding::check_wire_type(
8423                    tag,
8424                    ::buffa::encoding::WireType::Varint,
8425                )?;
8426                self.peak_price_ticks = ::buffa::types::decode_int64(buf)?;
8427            }
8428            4u32 => {
8429                ::buffa::encoding::check_wire_type(
8430                    tag,
8431                    ::buffa::encoding::WireType::Varint,
8432                )?;
8433                self.trough_price_ticks = ::buffa::types::decode_int64(buf)?;
8434            }
8435            5u32 => {
8436                ::buffa::encoding::check_wire_type(
8437                    tag,
8438                    ::buffa::encoding::WireType::Varint,
8439                )?;
8440                self.trailing_distance_bps = ::buffa::types::decode_int32(buf)?;
8441            }
8442            6u32 => {
8443                ::buffa::encoding::check_wire_type(
8444                    tag,
8445                    ::buffa::encoding::WireType::Varint,
8446                )?;
8447                self.max_slippage_ticks = ::buffa::types::decode_int32(buf)?;
8448            }
8449            7u32 => {
8450                ::buffa::encoding::check_wire_type(
8451                    tag,
8452                    ::buffa::encoding::WireType::Varint,
8453                )?;
8454                self.max_slippage_bps = ::buffa::types::decode_int32(buf)?;
8455            }
8456            8u32 => {
8457                ::buffa::encoding::check_wire_type(
8458                    tag,
8459                    ::buffa::encoding::WireType::Varint,
8460                )?;
8461                self.trigger_price_source = ::buffa::EnumValue::from(
8462                    ::buffa::types::decode_int32(buf)?,
8463                );
8464            }
8465            9u32 => {
8466                ::buffa::encoding::check_wire_type(
8467                    tag,
8468                    ::buffa::encoding::WireType::Varint,
8469                )?;
8470                self.trigger_direction = ::buffa::EnumValue::from(
8471                    ::buffa::types::decode_int32(buf)?,
8472                );
8473            }
8474            _ => {
8475                self.__buffa_unknown_fields
8476                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8477            }
8478        }
8479        ::core::result::Result::Ok(())
8480    }
8481    fn clear(&mut self) {
8482        self.trailing_distance_ticks = 0i64;
8483        self.activation_price_ticks = 0i64;
8484        self.peak_price_ticks = 0i64;
8485        self.trough_price_ticks = 0i64;
8486        self.trailing_distance_bps = 0i32;
8487        self.max_slippage_ticks = 0i32;
8488        self.max_slippage_bps = 0i32;
8489        self.trigger_price_source = ::buffa::EnumValue::from(0);
8490        self.trigger_direction = ::buffa::EnumValue::from(0);
8491        self.__buffa_unknown_fields.clear();
8492    }
8493}
8494impl ::buffa::ExtensionSet for TrailingDetails {
8495    const PROTO_FQN: &'static str = "triggers.v1.TrailingDetails";
8496    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8497        &self.__buffa_unknown_fields
8498    }
8499    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8500        &mut self.__buffa_unknown_fields
8501    }
8502}
8503impl ::buffa::json_helpers::ProtoElemJson for TrailingDetails {
8504    fn serialize_proto_json<S: ::serde::Serializer>(
8505        v: &Self,
8506        s: S,
8507    ) -> ::core::result::Result<S::Ok, S::Error> {
8508        ::serde::Serialize::serialize(v, s)
8509    }
8510    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8511        d: D,
8512    ) -> ::core::result::Result<Self, D::Error> {
8513        <Self as ::serde::Deserialize>::deserialize(d)
8514    }
8515}
8516#[doc(hidden)]
8517pub const __TRAILING_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8518    type_url: "type.googleapis.com/triggers.v1.TrailingDetails",
8519    to_json: ::buffa::type_registry::any_to_json::<TrailingDetails>,
8520    from_json: ::buffa::type_registry::any_from_json::<TrailingDetails>,
8521    is_wkt: false,
8522};
8523/// TwapDetails contains configuration and runtime state for TWAP triggers.
8524#[derive(Clone, PartialEq, Default)]
8525#[derive(::serde::Serialize, ::serde::Deserialize)]
8526#[serde(default)]
8527pub struct TwapDetails {
8528    /// Total duration of TWAP execution in milliseconds.
8529    ///
8530    /// Field 1: `twap_duration_ms`
8531    #[serde(
8532        rename = "twapDurationMs",
8533        alias = "twap_duration_ms",
8534        with = "::buffa::json_helpers::int64",
8535        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8536    )]
8537    pub twap_duration_ms: i64,
8538    /// Interval between TWAP slices in milliseconds.
8539    ///
8540    /// Field 2: `twap_slice_interval_ms`
8541    #[serde(
8542        rename = "twapSliceIntervalMs",
8543        alias = "twap_slice_interval_ms",
8544        with = "::buffa::json_helpers::int64",
8545        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8546    )]
8547    pub twap_slice_interval_ms: i64,
8548    /// Current slice index, zero-based.
8549    ///
8550    /// Field 4: `slice_idx`
8551    #[serde(
8552        rename = "sliceIdx",
8553        alias = "slice_idx",
8554        with = "::buffa::json_helpers::int32",
8555        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8556    )]
8557    pub slice_idx: i32,
8558    /// Total number of planned slices.
8559    ///
8560    /// Field 5: `slice_count`
8561    #[serde(
8562        rename = "sliceCount",
8563        alias = "slice_count",
8564        with = "::buffa::json_helpers::int32",
8565        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8566    )]
8567    pub slice_count: i32,
8568    /// Cumulative filled child-order base quantity scaled by the pair's
8569    /// base_quantity_scale from GetSpotConfig.
8570    ///
8571    /// Field 6: `executed_qty_scaled`
8572    #[serde(
8573        rename = "executedQtyScaled",
8574        alias = "executed_qty_scaled",
8575        with = "::buffa::json_helpers::int64",
8576        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8577    )]
8578    pub executed_qty_scaled: i64,
8579    #[serde(skip)]
8580    #[doc(hidden)]
8581    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8582}
8583impl ::core::fmt::Debug for TwapDetails {
8584    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8585        f.debug_struct("TwapDetails")
8586            .field("twap_duration_ms", &self.twap_duration_ms)
8587            .field("twap_slice_interval_ms", &self.twap_slice_interval_ms)
8588            .field("slice_idx", &self.slice_idx)
8589            .field("slice_count", &self.slice_count)
8590            .field("executed_qty_scaled", &self.executed_qty_scaled)
8591            .finish()
8592    }
8593}
8594impl TwapDetails {
8595    /// Protobuf type URL for this message, for use with `Any::pack` and
8596    /// `Any::unpack_if`.
8597    ///
8598    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8599    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
8600}
8601::buffa::impl_default_instance!(TwapDetails);
8602impl ::buffa::MessageName for TwapDetails {
8603    const PACKAGE: &'static str = "triggers.v1";
8604    const NAME: &'static str = "TwapDetails";
8605    const FULL_NAME: &'static str = "triggers.v1.TwapDetails";
8606    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
8607}
8608impl ::buffa::Message for TwapDetails {
8609    /// Returns the total encoded size in bytes.
8610    ///
8611    /// The result is a `u32`; the protobuf specification requires all
8612    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8613    /// compliant message will never overflow this type.
8614    #[allow(clippy::let_and_return)]
8615    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8616        #[allow(unused_imports)]
8617        use ::buffa::Enumeration as _;
8618        let mut size = 0u32;
8619        if self.twap_duration_ms != 0i64 {
8620            size
8621                += 1u32
8622                    + ::buffa::types::int64_encoded_len(self.twap_duration_ms) as u32;
8623        }
8624        if self.twap_slice_interval_ms != 0i64 {
8625            size
8626                += 1u32
8627                    + ::buffa::types::int64_encoded_len(self.twap_slice_interval_ms)
8628                        as u32;
8629        }
8630        if self.slice_idx != 0i32 {
8631            size += 1u32 + ::buffa::types::int32_encoded_len(self.slice_idx) as u32;
8632        }
8633        if self.slice_count != 0i32 {
8634            size += 1u32 + ::buffa::types::int32_encoded_len(self.slice_count) as u32;
8635        }
8636        if self.executed_qty_scaled != 0i64 {
8637            size
8638                += 1u32
8639                    + ::buffa::types::int64_encoded_len(self.executed_qty_scaled) as u32;
8640        }
8641        size += self.__buffa_unknown_fields.encoded_len() as u32;
8642        size
8643    }
8644    fn write_to(
8645        &self,
8646        _cache: &mut ::buffa::SizeCache,
8647        buf: &mut impl ::buffa::bytes::BufMut,
8648    ) {
8649        #[allow(unused_imports)]
8650        use ::buffa::Enumeration as _;
8651        if self.twap_duration_ms != 0i64 {
8652            ::buffa::types::put_int64_field(1u32, self.twap_duration_ms, buf);
8653        }
8654        if self.twap_slice_interval_ms != 0i64 {
8655            ::buffa::types::put_int64_field(2u32, self.twap_slice_interval_ms, buf);
8656        }
8657        if self.slice_idx != 0i32 {
8658            ::buffa::types::put_int32_field(4u32, self.slice_idx, buf);
8659        }
8660        if self.slice_count != 0i32 {
8661            ::buffa::types::put_int32_field(5u32, self.slice_count, buf);
8662        }
8663        if self.executed_qty_scaled != 0i64 {
8664            ::buffa::types::put_int64_field(6u32, self.executed_qty_scaled, buf);
8665        }
8666        self.__buffa_unknown_fields.write_to(buf);
8667    }
8668    fn merge_field(
8669        &mut self,
8670        tag: ::buffa::encoding::Tag,
8671        buf: &mut impl ::buffa::bytes::Buf,
8672        ctx: ::buffa::DecodeContext<'_>,
8673    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8674        #[allow(unused_imports)]
8675        use ::buffa::bytes::Buf as _;
8676        #[allow(unused_imports)]
8677        use ::buffa::Enumeration as _;
8678        match tag.field_number() {
8679            1u32 => {
8680                ::buffa::encoding::check_wire_type(
8681                    tag,
8682                    ::buffa::encoding::WireType::Varint,
8683                )?;
8684                self.twap_duration_ms = ::buffa::types::decode_int64(buf)?;
8685            }
8686            2u32 => {
8687                ::buffa::encoding::check_wire_type(
8688                    tag,
8689                    ::buffa::encoding::WireType::Varint,
8690                )?;
8691                self.twap_slice_interval_ms = ::buffa::types::decode_int64(buf)?;
8692            }
8693            4u32 => {
8694                ::buffa::encoding::check_wire_type(
8695                    tag,
8696                    ::buffa::encoding::WireType::Varint,
8697                )?;
8698                self.slice_idx = ::buffa::types::decode_int32(buf)?;
8699            }
8700            5u32 => {
8701                ::buffa::encoding::check_wire_type(
8702                    tag,
8703                    ::buffa::encoding::WireType::Varint,
8704                )?;
8705                self.slice_count = ::buffa::types::decode_int32(buf)?;
8706            }
8707            6u32 => {
8708                ::buffa::encoding::check_wire_type(
8709                    tag,
8710                    ::buffa::encoding::WireType::Varint,
8711                )?;
8712                self.executed_qty_scaled = ::buffa::types::decode_int64(buf)?;
8713            }
8714            _ => {
8715                self.__buffa_unknown_fields
8716                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8717            }
8718        }
8719        ::core::result::Result::Ok(())
8720    }
8721    fn clear(&mut self) {
8722        self.twap_duration_ms = 0i64;
8723        self.twap_slice_interval_ms = 0i64;
8724        self.slice_idx = 0i32;
8725        self.slice_count = 0i32;
8726        self.executed_qty_scaled = 0i64;
8727        self.__buffa_unknown_fields.clear();
8728    }
8729}
8730impl ::buffa::ExtensionSet for TwapDetails {
8731    const PROTO_FQN: &'static str = "triggers.v1.TwapDetails";
8732    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8733        &self.__buffa_unknown_fields
8734    }
8735    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8736        &mut self.__buffa_unknown_fields
8737    }
8738}
8739impl ::buffa::json_helpers::ProtoElemJson for TwapDetails {
8740    fn serialize_proto_json<S: ::serde::Serializer>(
8741        v: &Self,
8742        s: S,
8743    ) -> ::core::result::Result<S::Ok, S::Error> {
8744        ::serde::Serialize::serialize(v, s)
8745    }
8746    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8747        d: D,
8748    ) -> ::core::result::Result<Self, D::Error> {
8749        <Self as ::serde::Deserialize>::deserialize(d)
8750    }
8751}
8752#[doc(hidden)]
8753pub const __TWAP_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8754    type_url: "type.googleapis.com/triggers.v1.TwapDetails",
8755    to_json: ::buffa::type_registry::any_to_json::<TwapDetails>,
8756    from_json: ::buffa::type_registry::any_from_json::<TwapDetails>,
8757    is_wkt: false,
8758};
8759/// LadderDetails contains configuration for LADDER triggers.
8760#[derive(Clone, PartialEq, Default)]
8761#[derive(::serde::Serialize, ::serde::Deserialize)]
8762#[serde(default)]
8763pub struct LadderDetails {
8764    /// Minimum price in quote units scaled by 1e6 for the ladder range.
8765    ///
8766    /// Field 1: `ladder_price_min_ticks`
8767    #[serde(
8768        rename = "ladderPriceMinTicks",
8769        alias = "ladder_price_min_ticks",
8770        with = "::buffa::json_helpers::int64",
8771        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8772    )]
8773    pub ladder_price_min_ticks: i64,
8774    /// Maximum price in quote units scaled by 1e6 for the ladder range.
8775    ///
8776    /// Field 2: `ladder_price_max_ticks`
8777    #[serde(
8778        rename = "ladderPriceMaxTicks",
8779        alias = "ladder_price_max_ticks",
8780        with = "::buffa::json_helpers::int64",
8781        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8782    )]
8783    pub ladder_price_max_ticks: i64,
8784    /// Number of price levels in the ladder.
8785    ///
8786    /// Field 3: `ladder_levels`
8787    #[serde(
8788        rename = "ladderLevels",
8789        alias = "ladder_levels",
8790        with = "::buffa::json_helpers::int32",
8791        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8792    )]
8793    pub ladder_levels: i32,
8794    /// Quantity distribution across ladder levels.
8795    ///
8796    /// Field 4: `ladder_distribution`
8797    #[serde(
8798        rename = "ladderDistribution",
8799        alias = "ladder_distribution",
8800        with = "::buffa::json_helpers::proto_enum",
8801        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8802    )]
8803    pub ladder_distribution: ::buffa::EnumValue<LadderDistribution>,
8804    #[serde(skip)]
8805    #[doc(hidden)]
8806    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8807}
8808impl ::core::fmt::Debug for LadderDetails {
8809    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8810        f.debug_struct("LadderDetails")
8811            .field("ladder_price_min_ticks", &self.ladder_price_min_ticks)
8812            .field("ladder_price_max_ticks", &self.ladder_price_max_ticks)
8813            .field("ladder_levels", &self.ladder_levels)
8814            .field("ladder_distribution", &self.ladder_distribution)
8815            .finish()
8816    }
8817}
8818impl LadderDetails {
8819    /// Protobuf type URL for this message, for use with `Any::pack` and
8820    /// `Any::unpack_if`.
8821    ///
8822    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8823    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
8824}
8825::buffa::impl_default_instance!(LadderDetails);
8826impl ::buffa::MessageName for LadderDetails {
8827    const PACKAGE: &'static str = "triggers.v1";
8828    const NAME: &'static str = "LadderDetails";
8829    const FULL_NAME: &'static str = "triggers.v1.LadderDetails";
8830    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
8831}
8832impl ::buffa::Message for LadderDetails {
8833    /// Returns the total encoded size in bytes.
8834    ///
8835    /// The result is a `u32`; the protobuf specification requires all
8836    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8837    /// compliant message will never overflow this type.
8838    #[allow(clippy::let_and_return)]
8839    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8840        #[allow(unused_imports)]
8841        use ::buffa::Enumeration as _;
8842        let mut size = 0u32;
8843        if self.ladder_price_min_ticks != 0i64 {
8844            size
8845                += 1u32
8846                    + ::buffa::types::int64_encoded_len(self.ladder_price_min_ticks)
8847                        as u32;
8848        }
8849        if self.ladder_price_max_ticks != 0i64 {
8850            size
8851                += 1u32
8852                    + ::buffa::types::int64_encoded_len(self.ladder_price_max_ticks)
8853                        as u32;
8854        }
8855        if self.ladder_levels != 0i32 {
8856            size += 1u32 + ::buffa::types::int32_encoded_len(self.ladder_levels) as u32;
8857        }
8858        {
8859            let val = self.ladder_distribution.to_i32();
8860            if val != 0 {
8861                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8862            }
8863        }
8864        size += self.__buffa_unknown_fields.encoded_len() as u32;
8865        size
8866    }
8867    fn write_to(
8868        &self,
8869        _cache: &mut ::buffa::SizeCache,
8870        buf: &mut impl ::buffa::bytes::BufMut,
8871    ) {
8872        #[allow(unused_imports)]
8873        use ::buffa::Enumeration as _;
8874        if self.ladder_price_min_ticks != 0i64 {
8875            ::buffa::types::put_int64_field(1u32, self.ladder_price_min_ticks, buf);
8876        }
8877        if self.ladder_price_max_ticks != 0i64 {
8878            ::buffa::types::put_int64_field(2u32, self.ladder_price_max_ticks, buf);
8879        }
8880        if self.ladder_levels != 0i32 {
8881            ::buffa::types::put_int32_field(3u32, self.ladder_levels, buf);
8882        }
8883        {
8884            let val = self.ladder_distribution.to_i32();
8885            if val != 0 {
8886                ::buffa::types::put_int32_field(4u32, val, buf);
8887            }
8888        }
8889        self.__buffa_unknown_fields.write_to(buf);
8890    }
8891    fn merge_field(
8892        &mut self,
8893        tag: ::buffa::encoding::Tag,
8894        buf: &mut impl ::buffa::bytes::Buf,
8895        ctx: ::buffa::DecodeContext<'_>,
8896    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8897        #[allow(unused_imports)]
8898        use ::buffa::bytes::Buf as _;
8899        #[allow(unused_imports)]
8900        use ::buffa::Enumeration as _;
8901        match tag.field_number() {
8902            1u32 => {
8903                ::buffa::encoding::check_wire_type(
8904                    tag,
8905                    ::buffa::encoding::WireType::Varint,
8906                )?;
8907                self.ladder_price_min_ticks = ::buffa::types::decode_int64(buf)?;
8908            }
8909            2u32 => {
8910                ::buffa::encoding::check_wire_type(
8911                    tag,
8912                    ::buffa::encoding::WireType::Varint,
8913                )?;
8914                self.ladder_price_max_ticks = ::buffa::types::decode_int64(buf)?;
8915            }
8916            3u32 => {
8917                ::buffa::encoding::check_wire_type(
8918                    tag,
8919                    ::buffa::encoding::WireType::Varint,
8920                )?;
8921                self.ladder_levels = ::buffa::types::decode_int32(buf)?;
8922            }
8923            4u32 => {
8924                ::buffa::encoding::check_wire_type(
8925                    tag,
8926                    ::buffa::encoding::WireType::Varint,
8927                )?;
8928                self.ladder_distribution = ::buffa::EnumValue::from(
8929                    ::buffa::types::decode_int32(buf)?,
8930                );
8931            }
8932            _ => {
8933                self.__buffa_unknown_fields
8934                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8935            }
8936        }
8937        ::core::result::Result::Ok(())
8938    }
8939    fn clear(&mut self) {
8940        self.ladder_price_min_ticks = 0i64;
8941        self.ladder_price_max_ticks = 0i64;
8942        self.ladder_levels = 0i32;
8943        self.ladder_distribution = ::buffa::EnumValue::from(0);
8944        self.__buffa_unknown_fields.clear();
8945    }
8946}
8947impl ::buffa::ExtensionSet for LadderDetails {
8948    const PROTO_FQN: &'static str = "triggers.v1.LadderDetails";
8949    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8950        &self.__buffa_unknown_fields
8951    }
8952    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8953        &mut self.__buffa_unknown_fields
8954    }
8955}
8956impl ::buffa::json_helpers::ProtoElemJson for LadderDetails {
8957    fn serialize_proto_json<S: ::serde::Serializer>(
8958        v: &Self,
8959        s: S,
8960    ) -> ::core::result::Result<S::Ok, S::Error> {
8961        ::serde::Serialize::serialize(v, s)
8962    }
8963    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8964        d: D,
8965    ) -> ::core::result::Result<Self, D::Error> {
8966        <Self as ::serde::Deserialize>::deserialize(d)
8967    }
8968}
8969#[doc(hidden)]
8970pub const __LADDER_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8971    type_url: "type.googleapis.com/triggers.v1.LadderDetails",
8972    to_json: ::buffa::type_registry::any_to_json::<LadderDetails>,
8973    from_json: ::buffa::type_registry::any_from_json::<LadderDetails>,
8974    is_wkt: false,
8975};
8976/// Trigger represents current trigger configuration, lifecycle state, and
8977/// aggregate strategy progress. Use ListTriggerEvents to enumerate child-order
8978/// actions and inspect append-only lifecycle history.
8979#[derive(Clone, PartialEq, Default)]
8980#[derive(::serde::Serialize)]
8981#[serde(default)]
8982pub struct Trigger {
8983    /// Trigger ID.
8984    ///
8985    /// Field 1: `trigger_id`
8986    #[serde(
8987        rename = "triggerId",
8988        alias = "trigger_id",
8989        with = "::buffa::json_helpers::uint64",
8990        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
8991    )]
8992    pub trigger_id: u64,
8993    /// Public account or sub-account ID associated with the trigger.
8994    ///
8995    /// Field 2: `subaccount_id`
8996    #[serde(
8997        rename = "subaccountId",
8998        alias = "subaccount_id",
8999        with = "::buffa::json_helpers::uint64",
9000        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
9001    )]
9002    pub subaccount_id: u64,
9003    /// Trading symbol numeric identifier.
9004    ///
9005    /// Field 3: `symbol_id`
9006    #[serde(
9007        rename = "symbolId",
9008        alias = "symbol_id",
9009        with = "::buffa::json_helpers::uint32",
9010        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
9011    )]
9012    pub symbol_id: u32,
9013    /// Trading symbol, for example "BTC-USDT".
9014    ///
9015    /// Field 4: `symbol`
9016    #[serde(
9017        rename = "symbol",
9018        with = "::buffa::json_helpers::proto_string",
9019        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
9020    )]
9021    pub symbol: ::buffa::alloc::string::String,
9022    /// Current trigger lifecycle status.
9023    ///
9024    /// Field 5: `status`
9025    #[serde(
9026        rename = "status",
9027        with = "::buffa::json_helpers::proto_enum",
9028        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
9029    )]
9030    pub status: ::buffa::EnumValue<TriggerStatus>,
9031    /// Parent order ID for attached-risk triggers; empty for standalone triggers.
9032    ///
9033    /// Field 6: `parent_order_id`
9034    #[serde(
9035        rename = "parentOrderId",
9036        alias = "parent_order_id",
9037        with = "::buffa::json_helpers::opt_uint64",
9038        skip_serializing_if = "::core::option::Option::is_none"
9039    )]
9040    pub parent_order_id: ::core::option::Option<u64>,
9041    /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
9042    ///
9043    /// Field 20: `qty_scaled`
9044    #[serde(
9045        rename = "qtyScaled",
9046        alias = "qty_scaled",
9047        with = "::buffa::json_helpers::int64",
9048        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
9049    )]
9050    pub qty_scaled: i64,
9051    /// Fee asset for BUY child orders.
9052    ///
9053    /// Field 21: `fee_asset`
9054    #[serde(
9055        rename = "feeAsset",
9056        alias = "fee_asset",
9057        with = "::buffa::json_helpers::proto_enum",
9058        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
9059    )]
9060    pub fee_asset: ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
9061    /// Self-trade prevention mode for child orders.
9062    ///
9063    /// Field 22: `self_trade_prevention_mode`
9064    #[serde(
9065        rename = "selfTradePreventionMode",
9066        alias = "self_trade_prevention_mode",
9067        with = "::buffa::json_helpers::proto_enum",
9068        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
9069    )]
9070    pub self_trade_prevention_mode: ::buffa::EnumValue<
9071        super::super::orders::v1::SelfTradePreventionMode,
9072    >,
9073    /// Client-provided trigger ID for idempotency and correlation.
9074    ///
9075    /// Field 60: `client_trigger_id`
9076    #[serde(
9077        rename = "clientTriggerId",
9078        alias = "client_trigger_id",
9079        with = "::buffa::json_helpers::proto_string",
9080        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
9081    )]
9082    pub client_trigger_id: ::buffa::alloc::string::String,
9083    /// Creation timestamp.
9084    ///
9085    /// Field 61: `created_at`
9086    #[serde(
9087        rename = "createdAt",
9088        alias = "created_at",
9089        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9090    )]
9091    pub created_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9092    /// Last update timestamp.
9093    ///
9094    /// Field 62: `updated_at`
9095    #[serde(
9096        rename = "updatedAt",
9097        alias = "updated_at",
9098        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9099    )]
9100    pub updated_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9101    /// Timestamp when the trigger became armed.
9102    ///
9103    /// Field 63: `armed_at`
9104    #[serde(
9105        rename = "armedAt",
9106        alias = "armed_at",
9107        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9108    )]
9109    pub armed_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9110    /// Timestamp when the trigger reached a terminal successful state.
9111    ///
9112    /// Field 64: `completed_at`
9113    #[serde(
9114        rename = "completedAt",
9115        alias = "completed_at",
9116        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9117    )]
9118    pub completed_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9119    #[serde(flatten)]
9120    pub configuration: ::core::option::Option<__buffa::oneof::trigger::Configuration>,
9121    #[serde(flatten)]
9122    pub runtime_details: ::core::option::Option<__buffa::oneof::trigger::RuntimeDetails>,
9123    #[serde(skip)]
9124    #[doc(hidden)]
9125    pub __buffa_unknown_fields: ::buffa::UnknownFields,
9126}
9127impl ::core::fmt::Debug for Trigger {
9128    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9129        f.debug_struct("Trigger")
9130            .field("trigger_id", &self.trigger_id)
9131            .field("subaccount_id", &self.subaccount_id)
9132            .field("symbol_id", &self.symbol_id)
9133            .field("symbol", &self.symbol)
9134            .field("status", &self.status)
9135            .field("parent_order_id", &self.parent_order_id)
9136            .field("qty_scaled", &self.qty_scaled)
9137            .field("fee_asset", &self.fee_asset)
9138            .field("self_trade_prevention_mode", &self.self_trade_prevention_mode)
9139            .field("client_trigger_id", &self.client_trigger_id)
9140            .field("created_at", &self.created_at)
9141            .field("updated_at", &self.updated_at)
9142            .field("armed_at", &self.armed_at)
9143            .field("completed_at", &self.completed_at)
9144            .field("configuration", &self.configuration)
9145            .field("runtime_details", &self.runtime_details)
9146            .finish()
9147    }
9148}
9149impl Trigger {
9150    /// Protobuf type URL for this message, for use with `Any::pack` and
9151    /// `Any::unpack_if`.
9152    ///
9153    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
9154    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
9155}
9156impl Trigger {
9157    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9158    #[inline]
9159    ///Sets [`Self::parent_order_id`] to `Some(value)`, consuming and returning `self`.
9160    pub fn with_parent_order_id(mut self, value: u64) -> Self {
9161        self.parent_order_id = Some(value);
9162        self
9163    }
9164}
9165::buffa::impl_default_instance!(Trigger);
9166impl ::buffa::MessageName for Trigger {
9167    const PACKAGE: &'static str = "triggers.v1";
9168    const NAME: &'static str = "Trigger";
9169    const FULL_NAME: &'static str = "triggers.v1.Trigger";
9170    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
9171}
9172impl ::buffa::Message for Trigger {
9173    /// Returns the total encoded size in bytes.
9174    ///
9175    /// The result is a `u32`; the protobuf specification requires all
9176    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
9177    /// compliant message will never overflow this type.
9178    #[allow(clippy::let_and_return)]
9179    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
9180        #[allow(unused_imports)]
9181        use ::buffa::Enumeration as _;
9182        let mut size = 0u32;
9183        if self.trigger_id != 0u64 {
9184            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9185        }
9186        if self.subaccount_id != 0u64 {
9187            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9188        }
9189        if self.symbol_id != 0u32 {
9190            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
9191        }
9192        if !self.symbol.is_empty() {
9193            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
9194        }
9195        {
9196            let val = self.status.to_i32();
9197            if val != 0 {
9198                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
9199            }
9200        }
9201        if self.parent_order_id.is_some() {
9202            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9203        }
9204        if self.qty_scaled != 0i64 {
9205            size += 2u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
9206        }
9207        {
9208            let val = self.fee_asset.to_i32();
9209            if val != 0 {
9210                size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
9211            }
9212        }
9213        {
9214            let val = self.self_trade_prevention_mode.to_i32();
9215            if val != 0 {
9216                size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
9217            }
9218        }
9219        if let ::core::option::Option::Some(ref v) = self.configuration {
9220            match v {
9221                __buffa::oneof::trigger::Configuration::StopLoss(x) => {
9222                    let __slot = __cache.reserve();
9223                    let inner = x.compute_size(__cache);
9224                    __cache.set(__slot, inner);
9225                    size
9226                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9227                            + inner;
9228                }
9229                __buffa::oneof::trigger::Configuration::TakeProfit(x) => {
9230                    let __slot = __cache.reserve();
9231                    let inner = x.compute_size(__cache);
9232                    __cache.set(__slot, inner);
9233                    size
9234                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9235                            + inner;
9236                }
9237                __buffa::oneof::trigger::Configuration::TrailingStop(x) => {
9238                    let __slot = __cache.reserve();
9239                    let inner = x.compute_size(__cache);
9240                    __cache.set(__slot, inner);
9241                    size
9242                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9243                            + inner;
9244                }
9245                __buffa::oneof::trigger::Configuration::Twap(x) => {
9246                    let __slot = __cache.reserve();
9247                    let inner = x.compute_size(__cache);
9248                    __cache.set(__slot, inner);
9249                    size
9250                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9251                            + inner;
9252                }
9253                __buffa::oneof::trigger::Configuration::Ladder(x) => {
9254                    let __slot = __cache.reserve();
9255                    let inner = x.compute_size(__cache);
9256                    __cache.set(__slot, inner);
9257                    size
9258                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9259                            + inner;
9260                }
9261            }
9262        }
9263        if !self.client_trigger_id.is_empty() {
9264            size
9265                += 2u32
9266                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
9267        }
9268        if self.created_at.is_set() {
9269            let __slot = __cache.reserve();
9270            let inner_size = self.created_at.compute_size(__cache);
9271            __cache.set(__slot, inner_size);
9272            size
9273                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9274                    + inner_size;
9275        }
9276        if self.updated_at.is_set() {
9277            let __slot = __cache.reserve();
9278            let inner_size = self.updated_at.compute_size(__cache);
9279            __cache.set(__slot, inner_size);
9280            size
9281                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9282                    + inner_size;
9283        }
9284        if self.armed_at.is_set() {
9285            let __slot = __cache.reserve();
9286            let inner_size = self.armed_at.compute_size(__cache);
9287            __cache.set(__slot, inner_size);
9288            size
9289                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9290                    + inner_size;
9291        }
9292        if self.completed_at.is_set() {
9293            let __slot = __cache.reserve();
9294            let inner_size = self.completed_at.compute_size(__cache);
9295            __cache.set(__slot, inner_size);
9296            size
9297                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9298                    + inner_size;
9299        }
9300        if let ::core::option::Option::Some(ref v) = self.runtime_details {
9301            match v {
9302                __buffa::oneof::trigger::RuntimeDetails::Stop(x) => {
9303                    let __slot = __cache.reserve();
9304                    let inner = x.compute_size(__cache);
9305                    __cache.set(__slot, inner);
9306                    size
9307                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9308                            + inner;
9309                }
9310                __buffa::oneof::trigger::RuntimeDetails::Trailing(x) => {
9311                    let __slot = __cache.reserve();
9312                    let inner = x.compute_size(__cache);
9313                    __cache.set(__slot, inner);
9314                    size
9315                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9316                            + inner;
9317                }
9318                __buffa::oneof::trigger::RuntimeDetails::TwapState(x) => {
9319                    let __slot = __cache.reserve();
9320                    let inner = x.compute_size(__cache);
9321                    __cache.set(__slot, inner);
9322                    size
9323                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9324                            + inner;
9325                }
9326                __buffa::oneof::trigger::RuntimeDetails::LadderState(x) => {
9327                    let __slot = __cache.reserve();
9328                    let inner = x.compute_size(__cache);
9329                    __cache.set(__slot, inner);
9330                    size
9331                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9332                            + inner;
9333                }
9334            }
9335        }
9336        size += self.__buffa_unknown_fields.encoded_len() as u32;
9337        size
9338    }
9339    fn write_to(
9340        &self,
9341        __cache: &mut ::buffa::SizeCache,
9342        buf: &mut impl ::buffa::bytes::BufMut,
9343    ) {
9344        #[allow(unused_imports)]
9345        use ::buffa::Enumeration as _;
9346        if self.trigger_id != 0u64 {
9347            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
9348        }
9349        if self.subaccount_id != 0u64 {
9350            ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
9351        }
9352        if self.symbol_id != 0u32 {
9353            ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
9354        }
9355        if !self.symbol.is_empty() {
9356            ::buffa::types::put_string_field(4u32, &self.symbol, buf);
9357        }
9358        {
9359            let val = self.status.to_i32();
9360            if val != 0 {
9361                ::buffa::types::put_int32_field(5u32, val, buf);
9362            }
9363        }
9364        if let Some(v) = self.parent_order_id {
9365            ::buffa::types::put_fixed64_field(6u32, v, buf);
9366        }
9367        if self.qty_scaled != 0i64 {
9368            ::buffa::types::put_int64_field(20u32, self.qty_scaled, buf);
9369        }
9370        {
9371            let val = self.fee_asset.to_i32();
9372            if val != 0 {
9373                ::buffa::types::put_int32_field(21u32, val, buf);
9374            }
9375        }
9376        {
9377            let val = self.self_trade_prevention_mode.to_i32();
9378            if val != 0 {
9379                ::buffa::types::put_int32_field(22u32, val, buf);
9380            }
9381        }
9382        if let ::core::option::Option::Some(ref v) = self.configuration {
9383            match v {
9384                __buffa::oneof::trigger::Configuration::StopLoss(x) => {
9385                    ::buffa::types::put_len_delimited_header(
9386                        30u32,
9387                        __cache.consume_next(),
9388                        buf,
9389                    );
9390                    x.write_to(__cache, buf);
9391                }
9392                __buffa::oneof::trigger::Configuration::TakeProfit(x) => {
9393                    ::buffa::types::put_len_delimited_header(
9394                        31u32,
9395                        __cache.consume_next(),
9396                        buf,
9397                    );
9398                    x.write_to(__cache, buf);
9399                }
9400                __buffa::oneof::trigger::Configuration::TrailingStop(x) => {
9401                    ::buffa::types::put_len_delimited_header(
9402                        32u32,
9403                        __cache.consume_next(),
9404                        buf,
9405                    );
9406                    x.write_to(__cache, buf);
9407                }
9408                __buffa::oneof::trigger::Configuration::Twap(x) => {
9409                    ::buffa::types::put_len_delimited_header(
9410                        33u32,
9411                        __cache.consume_next(),
9412                        buf,
9413                    );
9414                    x.write_to(__cache, buf);
9415                }
9416                __buffa::oneof::trigger::Configuration::Ladder(x) => {
9417                    ::buffa::types::put_len_delimited_header(
9418                        34u32,
9419                        __cache.consume_next(),
9420                        buf,
9421                    );
9422                    x.write_to(__cache, buf);
9423                }
9424            }
9425        }
9426        if !self.client_trigger_id.is_empty() {
9427            ::buffa::types::put_string_field(60u32, &self.client_trigger_id, buf);
9428        }
9429        if self.created_at.is_set() {
9430            ::buffa::types::put_len_delimited_header(61u32, __cache.consume_next(), buf);
9431            self.created_at.write_to(__cache, buf);
9432        }
9433        if self.updated_at.is_set() {
9434            ::buffa::types::put_len_delimited_header(62u32, __cache.consume_next(), buf);
9435            self.updated_at.write_to(__cache, buf);
9436        }
9437        if self.armed_at.is_set() {
9438            ::buffa::types::put_len_delimited_header(63u32, __cache.consume_next(), buf);
9439            self.armed_at.write_to(__cache, buf);
9440        }
9441        if self.completed_at.is_set() {
9442            ::buffa::types::put_len_delimited_header(64u32, __cache.consume_next(), buf);
9443            self.completed_at.write_to(__cache, buf);
9444        }
9445        if let ::core::option::Option::Some(ref v) = self.runtime_details {
9446            match v {
9447                __buffa::oneof::trigger::RuntimeDetails::Stop(x) => {
9448                    ::buffa::types::put_len_delimited_header(
9449                        100u32,
9450                        __cache.consume_next(),
9451                        buf,
9452                    );
9453                    x.write_to(__cache, buf);
9454                }
9455                __buffa::oneof::trigger::RuntimeDetails::Trailing(x) => {
9456                    ::buffa::types::put_len_delimited_header(
9457                        101u32,
9458                        __cache.consume_next(),
9459                        buf,
9460                    );
9461                    x.write_to(__cache, buf);
9462                }
9463                __buffa::oneof::trigger::RuntimeDetails::TwapState(x) => {
9464                    ::buffa::types::put_len_delimited_header(
9465                        102u32,
9466                        __cache.consume_next(),
9467                        buf,
9468                    );
9469                    x.write_to(__cache, buf);
9470                }
9471                __buffa::oneof::trigger::RuntimeDetails::LadderState(x) => {
9472                    ::buffa::types::put_len_delimited_header(
9473                        103u32,
9474                        __cache.consume_next(),
9475                        buf,
9476                    );
9477                    x.write_to(__cache, buf);
9478                }
9479            }
9480        }
9481        self.__buffa_unknown_fields.write_to(buf);
9482    }
9483    fn merge_field(
9484        &mut self,
9485        tag: ::buffa::encoding::Tag,
9486        buf: &mut impl ::buffa::bytes::Buf,
9487        ctx: ::buffa::DecodeContext<'_>,
9488    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
9489        #[allow(unused_imports)]
9490        use ::buffa::bytes::Buf as _;
9491        #[allow(unused_imports)]
9492        use ::buffa::Enumeration as _;
9493        match tag.field_number() {
9494            1u32 => {
9495                ::buffa::encoding::check_wire_type(
9496                    tag,
9497                    ::buffa::encoding::WireType::Fixed64,
9498                )?;
9499                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
9500            }
9501            2u32 => {
9502                ::buffa::encoding::check_wire_type(
9503                    tag,
9504                    ::buffa::encoding::WireType::Fixed64,
9505                )?;
9506                self.subaccount_id = ::buffa::types::decode_fixed64(buf)?;
9507            }
9508            3u32 => {
9509                ::buffa::encoding::check_wire_type(
9510                    tag,
9511                    ::buffa::encoding::WireType::Varint,
9512                )?;
9513                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
9514            }
9515            4u32 => {
9516                ::buffa::encoding::check_wire_type(
9517                    tag,
9518                    ::buffa::encoding::WireType::LengthDelimited,
9519                )?;
9520                ::buffa::types::merge_string(&mut self.symbol, buf)?;
9521            }
9522            5u32 => {
9523                ::buffa::encoding::check_wire_type(
9524                    tag,
9525                    ::buffa::encoding::WireType::Varint,
9526                )?;
9527                self.status = ::buffa::EnumValue::from(
9528                    ::buffa::types::decode_int32(buf)?,
9529                );
9530            }
9531            6u32 => {
9532                ::buffa::encoding::check_wire_type(
9533                    tag,
9534                    ::buffa::encoding::WireType::Fixed64,
9535                )?;
9536                self.parent_order_id = ::core::option::Option::Some(
9537                    ::buffa::types::decode_fixed64(buf)?,
9538                );
9539            }
9540            20u32 => {
9541                ::buffa::encoding::check_wire_type(
9542                    tag,
9543                    ::buffa::encoding::WireType::Varint,
9544                )?;
9545                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
9546            }
9547            21u32 => {
9548                ::buffa::encoding::check_wire_type(
9549                    tag,
9550                    ::buffa::encoding::WireType::Varint,
9551                )?;
9552                self.fee_asset = ::buffa::EnumValue::from(
9553                    ::buffa::types::decode_int32(buf)?,
9554                );
9555            }
9556            22u32 => {
9557                ::buffa::encoding::check_wire_type(
9558                    tag,
9559                    ::buffa::encoding::WireType::Varint,
9560                )?;
9561                self.self_trade_prevention_mode = ::buffa::EnumValue::from(
9562                    ::buffa::types::decode_int32(buf)?,
9563                );
9564            }
9565            30u32 => {
9566                ::buffa::encoding::check_wire_type(
9567                    tag,
9568                    ::buffa::encoding::WireType::LengthDelimited,
9569                )?;
9570                if let ::core::option::Option::Some(
9571                    __buffa::oneof::trigger::Configuration::StopLoss(ref mut existing),
9572                ) = self.configuration
9573                {
9574                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9575                } else {
9576                    let mut val = ::core::default::Default::default();
9577                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9578                    self.configuration = ::core::option::Option::Some(
9579                        __buffa::oneof::trigger::Configuration::StopLoss(
9580                            ::buffa::alloc::boxed::Box::new(val),
9581                        ),
9582                    );
9583                }
9584            }
9585            31u32 => {
9586                ::buffa::encoding::check_wire_type(
9587                    tag,
9588                    ::buffa::encoding::WireType::LengthDelimited,
9589                )?;
9590                if let ::core::option::Option::Some(
9591                    __buffa::oneof::trigger::Configuration::TakeProfit(ref mut existing),
9592                ) = self.configuration
9593                {
9594                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9595                } else {
9596                    let mut val = ::core::default::Default::default();
9597                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9598                    self.configuration = ::core::option::Option::Some(
9599                        __buffa::oneof::trigger::Configuration::TakeProfit(
9600                            ::buffa::alloc::boxed::Box::new(val),
9601                        ),
9602                    );
9603                }
9604            }
9605            32u32 => {
9606                ::buffa::encoding::check_wire_type(
9607                    tag,
9608                    ::buffa::encoding::WireType::LengthDelimited,
9609                )?;
9610                if let ::core::option::Option::Some(
9611                    __buffa::oneof::trigger::Configuration::TrailingStop(
9612                        ref mut existing,
9613                    ),
9614                ) = self.configuration
9615                {
9616                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9617                } else {
9618                    let mut val = ::core::default::Default::default();
9619                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9620                    self.configuration = ::core::option::Option::Some(
9621                        __buffa::oneof::trigger::Configuration::TrailingStop(
9622                            ::buffa::alloc::boxed::Box::new(val),
9623                        ),
9624                    );
9625                }
9626            }
9627            33u32 => {
9628                ::buffa::encoding::check_wire_type(
9629                    tag,
9630                    ::buffa::encoding::WireType::LengthDelimited,
9631                )?;
9632                if let ::core::option::Option::Some(
9633                    __buffa::oneof::trigger::Configuration::Twap(ref mut existing),
9634                ) = self.configuration
9635                {
9636                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9637                } else {
9638                    let mut val = ::core::default::Default::default();
9639                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9640                    self.configuration = ::core::option::Option::Some(
9641                        __buffa::oneof::trigger::Configuration::Twap(
9642                            ::buffa::alloc::boxed::Box::new(val),
9643                        ),
9644                    );
9645                }
9646            }
9647            34u32 => {
9648                ::buffa::encoding::check_wire_type(
9649                    tag,
9650                    ::buffa::encoding::WireType::LengthDelimited,
9651                )?;
9652                if let ::core::option::Option::Some(
9653                    __buffa::oneof::trigger::Configuration::Ladder(ref mut existing),
9654                ) = self.configuration
9655                {
9656                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9657                } else {
9658                    let mut val = ::core::default::Default::default();
9659                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9660                    self.configuration = ::core::option::Option::Some(
9661                        __buffa::oneof::trigger::Configuration::Ladder(
9662                            ::buffa::alloc::boxed::Box::new(val),
9663                        ),
9664                    );
9665                }
9666            }
9667            60u32 => {
9668                ::buffa::encoding::check_wire_type(
9669                    tag,
9670                    ::buffa::encoding::WireType::LengthDelimited,
9671                )?;
9672                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
9673            }
9674            61u32 => {
9675                ::buffa::encoding::check_wire_type(
9676                    tag,
9677                    ::buffa::encoding::WireType::LengthDelimited,
9678                )?;
9679                ::buffa::Message::merge_length_delimited(
9680                    self.created_at.get_or_insert_default(),
9681                    buf,
9682                    ctx,
9683                )?;
9684            }
9685            62u32 => {
9686                ::buffa::encoding::check_wire_type(
9687                    tag,
9688                    ::buffa::encoding::WireType::LengthDelimited,
9689                )?;
9690                ::buffa::Message::merge_length_delimited(
9691                    self.updated_at.get_or_insert_default(),
9692                    buf,
9693                    ctx,
9694                )?;
9695            }
9696            63u32 => {
9697                ::buffa::encoding::check_wire_type(
9698                    tag,
9699                    ::buffa::encoding::WireType::LengthDelimited,
9700                )?;
9701                ::buffa::Message::merge_length_delimited(
9702                    self.armed_at.get_or_insert_default(),
9703                    buf,
9704                    ctx,
9705                )?;
9706            }
9707            64u32 => {
9708                ::buffa::encoding::check_wire_type(
9709                    tag,
9710                    ::buffa::encoding::WireType::LengthDelimited,
9711                )?;
9712                ::buffa::Message::merge_length_delimited(
9713                    self.completed_at.get_or_insert_default(),
9714                    buf,
9715                    ctx,
9716                )?;
9717            }
9718            100u32 => {
9719                ::buffa::encoding::check_wire_type(
9720                    tag,
9721                    ::buffa::encoding::WireType::LengthDelimited,
9722                )?;
9723                if let ::core::option::Option::Some(
9724                    __buffa::oneof::trigger::RuntimeDetails::Stop(ref mut existing),
9725                ) = self.runtime_details
9726                {
9727                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9728                } else {
9729                    let mut val = ::core::default::Default::default();
9730                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9731                    self.runtime_details = ::core::option::Option::Some(
9732                        __buffa::oneof::trigger::RuntimeDetails::Stop(
9733                            ::buffa::alloc::boxed::Box::new(val),
9734                        ),
9735                    );
9736                }
9737            }
9738            101u32 => {
9739                ::buffa::encoding::check_wire_type(
9740                    tag,
9741                    ::buffa::encoding::WireType::LengthDelimited,
9742                )?;
9743                if let ::core::option::Option::Some(
9744                    __buffa::oneof::trigger::RuntimeDetails::Trailing(ref mut existing),
9745                ) = self.runtime_details
9746                {
9747                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9748                } else {
9749                    let mut val = ::core::default::Default::default();
9750                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9751                    self.runtime_details = ::core::option::Option::Some(
9752                        __buffa::oneof::trigger::RuntimeDetails::Trailing(
9753                            ::buffa::alloc::boxed::Box::new(val),
9754                        ),
9755                    );
9756                }
9757            }
9758            102u32 => {
9759                ::buffa::encoding::check_wire_type(
9760                    tag,
9761                    ::buffa::encoding::WireType::LengthDelimited,
9762                )?;
9763                if let ::core::option::Option::Some(
9764                    __buffa::oneof::trigger::RuntimeDetails::TwapState(ref mut existing),
9765                ) = self.runtime_details
9766                {
9767                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9768                } else {
9769                    let mut val = ::core::default::Default::default();
9770                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9771                    self.runtime_details = ::core::option::Option::Some(
9772                        __buffa::oneof::trigger::RuntimeDetails::TwapState(
9773                            ::buffa::alloc::boxed::Box::new(val),
9774                        ),
9775                    );
9776                }
9777            }
9778            103u32 => {
9779                ::buffa::encoding::check_wire_type(
9780                    tag,
9781                    ::buffa::encoding::WireType::LengthDelimited,
9782                )?;
9783                if let ::core::option::Option::Some(
9784                    __buffa::oneof::trigger::RuntimeDetails::LadderState(
9785                        ref mut existing,
9786                    ),
9787                ) = self.runtime_details
9788                {
9789                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9790                } else {
9791                    let mut val = ::core::default::Default::default();
9792                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9793                    self.runtime_details = ::core::option::Option::Some(
9794                        __buffa::oneof::trigger::RuntimeDetails::LadderState(
9795                            ::buffa::alloc::boxed::Box::new(val),
9796                        ),
9797                    );
9798                }
9799            }
9800            _ => {
9801                self.__buffa_unknown_fields
9802                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
9803            }
9804        }
9805        ::core::result::Result::Ok(())
9806    }
9807    fn clear(&mut self) {
9808        self.trigger_id = 0u64;
9809        self.subaccount_id = 0u64;
9810        self.symbol_id = 0u32;
9811        self.symbol.clear();
9812        self.status = ::buffa::EnumValue::from(0);
9813        self.parent_order_id = ::core::option::Option::None;
9814        self.qty_scaled = 0i64;
9815        self.fee_asset = ::buffa::EnumValue::from(0);
9816        self.self_trade_prevention_mode = ::buffa::EnumValue::from(0);
9817        self.configuration = ::core::option::Option::None;
9818        self.client_trigger_id.clear();
9819        self.created_at = ::buffa::MessageField::none();
9820        self.updated_at = ::buffa::MessageField::none();
9821        self.armed_at = ::buffa::MessageField::none();
9822        self.completed_at = ::buffa::MessageField::none();
9823        self.runtime_details = ::core::option::Option::None;
9824        self.__buffa_unknown_fields.clear();
9825    }
9826}
9827impl ::buffa::ExtensionSet for Trigger {
9828    const PROTO_FQN: &'static str = "triggers.v1.Trigger";
9829    fn unknown_fields(&self) -> &::buffa::UnknownFields {
9830        &self.__buffa_unknown_fields
9831    }
9832    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
9833        &mut self.__buffa_unknown_fields
9834    }
9835}
9836impl<'de> serde::Deserialize<'de> for Trigger {
9837    fn deserialize<D: serde::Deserializer<'de>>(
9838        d: D,
9839    ) -> ::core::result::Result<Self, D::Error> {
9840        struct _V;
9841        impl<'de> serde::de::Visitor<'de> for _V {
9842            type Value = Trigger;
9843            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9844                f.write_str("struct Trigger")
9845            }
9846            #[allow(clippy::field_reassign_with_default)]
9847            fn visit_map<A: serde::de::MapAccess<'de>>(
9848                self,
9849                mut map: A,
9850            ) -> ::core::result::Result<Trigger, A::Error> {
9851                let mut __f_trigger_id: ::core::option::Option<u64> = None;
9852                let mut __f_subaccount_id: ::core::option::Option<u64> = None;
9853                let mut __f_symbol_id: ::core::option::Option<u32> = None;
9854                let mut __f_symbol: ::core::option::Option<
9855                    ::buffa::alloc::string::String,
9856                > = None;
9857                let mut __f_status: ::core::option::Option<
9858                    ::buffa::EnumValue<TriggerStatus>,
9859                > = None;
9860                let mut __f_parent_order_id: ::core::option::Option<
9861                    ::core::option::Option<u64>,
9862                > = None;
9863                let mut __f_qty_scaled: ::core::option::Option<i64> = None;
9864                let mut __f_fee_asset: ::core::option::Option<
9865                    ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
9866                > = None;
9867                let mut __f_self_trade_prevention_mode: ::core::option::Option<
9868                    ::buffa::EnumValue<super::super::orders::v1::SelfTradePreventionMode>,
9869                > = None;
9870                let mut __f_client_trigger_id: ::core::option::Option<
9871                    ::buffa::alloc::string::String,
9872                > = None;
9873                let mut __f_created_at: ::core::option::Option<
9874                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9875                > = None;
9876                let mut __f_updated_at: ::core::option::Option<
9877                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9878                > = None;
9879                let mut __f_armed_at: ::core::option::Option<
9880                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9881                > = None;
9882                let mut __f_completed_at: ::core::option::Option<
9883                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9884                > = None;
9885                let mut __oneof_configuration: ::core::option::Option<
9886                    __buffa::oneof::trigger::Configuration,
9887                > = None;
9888                let mut __oneof_runtime_details: ::core::option::Option<
9889                    __buffa::oneof::trigger::RuntimeDetails,
9890                > = None;
9891                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
9892                    match key.as_str() {
9893                        "triggerId" | "trigger_id" => {
9894                            __f_trigger_id = Some({
9895                                struct _S;
9896                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9897                                    type Value = u64;
9898                                    fn deserialize<D: serde::Deserializer<'de>>(
9899                                        self,
9900                                        d: D,
9901                                    ) -> ::core::result::Result<u64, D::Error> {
9902                                        ::buffa::json_helpers::uint64::deserialize(d)
9903                                    }
9904                                }
9905                                map.next_value_seed(_S)?
9906                            });
9907                        }
9908                        "subaccountId" | "subaccount_id" => {
9909                            __f_subaccount_id = Some({
9910                                struct _S;
9911                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9912                                    type Value = u64;
9913                                    fn deserialize<D: serde::Deserializer<'de>>(
9914                                        self,
9915                                        d: D,
9916                                    ) -> ::core::result::Result<u64, D::Error> {
9917                                        ::buffa::json_helpers::uint64::deserialize(d)
9918                                    }
9919                                }
9920                                map.next_value_seed(_S)?
9921                            });
9922                        }
9923                        "symbolId" | "symbol_id" => {
9924                            __f_symbol_id = Some({
9925                                struct _S;
9926                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9927                                    type Value = u32;
9928                                    fn deserialize<D: serde::Deserializer<'de>>(
9929                                        self,
9930                                        d: D,
9931                                    ) -> ::core::result::Result<u32, D::Error> {
9932                                        ::buffa::json_helpers::uint32::deserialize(d)
9933                                    }
9934                                }
9935                                map.next_value_seed(_S)?
9936                            });
9937                        }
9938                        "symbol" => {
9939                            __f_symbol = Some({
9940                                struct _S;
9941                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9942                                    type Value = ::buffa::alloc::string::String;
9943                                    fn deserialize<D: serde::Deserializer<'de>>(
9944                                        self,
9945                                        d: D,
9946                                    ) -> ::core::result::Result<
9947                                        ::buffa::alloc::string::String,
9948                                        D::Error,
9949                                    > {
9950                                        ::buffa::json_helpers::proto_string::deserialize(d)
9951                                    }
9952                                }
9953                                map.next_value_seed(_S)?
9954                            });
9955                        }
9956                        "status" => {
9957                            __f_status = Some({
9958                                struct _S;
9959                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9960                                    type Value = ::buffa::EnumValue<TriggerStatus>;
9961                                    fn deserialize<D: serde::Deserializer<'de>>(
9962                                        self,
9963                                        d: D,
9964                                    ) -> ::core::result::Result<
9965                                        ::buffa::EnumValue<TriggerStatus>,
9966                                        D::Error,
9967                                    > {
9968                                        ::buffa::json_helpers::proto_enum::deserialize(d)
9969                                    }
9970                                }
9971                                map.next_value_seed(_S)?
9972                            });
9973                        }
9974                        "parentOrderId" | "parent_order_id" => {
9975                            __f_parent_order_id = Some({
9976                                struct _S;
9977                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9978                                    type Value = ::core::option::Option<u64>;
9979                                    fn deserialize<D: serde::Deserializer<'de>>(
9980                                        self,
9981                                        d: D,
9982                                    ) -> ::core::result::Result<
9983                                        ::core::option::Option<u64>,
9984                                        D::Error,
9985                                    > {
9986                                        ::buffa::json_helpers::opt_uint64::deserialize(d)
9987                                    }
9988                                }
9989                                map.next_value_seed(_S)?
9990                            });
9991                        }
9992                        "qtyScaled" | "qty_scaled" => {
9993                            __f_qty_scaled = Some({
9994                                struct _S;
9995                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9996                                    type Value = i64;
9997                                    fn deserialize<D: serde::Deserializer<'de>>(
9998                                        self,
9999                                        d: D,
10000                                    ) -> ::core::result::Result<i64, D::Error> {
10001                                        ::buffa::json_helpers::int64::deserialize(d)
10002                                    }
10003                                }
10004                                map.next_value_seed(_S)?
10005                            });
10006                        }
10007                        "feeAsset" | "fee_asset" => {
10008                            __f_fee_asset = Some({
10009                                struct _S;
10010                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10011                                    type Value = ::buffa::EnumValue<
10012                                        super::super::orders::v1::FeeAsset,
10013                                    >;
10014                                    fn deserialize<D: serde::Deserializer<'de>>(
10015                                        self,
10016                                        d: D,
10017                                    ) -> ::core::result::Result<
10018                                        ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
10019                                        D::Error,
10020                                    > {
10021                                        ::buffa::json_helpers::proto_enum::deserialize(d)
10022                                    }
10023                                }
10024                                map.next_value_seed(_S)?
10025                            });
10026                        }
10027                        "selfTradePreventionMode" | "self_trade_prevention_mode" => {
10028                            __f_self_trade_prevention_mode = Some({
10029                                struct _S;
10030                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10031                                    type Value = ::buffa::EnumValue<
10032                                        super::super::orders::v1::SelfTradePreventionMode,
10033                                    >;
10034                                    fn deserialize<D: serde::Deserializer<'de>>(
10035                                        self,
10036                                        d: D,
10037                                    ) -> ::core::result::Result<
10038                                        ::buffa::EnumValue<
10039                                            super::super::orders::v1::SelfTradePreventionMode,
10040                                        >,
10041                                        D::Error,
10042                                    > {
10043                                        ::buffa::json_helpers::proto_enum::deserialize(d)
10044                                    }
10045                                }
10046                                map.next_value_seed(_S)?
10047                            });
10048                        }
10049                        "clientTriggerId" | "client_trigger_id" => {
10050                            __f_client_trigger_id = Some({
10051                                struct _S;
10052                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10053                                    type Value = ::buffa::alloc::string::String;
10054                                    fn deserialize<D: serde::Deserializer<'de>>(
10055                                        self,
10056                                        d: D,
10057                                    ) -> ::core::result::Result<
10058                                        ::buffa::alloc::string::String,
10059                                        D::Error,
10060                                    > {
10061                                        ::buffa::json_helpers::proto_string::deserialize(d)
10062                                    }
10063                                }
10064                                map.next_value_seed(_S)?
10065                            });
10066                        }
10067                        "createdAt" | "created_at" => {
10068                            __f_created_at = Some(
10069                                map
10070                                    .next_value::<
10071                                        ::buffa::MessageField<
10072                                            ::buffa_types::google::protobuf::Timestamp,
10073                                        >,
10074                                    >()?,
10075                            );
10076                        }
10077                        "updatedAt" | "updated_at" => {
10078                            __f_updated_at = Some(
10079                                map
10080                                    .next_value::<
10081                                        ::buffa::MessageField<
10082                                            ::buffa_types::google::protobuf::Timestamp,
10083                                        >,
10084                                    >()?,
10085                            );
10086                        }
10087                        "armedAt" | "armed_at" => {
10088                            __f_armed_at = Some(
10089                                map
10090                                    .next_value::<
10091                                        ::buffa::MessageField<
10092                                            ::buffa_types::google::protobuf::Timestamp,
10093                                        >,
10094                                    >()?,
10095                            );
10096                        }
10097                        "completedAt" | "completed_at" => {
10098                            __f_completed_at = Some(
10099                                map
10100                                    .next_value::<
10101                                        ::buffa::MessageField<
10102                                            ::buffa_types::google::protobuf::Timestamp,
10103                                        >,
10104                                    >()?,
10105                            );
10106                        }
10107                        "stopLoss" | "stop_loss" => {
10108                            let v: ::core::option::Option<ConditionalTrigger> = map
10109                                .next_value_seed(
10110                                    ::buffa::json_helpers::NullableDeserializeSeed(
10111                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10112                                            ConditionalTrigger,
10113                                        >::new(),
10114                                    ),
10115                                )?;
10116                            if let Some(v) = v {
10117                                if __oneof_configuration.is_some() {
10118                                    return Err(
10119                                        serde::de::Error::custom(
10120                                            "multiple oneof fields set for 'configuration'",
10121                                        ),
10122                                    );
10123                                }
10124                                __oneof_configuration = Some(
10125                                    __buffa::oneof::trigger::Configuration::StopLoss(
10126                                        ::buffa::alloc::boxed::Box::new(v),
10127                                    ),
10128                                );
10129                            }
10130                        }
10131                        "takeProfit" | "take_profit" => {
10132                            let v: ::core::option::Option<ConditionalTrigger> = map
10133                                .next_value_seed(
10134                                    ::buffa::json_helpers::NullableDeserializeSeed(
10135                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10136                                            ConditionalTrigger,
10137                                        >::new(),
10138                                    ),
10139                                )?;
10140                            if let Some(v) = v {
10141                                if __oneof_configuration.is_some() {
10142                                    return Err(
10143                                        serde::de::Error::custom(
10144                                            "multiple oneof fields set for 'configuration'",
10145                                        ),
10146                                    );
10147                                }
10148                                __oneof_configuration = Some(
10149                                    __buffa::oneof::trigger::Configuration::TakeProfit(
10150                                        ::buffa::alloc::boxed::Box::new(v),
10151                                    ),
10152                                );
10153                            }
10154                        }
10155                        "trailingStop" | "trailing_stop" => {
10156                            let v: ::core::option::Option<TrailingStopTrigger> = map
10157                                .next_value_seed(
10158                                    ::buffa::json_helpers::NullableDeserializeSeed(
10159                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10160                                            TrailingStopTrigger,
10161                                        >::new(),
10162                                    ),
10163                                )?;
10164                            if let Some(v) = v {
10165                                if __oneof_configuration.is_some() {
10166                                    return Err(
10167                                        serde::de::Error::custom(
10168                                            "multiple oneof fields set for 'configuration'",
10169                                        ),
10170                                    );
10171                                }
10172                                __oneof_configuration = Some(
10173                                    __buffa::oneof::trigger::Configuration::TrailingStop(
10174                                        ::buffa::alloc::boxed::Box::new(v),
10175                                    ),
10176                                );
10177                            }
10178                        }
10179                        "twap" => {
10180                            let v: ::core::option::Option<TwapTrigger> = map
10181                                .next_value_seed(
10182                                    ::buffa::json_helpers::NullableDeserializeSeed(
10183                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10184                                            TwapTrigger,
10185                                        >::new(),
10186                                    ),
10187                                )?;
10188                            if let Some(v) = v {
10189                                if __oneof_configuration.is_some() {
10190                                    return Err(
10191                                        serde::de::Error::custom(
10192                                            "multiple oneof fields set for 'configuration'",
10193                                        ),
10194                                    );
10195                                }
10196                                __oneof_configuration = Some(
10197                                    __buffa::oneof::trigger::Configuration::Twap(
10198                                        ::buffa::alloc::boxed::Box::new(v),
10199                                    ),
10200                                );
10201                            }
10202                        }
10203                        "ladder" => {
10204                            let v: ::core::option::Option<LadderTrigger> = map
10205                                .next_value_seed(
10206                                    ::buffa::json_helpers::NullableDeserializeSeed(
10207                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10208                                            LadderTrigger,
10209                                        >::new(),
10210                                    ),
10211                                )?;
10212                            if let Some(v) = v {
10213                                if __oneof_configuration.is_some() {
10214                                    return Err(
10215                                        serde::de::Error::custom(
10216                                            "multiple oneof fields set for 'configuration'",
10217                                        ),
10218                                    );
10219                                }
10220                                __oneof_configuration = Some(
10221                                    __buffa::oneof::trigger::Configuration::Ladder(
10222                                        ::buffa::alloc::boxed::Box::new(v),
10223                                    ),
10224                                );
10225                            }
10226                        }
10227                        "stop" => {
10228                            let v: ::core::option::Option<StopDetails> = map
10229                                .next_value_seed(
10230                                    ::buffa::json_helpers::NullableDeserializeSeed(
10231                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10232                                            StopDetails,
10233                                        >::new(),
10234                                    ),
10235                                )?;
10236                            if let Some(v) = v {
10237                                if __oneof_runtime_details.is_some() {
10238                                    return Err(
10239                                        serde::de::Error::custom(
10240                                            "multiple oneof fields set for 'runtime_details'",
10241                                        ),
10242                                    );
10243                                }
10244                                __oneof_runtime_details = Some(
10245                                    __buffa::oneof::trigger::RuntimeDetails::Stop(
10246                                        ::buffa::alloc::boxed::Box::new(v),
10247                                    ),
10248                                );
10249                            }
10250                        }
10251                        "trailing" => {
10252                            let v: ::core::option::Option<TrailingDetails> = map
10253                                .next_value_seed(
10254                                    ::buffa::json_helpers::NullableDeserializeSeed(
10255                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10256                                            TrailingDetails,
10257                                        >::new(),
10258                                    ),
10259                                )?;
10260                            if let Some(v) = v {
10261                                if __oneof_runtime_details.is_some() {
10262                                    return Err(
10263                                        serde::de::Error::custom(
10264                                            "multiple oneof fields set for 'runtime_details'",
10265                                        ),
10266                                    );
10267                                }
10268                                __oneof_runtime_details = Some(
10269                                    __buffa::oneof::trigger::RuntimeDetails::Trailing(
10270                                        ::buffa::alloc::boxed::Box::new(v),
10271                                    ),
10272                                );
10273                            }
10274                        }
10275                        "twapState" | "twap_state" => {
10276                            let v: ::core::option::Option<TwapDetails> = map
10277                                .next_value_seed(
10278                                    ::buffa::json_helpers::NullableDeserializeSeed(
10279                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10280                                            TwapDetails,
10281                                        >::new(),
10282                                    ),
10283                                )?;
10284                            if let Some(v) = v {
10285                                if __oneof_runtime_details.is_some() {
10286                                    return Err(
10287                                        serde::de::Error::custom(
10288                                            "multiple oneof fields set for 'runtime_details'",
10289                                        ),
10290                                    );
10291                                }
10292                                __oneof_runtime_details = Some(
10293                                    __buffa::oneof::trigger::RuntimeDetails::TwapState(
10294                                        ::buffa::alloc::boxed::Box::new(v),
10295                                    ),
10296                                );
10297                            }
10298                        }
10299                        "ladderState" | "ladder_state" => {
10300                            let v: ::core::option::Option<LadderDetails> = map
10301                                .next_value_seed(
10302                                    ::buffa::json_helpers::NullableDeserializeSeed(
10303                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10304                                            LadderDetails,
10305                                        >::new(),
10306                                    ),
10307                                )?;
10308                            if let Some(v) = v {
10309                                if __oneof_runtime_details.is_some() {
10310                                    return Err(
10311                                        serde::de::Error::custom(
10312                                            "multiple oneof fields set for 'runtime_details'",
10313                                        ),
10314                                    );
10315                                }
10316                                __oneof_runtime_details = Some(
10317                                    __buffa::oneof::trigger::RuntimeDetails::LadderState(
10318                                        ::buffa::alloc::boxed::Box::new(v),
10319                                    ),
10320                                );
10321                            }
10322                        }
10323                        _ => {
10324                            map.next_value::<serde::de::IgnoredAny>()?;
10325                        }
10326                    }
10327                }
10328                let mut __r = <Trigger as ::core::default::Default>::default();
10329                if let ::core::option::Option::Some(v) = __f_trigger_id {
10330                    __r.trigger_id = v;
10331                }
10332                if let ::core::option::Option::Some(v) = __f_subaccount_id {
10333                    __r.subaccount_id = v;
10334                }
10335                if let ::core::option::Option::Some(v) = __f_symbol_id {
10336                    __r.symbol_id = v;
10337                }
10338                if let ::core::option::Option::Some(v) = __f_symbol {
10339                    __r.symbol = v;
10340                }
10341                if let ::core::option::Option::Some(v) = __f_status {
10342                    __r.status = v;
10343                }
10344                if let ::core::option::Option::Some(v) = __f_parent_order_id {
10345                    __r.parent_order_id = v;
10346                }
10347                if let ::core::option::Option::Some(v) = __f_qty_scaled {
10348                    __r.qty_scaled = v;
10349                }
10350                if let ::core::option::Option::Some(v) = __f_fee_asset {
10351                    __r.fee_asset = v;
10352                }
10353                if let ::core::option::Option::Some(v) = __f_self_trade_prevention_mode {
10354                    __r.self_trade_prevention_mode = v;
10355                }
10356                if let ::core::option::Option::Some(v) = __f_client_trigger_id {
10357                    __r.client_trigger_id = v;
10358                }
10359                if let ::core::option::Option::Some(v) = __f_created_at {
10360                    __r.created_at = v;
10361                }
10362                if let ::core::option::Option::Some(v) = __f_updated_at {
10363                    __r.updated_at = v;
10364                }
10365                if let ::core::option::Option::Some(v) = __f_armed_at {
10366                    __r.armed_at = v;
10367                }
10368                if let ::core::option::Option::Some(v) = __f_completed_at {
10369                    __r.completed_at = v;
10370                }
10371                __r.configuration = __oneof_configuration;
10372                __r.runtime_details = __oneof_runtime_details;
10373                Ok(__r)
10374            }
10375        }
10376        d.deserialize_map(_V)
10377    }
10378}
10379impl ::buffa::json_helpers::ProtoElemJson for Trigger {
10380    fn serialize_proto_json<S: ::serde::Serializer>(
10381        v: &Self,
10382        s: S,
10383    ) -> ::core::result::Result<S::Ok, S::Error> {
10384        ::serde::Serialize::serialize(v, s)
10385    }
10386    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
10387        d: D,
10388    ) -> ::core::result::Result<Self, D::Error> {
10389        <Self as ::serde::Deserialize>::deserialize(d)
10390    }
10391}
10392#[doc(hidden)]
10393pub const __TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
10394    type_url: "type.googleapis.com/triggers.v1.Trigger",
10395    to_json: ::buffa::type_registry::any_to_json::<Trigger>,
10396    from_json: ::buffa::type_registry::any_from_json::<Trigger>,
10397    is_wkt: false,
10398};
10399pub mod trigger {
10400    #[allow(unused_imports)]
10401    use super::*;
10402    #[doc(inline)]
10403    pub use super::__buffa::oneof::trigger::Configuration;
10404    #[doc(inline)]
10405    pub use super::__buffa::oneof::trigger::RuntimeDetails;
10406    #[doc(inline)]
10407    pub use super::__buffa::view::oneof::trigger::Configuration as ConfigurationView;
10408    #[doc(inline)]
10409    pub use super::__buffa::view::oneof::trigger::RuntimeDetails as RuntimeDetailsView;
10410}
10411#[allow(
10412    non_camel_case_types,
10413    dead_code,
10414    unused_imports,
10415    unused_qualifications,
10416    clippy::derivable_impls,
10417    clippy::match_single_binding,
10418    clippy::uninlined_format_args,
10419    clippy::doc_lazy_continuation,
10420    clippy::module_inception
10421)]
10422pub mod __buffa {
10423    #[allow(unused_imports)]
10424    use super::*;
10425    pub mod view {
10426        #[allow(unused_imports)]
10427        use super::*;
10428        /// =============================================================================
10429        /// Create Trigger Request/Response
10430        /// =============================================================================
10431        ///
10432        /// TriggerMarketIoc configures an immediate market child.
10433        #[derive(Clone, Debug, Default)]
10434        pub struct TriggerMarketIocView<'a> {
10435            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10436        }
10437        impl<'a> ::buffa::MessageView<'a> for TriggerMarketIocView<'a> {
10438            type Owned = super::super::TriggerMarketIoc;
10439            fn decode_view(
10440                buf: &'a [u8],
10441            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10442                let __limit = ::core::cell::Cell::new(
10443                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10444                );
10445                <Self as ::buffa::MessageView>::decode_view_ctx(
10446                    buf,
10447                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10448                )
10449            }
10450            fn decode_view_with_ctx(
10451                buf: &'a [u8],
10452                ctx: ::buffa::DecodeContext<'_>,
10453            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10454                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10455            }
10456            fn merge_view_field(
10457                &mut self,
10458                tag: ::buffa::encoding::Tag,
10459                cur: &'a [u8],
10460                before_tag: &'a [u8],
10461                ctx: ::buffa::DecodeContext<'_>,
10462            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10463                let _ = ctx;
10464                #[allow(unused_variables)]
10465                let view = self;
10466                let mut cur = cur;
10467                match tag.field_number() {
10468                    _ => {
10469                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10470                        let span_len = before_tag.len() - cur.len();
10471                        view.__buffa_unknown_fields
10472                            .push_record(before_tag, span_len, ctx)?;
10473                    }
10474                }
10475                ::core::result::Result::Ok(cur)
10476            }
10477            fn to_owned_message(
10478                &self,
10479            ) -> ::core::result::Result<
10480                super::super::TriggerMarketIoc,
10481                ::buffa::DecodeError,
10482            > {
10483                self.to_owned_from_source(None)
10484            }
10485            #[allow(clippy::useless_conversion, clippy::needless_update)]
10486            fn to_owned_from_source(
10487                &self,
10488                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10489            ) -> ::core::result::Result<
10490                super::super::TriggerMarketIoc,
10491                ::buffa::DecodeError,
10492            > {
10493                #[allow(unused_imports)]
10494                use ::buffa::alloc::string::ToString as _;
10495                let _ = __buffa_src;
10496                ::core::result::Result::Ok(super::super::TriggerMarketIoc {
10497                    __buffa_unknown_fields: self
10498                        .__buffa_unknown_fields
10499                        .to_owned()?
10500                        .into(),
10501                    ..::core::default::Default::default()
10502                })
10503            }
10504        }
10505        impl<'a> ::buffa::ViewEncode<'a> for TriggerMarketIocView<'a> {
10506            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10507            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10508                #[allow(unused_imports)]
10509                use ::buffa::Enumeration as _;
10510                let mut size = 0u32;
10511                size += self.__buffa_unknown_fields.encoded_len() as u32;
10512                size
10513            }
10514            #[allow(clippy::needless_borrow)]
10515            fn write_to(
10516                &self,
10517                _cache: &mut ::buffa::SizeCache,
10518                buf: &mut impl ::buffa::bytes::BufMut,
10519            ) {
10520                #[allow(unused_imports)]
10521                use ::buffa::Enumeration as _;
10522                self.__buffa_unknown_fields.write_to(buf);
10523            }
10524        }
10525        /// Serializes this view as protobuf JSON.
10526        ///
10527        /// Implicit-presence fields with default values are omitted, `required`
10528        /// fields are always emitted, explicit-presence (`optional`) fields are
10529        /// emitted only when set, bytes fields are base64-encoded, and enum
10530        /// values are their proto name strings.
10531        ///
10532        /// This impl uses `serialize_map(None)` because the number of emitted
10533        /// fields depends on default-omission rules; serializers that require
10534        /// known map lengths (e.g. `bincode`) will return a runtime error.
10535        /// Use the owned message type for those formats.
10536        impl<'__a> ::serde::Serialize for TriggerMarketIocView<'__a> {
10537            fn serialize<__S: ::serde::Serializer>(
10538                &self,
10539                __s: __S,
10540            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10541                use ::serde::ser::SerializeMap as _;
10542                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10543                __map.end()
10544            }
10545        }
10546        impl<'a> ::buffa::MessageName for TriggerMarketIocView<'a> {
10547            const PACKAGE: &'static str = "triggers.v1";
10548            const NAME: &'static str = "TriggerMarketIoc";
10549            const FULL_NAME: &'static str = "triggers.v1.TriggerMarketIoc";
10550            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerMarketIoc";
10551        }
10552        ::buffa::impl_default_view_instance!(TriggerMarketIocView);
10553        ::buffa::impl_view_reborrow!(TriggerMarketIocView);
10554        /** Self-contained, `'static` owned view of a `TriggerMarketIoc` message.
10555
10556 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.
10557
10558 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.*/
10559        #[derive(Clone, Debug)]
10560        pub struct TriggerMarketIocOwnedView(
10561            ::buffa::OwnedView<TriggerMarketIocView<'static>>,
10562        );
10563        impl TriggerMarketIocOwnedView {
10564            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10565            ///
10566            /// The view borrows directly from the buffer's data; the buffer is
10567            /// retained inside the returned handle.
10568            ///
10569            /// # Errors
10570            ///
10571            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10572            /// protobuf data.
10573            pub fn decode(
10574                bytes: ::buffa::bytes::Bytes,
10575            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10576                ::core::result::Result::Ok(
10577                    TriggerMarketIocOwnedView(::buffa::OwnedView::decode(bytes)?),
10578                )
10579            }
10580            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10581            /// max message size).
10582            ///
10583            /// # Errors
10584            ///
10585            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10586            /// exceeds the configured limits.
10587            pub fn decode_with_options(
10588                bytes: ::buffa::bytes::Bytes,
10589                opts: &::buffa::DecodeOptions,
10590            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10591                ::core::result::Result::Ok(
10592                    TriggerMarketIocOwnedView(
10593                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10594                    ),
10595                )
10596            }
10597            /// Build from an owned message via an encode → decode round-trip.
10598            ///
10599            /// # Errors
10600            ///
10601            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10602            /// somehow invalid (should not happen for well-formed messages).
10603            pub fn from_owned(
10604                msg: &super::super::TriggerMarketIoc,
10605            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10606                ::core::result::Result::Ok(
10607                    TriggerMarketIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
10608                )
10609            }
10610            /// Borrow the full [`TriggerMarketIocView`] with its lifetime tied to `&self`.
10611            #[must_use]
10612            pub fn view(&self) -> &TriggerMarketIocView<'_> {
10613                self.0.reborrow()
10614            }
10615            /// Convert to the owned message type.
10616            ///
10617            /// # Errors
10618            ///
10619            /// Returns an error if re-materializing preserved unknown fields
10620            /// fails (e.g. the unknown-field limit is exceeded).
10621            pub fn to_owned_message(
10622                &self,
10623            ) -> ::core::result::Result<
10624                super::super::TriggerMarketIoc,
10625                ::buffa::DecodeError,
10626            > {
10627                self.0.to_owned_message()
10628            }
10629            /// The underlying bytes buffer.
10630            #[must_use]
10631            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10632                self.0.bytes()
10633            }
10634            /// Consume the handle, returning the underlying bytes buffer.
10635            #[must_use]
10636            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10637                self.0.into_bytes()
10638            }
10639        }
10640        impl ::core::convert::From<::buffa::OwnedView<TriggerMarketIocView<'static>>>
10641        for TriggerMarketIocOwnedView {
10642            fn from(inner: ::buffa::OwnedView<TriggerMarketIocView<'static>>) -> Self {
10643                TriggerMarketIocOwnedView(inner)
10644            }
10645        }
10646        impl ::core::convert::From<TriggerMarketIocOwnedView>
10647        for ::buffa::OwnedView<TriggerMarketIocView<'static>> {
10648            fn from(wrapper: TriggerMarketIocOwnedView) -> Self {
10649                wrapper.0
10650            }
10651        }
10652        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerMarketIocView<'static>>>
10653        for TriggerMarketIocOwnedView {
10654            fn as_ref(&self) -> &::buffa::OwnedView<TriggerMarketIocView<'static>> {
10655                &self.0
10656            }
10657        }
10658        impl ::buffa::HasMessageView for super::super::TriggerMarketIoc {
10659            type View<'a> = TriggerMarketIocView<'a>;
10660            type ViewHandle = TriggerMarketIocOwnedView;
10661        }
10662        impl ::serde::Serialize for TriggerMarketIocOwnedView {
10663            fn serialize<__S: ::serde::Serializer>(
10664                &self,
10665                __s: __S,
10666            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10667                ::serde::Serialize::serialize(&self.0, __s)
10668            }
10669        }
10670        /// TriggerLimitGtc configures a resting limit child.
10671        #[derive(Clone, Debug, Default)]
10672        pub struct TriggerLimitGtcView<'a> {
10673            /// Limit price in quote units scaled by 1e6.
10674            ///
10675            /// Field 1: `price_ticks`
10676            pub price_ticks: i64,
10677            /// Reject instead of taking liquidity.
10678            ///
10679            /// Field 2: `post_only`
10680            pub post_only: bool,
10681            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10682        }
10683        impl<'a> ::buffa::MessageView<'a> for TriggerLimitGtcView<'a> {
10684            type Owned = super::super::TriggerLimitGtc;
10685            fn decode_view(
10686                buf: &'a [u8],
10687            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10688                let __limit = ::core::cell::Cell::new(
10689                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10690                );
10691                <Self as ::buffa::MessageView>::decode_view_ctx(
10692                    buf,
10693                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10694                )
10695            }
10696            fn decode_view_with_ctx(
10697                buf: &'a [u8],
10698                ctx: ::buffa::DecodeContext<'_>,
10699            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10700                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10701            }
10702            fn merge_view_field(
10703                &mut self,
10704                tag: ::buffa::encoding::Tag,
10705                cur: &'a [u8],
10706                before_tag: &'a [u8],
10707                ctx: ::buffa::DecodeContext<'_>,
10708            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10709                let _ = ctx;
10710                #[allow(unused_variables)]
10711                let view = self;
10712                let mut cur = cur;
10713                match tag.field_number() {
10714                    1u32 => {
10715                        ::buffa::encoding::check_wire_type(
10716                            tag,
10717                            ::buffa::encoding::WireType::Varint,
10718                        )?;
10719                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
10720                    }
10721                    2u32 => {
10722                        ::buffa::encoding::check_wire_type(
10723                            tag,
10724                            ::buffa::encoding::WireType::Varint,
10725                        )?;
10726                        view.post_only = ::buffa::types::decode_bool(&mut cur)?;
10727                    }
10728                    _ => {
10729                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10730                        let span_len = before_tag.len() - cur.len();
10731                        view.__buffa_unknown_fields
10732                            .push_record(before_tag, span_len, ctx)?;
10733                    }
10734                }
10735                ::core::result::Result::Ok(cur)
10736            }
10737            fn to_owned_message(
10738                &self,
10739            ) -> ::core::result::Result<
10740                super::super::TriggerLimitGtc,
10741                ::buffa::DecodeError,
10742            > {
10743                self.to_owned_from_source(None)
10744            }
10745            #[allow(clippy::useless_conversion, clippy::needless_update)]
10746            fn to_owned_from_source(
10747                &self,
10748                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10749            ) -> ::core::result::Result<
10750                super::super::TriggerLimitGtc,
10751                ::buffa::DecodeError,
10752            > {
10753                #[allow(unused_imports)]
10754                use ::buffa::alloc::string::ToString as _;
10755                let _ = __buffa_src;
10756                ::core::result::Result::Ok(super::super::TriggerLimitGtc {
10757                    price_ticks: self.price_ticks,
10758                    post_only: self.post_only,
10759                    __buffa_unknown_fields: self
10760                        .__buffa_unknown_fields
10761                        .to_owned()?
10762                        .into(),
10763                    ..::core::default::Default::default()
10764                })
10765            }
10766        }
10767        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitGtcView<'a> {
10768            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10769            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10770                #[allow(unused_imports)]
10771                use ::buffa::Enumeration as _;
10772                let mut size = 0u32;
10773                if self.price_ticks != 0i64 {
10774                    size
10775                        += 1u32
10776                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
10777                }
10778                if self.post_only {
10779                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10780                }
10781                size += self.__buffa_unknown_fields.encoded_len() as u32;
10782                size
10783            }
10784            #[allow(clippy::needless_borrow)]
10785            fn write_to(
10786                &self,
10787                _cache: &mut ::buffa::SizeCache,
10788                buf: &mut impl ::buffa::bytes::BufMut,
10789            ) {
10790                #[allow(unused_imports)]
10791                use ::buffa::Enumeration as _;
10792                if self.price_ticks != 0i64 {
10793                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
10794                }
10795                if self.post_only {
10796                    ::buffa::types::put_bool_field(2u32, self.post_only, buf);
10797                }
10798                self.__buffa_unknown_fields.write_to(buf);
10799            }
10800        }
10801        /// Serializes this view as protobuf JSON.
10802        ///
10803        /// Implicit-presence fields with default values are omitted, `required`
10804        /// fields are always emitted, explicit-presence (`optional`) fields are
10805        /// emitted only when set, bytes fields are base64-encoded, and enum
10806        /// values are their proto name strings.
10807        ///
10808        /// This impl uses `serialize_map(None)` because the number of emitted
10809        /// fields depends on default-omission rules; serializers that require
10810        /// known map lengths (e.g. `bincode`) will return a runtime error.
10811        /// Use the owned message type for those formats.
10812        impl<'__a> ::serde::Serialize for TriggerLimitGtcView<'__a> {
10813            fn serialize<__S: ::serde::Serializer>(
10814                &self,
10815                __s: __S,
10816            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10817                use ::serde::ser::SerializeMap as _;
10818                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10819                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
10820                    __map
10821                        .serialize_entry(
10822                            "priceTicks",
10823                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
10824                        )?;
10825                }
10826                if self.post_only {
10827                    __map.serialize_entry("postOnly", &self.post_only)?;
10828                }
10829                __map.end()
10830            }
10831        }
10832        impl<'a> ::buffa::MessageName for TriggerLimitGtcView<'a> {
10833            const PACKAGE: &'static str = "triggers.v1";
10834            const NAME: &'static str = "TriggerLimitGtc";
10835            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitGtc";
10836            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitGtc";
10837        }
10838        ::buffa::impl_default_view_instance!(TriggerLimitGtcView);
10839        ::buffa::impl_view_reborrow!(TriggerLimitGtcView);
10840        /** Self-contained, `'static` owned view of a `TriggerLimitGtc` message.
10841
10842 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.
10843
10844 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.*/
10845        #[derive(Clone, Debug)]
10846        pub struct TriggerLimitGtcOwnedView(
10847            ::buffa::OwnedView<TriggerLimitGtcView<'static>>,
10848        );
10849        impl TriggerLimitGtcOwnedView {
10850            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10851            ///
10852            /// The view borrows directly from the buffer's data; the buffer is
10853            /// retained inside the returned handle.
10854            ///
10855            /// # Errors
10856            ///
10857            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10858            /// protobuf data.
10859            pub fn decode(
10860                bytes: ::buffa::bytes::Bytes,
10861            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10862                ::core::result::Result::Ok(
10863                    TriggerLimitGtcOwnedView(::buffa::OwnedView::decode(bytes)?),
10864                )
10865            }
10866            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10867            /// max message size).
10868            ///
10869            /// # Errors
10870            ///
10871            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10872            /// exceeds the configured limits.
10873            pub fn decode_with_options(
10874                bytes: ::buffa::bytes::Bytes,
10875                opts: &::buffa::DecodeOptions,
10876            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10877                ::core::result::Result::Ok(
10878                    TriggerLimitGtcOwnedView(
10879                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10880                    ),
10881                )
10882            }
10883            /// Build from an owned message via an encode → decode round-trip.
10884            ///
10885            /// # Errors
10886            ///
10887            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10888            /// somehow invalid (should not happen for well-formed messages).
10889            pub fn from_owned(
10890                msg: &super::super::TriggerLimitGtc,
10891            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10892                ::core::result::Result::Ok(
10893                    TriggerLimitGtcOwnedView(::buffa::OwnedView::from_owned(msg)?),
10894                )
10895            }
10896            /// Borrow the full [`TriggerLimitGtcView`] with its lifetime tied to `&self`.
10897            #[must_use]
10898            pub fn view(&self) -> &TriggerLimitGtcView<'_> {
10899                self.0.reborrow()
10900            }
10901            /// Convert to the owned message type.
10902            ///
10903            /// # Errors
10904            ///
10905            /// Returns an error if re-materializing preserved unknown fields
10906            /// fails (e.g. the unknown-field limit is exceeded).
10907            pub fn to_owned_message(
10908                &self,
10909            ) -> ::core::result::Result<
10910                super::super::TriggerLimitGtc,
10911                ::buffa::DecodeError,
10912            > {
10913                self.0.to_owned_message()
10914            }
10915            /// The underlying bytes buffer.
10916            #[must_use]
10917            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10918                self.0.bytes()
10919            }
10920            /// Consume the handle, returning the underlying bytes buffer.
10921            #[must_use]
10922            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10923                self.0.into_bytes()
10924            }
10925            /// Limit price in quote units scaled by 1e6.
10926            ///
10927            /// Field 1: `price_ticks`
10928            #[must_use]
10929            pub fn price_ticks(&self) -> i64 {
10930                self.0.reborrow().price_ticks
10931            }
10932            /// Reject instead of taking liquidity.
10933            ///
10934            /// Field 2: `post_only`
10935            #[must_use]
10936            pub fn post_only(&self) -> bool {
10937                self.0.reborrow().post_only
10938            }
10939        }
10940        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitGtcView<'static>>>
10941        for TriggerLimitGtcOwnedView {
10942            fn from(inner: ::buffa::OwnedView<TriggerLimitGtcView<'static>>) -> Self {
10943                TriggerLimitGtcOwnedView(inner)
10944            }
10945        }
10946        impl ::core::convert::From<TriggerLimitGtcOwnedView>
10947        for ::buffa::OwnedView<TriggerLimitGtcView<'static>> {
10948            fn from(wrapper: TriggerLimitGtcOwnedView) -> Self {
10949                wrapper.0
10950            }
10951        }
10952        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitGtcView<'static>>>
10953        for TriggerLimitGtcOwnedView {
10954            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitGtcView<'static>> {
10955                &self.0
10956            }
10957        }
10958        impl ::buffa::HasMessageView for super::super::TriggerLimitGtc {
10959            type View<'a> = TriggerLimitGtcView<'a>;
10960            type ViewHandle = TriggerLimitGtcOwnedView;
10961        }
10962        impl ::serde::Serialize for TriggerLimitGtcOwnedView {
10963            fn serialize<__S: ::serde::Serializer>(
10964                &self,
10965                __s: __S,
10966            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10967                ::serde::Serialize::serialize(&self.0, __s)
10968            }
10969        }
10970        /// TriggerLimitIoc configures an immediate-or-cancel limit child.
10971        #[derive(Clone, Debug, Default)]
10972        pub struct TriggerLimitIocView<'a> {
10973            /// Limit price in quote units scaled by 1e6.
10974            ///
10975            /// Field 1: `price_ticks`
10976            pub price_ticks: i64,
10977            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10978        }
10979        impl<'a> ::buffa::MessageView<'a> for TriggerLimitIocView<'a> {
10980            type Owned = super::super::TriggerLimitIoc;
10981            fn decode_view(
10982                buf: &'a [u8],
10983            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10984                let __limit = ::core::cell::Cell::new(
10985                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10986                );
10987                <Self as ::buffa::MessageView>::decode_view_ctx(
10988                    buf,
10989                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10990                )
10991            }
10992            fn decode_view_with_ctx(
10993                buf: &'a [u8],
10994                ctx: ::buffa::DecodeContext<'_>,
10995            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10996                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10997            }
10998            fn merge_view_field(
10999                &mut self,
11000                tag: ::buffa::encoding::Tag,
11001                cur: &'a [u8],
11002                before_tag: &'a [u8],
11003                ctx: ::buffa::DecodeContext<'_>,
11004            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11005                let _ = ctx;
11006                #[allow(unused_variables)]
11007                let view = self;
11008                let mut cur = cur;
11009                match tag.field_number() {
11010                    1u32 => {
11011                        ::buffa::encoding::check_wire_type(
11012                            tag,
11013                            ::buffa::encoding::WireType::Varint,
11014                        )?;
11015                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
11016                    }
11017                    _ => {
11018                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11019                        let span_len = before_tag.len() - cur.len();
11020                        view.__buffa_unknown_fields
11021                            .push_record(before_tag, span_len, ctx)?;
11022                    }
11023                }
11024                ::core::result::Result::Ok(cur)
11025            }
11026            fn to_owned_message(
11027                &self,
11028            ) -> ::core::result::Result<
11029                super::super::TriggerLimitIoc,
11030                ::buffa::DecodeError,
11031            > {
11032                self.to_owned_from_source(None)
11033            }
11034            #[allow(clippy::useless_conversion, clippy::needless_update)]
11035            fn to_owned_from_source(
11036                &self,
11037                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11038            ) -> ::core::result::Result<
11039                super::super::TriggerLimitIoc,
11040                ::buffa::DecodeError,
11041            > {
11042                #[allow(unused_imports)]
11043                use ::buffa::alloc::string::ToString as _;
11044                let _ = __buffa_src;
11045                ::core::result::Result::Ok(super::super::TriggerLimitIoc {
11046                    price_ticks: self.price_ticks,
11047                    __buffa_unknown_fields: self
11048                        .__buffa_unknown_fields
11049                        .to_owned()?
11050                        .into(),
11051                    ..::core::default::Default::default()
11052                })
11053            }
11054        }
11055        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitIocView<'a> {
11056            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11057            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11058                #[allow(unused_imports)]
11059                use ::buffa::Enumeration as _;
11060                let mut size = 0u32;
11061                if self.price_ticks != 0i64 {
11062                    size
11063                        += 1u32
11064                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
11065                }
11066                size += self.__buffa_unknown_fields.encoded_len() as u32;
11067                size
11068            }
11069            #[allow(clippy::needless_borrow)]
11070            fn write_to(
11071                &self,
11072                _cache: &mut ::buffa::SizeCache,
11073                buf: &mut impl ::buffa::bytes::BufMut,
11074            ) {
11075                #[allow(unused_imports)]
11076                use ::buffa::Enumeration as _;
11077                if self.price_ticks != 0i64 {
11078                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
11079                }
11080                self.__buffa_unknown_fields.write_to(buf);
11081            }
11082        }
11083        /// Serializes this view as protobuf JSON.
11084        ///
11085        /// Implicit-presence fields with default values are omitted, `required`
11086        /// fields are always emitted, explicit-presence (`optional`) fields are
11087        /// emitted only when set, bytes fields are base64-encoded, and enum
11088        /// values are their proto name strings.
11089        ///
11090        /// This impl uses `serialize_map(None)` because the number of emitted
11091        /// fields depends on default-omission rules; serializers that require
11092        /// known map lengths (e.g. `bincode`) will return a runtime error.
11093        /// Use the owned message type for those formats.
11094        impl<'__a> ::serde::Serialize for TriggerLimitIocView<'__a> {
11095            fn serialize<__S: ::serde::Serializer>(
11096                &self,
11097                __s: __S,
11098            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11099                use ::serde::ser::SerializeMap as _;
11100                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11101                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
11102                    __map
11103                        .serialize_entry(
11104                            "priceTicks",
11105                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
11106                        )?;
11107                }
11108                __map.end()
11109            }
11110        }
11111        impl<'a> ::buffa::MessageName for TriggerLimitIocView<'a> {
11112            const PACKAGE: &'static str = "triggers.v1";
11113            const NAME: &'static str = "TriggerLimitIoc";
11114            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitIoc";
11115            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitIoc";
11116        }
11117        ::buffa::impl_default_view_instance!(TriggerLimitIocView);
11118        ::buffa::impl_view_reborrow!(TriggerLimitIocView);
11119        /** Self-contained, `'static` owned view of a `TriggerLimitIoc` message.
11120
11121 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.
11122
11123 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.*/
11124        #[derive(Clone, Debug)]
11125        pub struct TriggerLimitIocOwnedView(
11126            ::buffa::OwnedView<TriggerLimitIocView<'static>>,
11127        );
11128        impl TriggerLimitIocOwnedView {
11129            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11130            ///
11131            /// The view borrows directly from the buffer's data; the buffer is
11132            /// retained inside the returned handle.
11133            ///
11134            /// # Errors
11135            ///
11136            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11137            /// protobuf data.
11138            pub fn decode(
11139                bytes: ::buffa::bytes::Bytes,
11140            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11141                ::core::result::Result::Ok(
11142                    TriggerLimitIocOwnedView(::buffa::OwnedView::decode(bytes)?),
11143                )
11144            }
11145            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11146            /// max message size).
11147            ///
11148            /// # Errors
11149            ///
11150            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11151            /// exceeds the configured limits.
11152            pub fn decode_with_options(
11153                bytes: ::buffa::bytes::Bytes,
11154                opts: &::buffa::DecodeOptions,
11155            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11156                ::core::result::Result::Ok(
11157                    TriggerLimitIocOwnedView(
11158                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11159                    ),
11160                )
11161            }
11162            /// Build from an owned message via an encode → decode round-trip.
11163            ///
11164            /// # Errors
11165            ///
11166            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11167            /// somehow invalid (should not happen for well-formed messages).
11168            pub fn from_owned(
11169                msg: &super::super::TriggerLimitIoc,
11170            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11171                ::core::result::Result::Ok(
11172                    TriggerLimitIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
11173                )
11174            }
11175            /// Borrow the full [`TriggerLimitIocView`] with its lifetime tied to `&self`.
11176            #[must_use]
11177            pub fn view(&self) -> &TriggerLimitIocView<'_> {
11178                self.0.reborrow()
11179            }
11180            /// Convert to the owned message type.
11181            ///
11182            /// # Errors
11183            ///
11184            /// Returns an error if re-materializing preserved unknown fields
11185            /// fails (e.g. the unknown-field limit is exceeded).
11186            pub fn to_owned_message(
11187                &self,
11188            ) -> ::core::result::Result<
11189                super::super::TriggerLimitIoc,
11190                ::buffa::DecodeError,
11191            > {
11192                self.0.to_owned_message()
11193            }
11194            /// The underlying bytes buffer.
11195            #[must_use]
11196            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11197                self.0.bytes()
11198            }
11199            /// Consume the handle, returning the underlying bytes buffer.
11200            #[must_use]
11201            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11202                self.0.into_bytes()
11203            }
11204            /// Limit price in quote units scaled by 1e6.
11205            ///
11206            /// Field 1: `price_ticks`
11207            #[must_use]
11208            pub fn price_ticks(&self) -> i64 {
11209                self.0.reborrow().price_ticks
11210            }
11211        }
11212        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitIocView<'static>>>
11213        for TriggerLimitIocOwnedView {
11214            fn from(inner: ::buffa::OwnedView<TriggerLimitIocView<'static>>) -> Self {
11215                TriggerLimitIocOwnedView(inner)
11216            }
11217        }
11218        impl ::core::convert::From<TriggerLimitIocOwnedView>
11219        for ::buffa::OwnedView<TriggerLimitIocView<'static>> {
11220            fn from(wrapper: TriggerLimitIocOwnedView) -> Self {
11221                wrapper.0
11222            }
11223        }
11224        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitIocView<'static>>>
11225        for TriggerLimitIocOwnedView {
11226            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitIocView<'static>> {
11227                &self.0
11228            }
11229        }
11230        impl ::buffa::HasMessageView for super::super::TriggerLimitIoc {
11231            type View<'a> = TriggerLimitIocView<'a>;
11232            type ViewHandle = TriggerLimitIocOwnedView;
11233        }
11234        impl ::serde::Serialize for TriggerLimitIocOwnedView {
11235            fn serialize<__S: ::serde::Serializer>(
11236                &self,
11237                __s: __S,
11238            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11239                ::serde::Serialize::serialize(&self.0, __s)
11240            }
11241        }
11242        /// TriggerLimitFok configures a fill-or-kill limit child.
11243        #[derive(Clone, Debug, Default)]
11244        pub struct TriggerLimitFokView<'a> {
11245            /// Limit price in quote units scaled by 1e6.
11246            ///
11247            /// Field 1: `price_ticks`
11248            pub price_ticks: i64,
11249            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11250        }
11251        impl<'a> ::buffa::MessageView<'a> for TriggerLimitFokView<'a> {
11252            type Owned = super::super::TriggerLimitFok;
11253            fn decode_view(
11254                buf: &'a [u8],
11255            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11256                let __limit = ::core::cell::Cell::new(
11257                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11258                );
11259                <Self as ::buffa::MessageView>::decode_view_ctx(
11260                    buf,
11261                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11262                )
11263            }
11264            fn decode_view_with_ctx(
11265                buf: &'a [u8],
11266                ctx: ::buffa::DecodeContext<'_>,
11267            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11268                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11269            }
11270            fn merge_view_field(
11271                &mut self,
11272                tag: ::buffa::encoding::Tag,
11273                cur: &'a [u8],
11274                before_tag: &'a [u8],
11275                ctx: ::buffa::DecodeContext<'_>,
11276            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11277                let _ = ctx;
11278                #[allow(unused_variables)]
11279                let view = self;
11280                let mut cur = cur;
11281                match tag.field_number() {
11282                    1u32 => {
11283                        ::buffa::encoding::check_wire_type(
11284                            tag,
11285                            ::buffa::encoding::WireType::Varint,
11286                        )?;
11287                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
11288                    }
11289                    _ => {
11290                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11291                        let span_len = before_tag.len() - cur.len();
11292                        view.__buffa_unknown_fields
11293                            .push_record(before_tag, span_len, ctx)?;
11294                    }
11295                }
11296                ::core::result::Result::Ok(cur)
11297            }
11298            fn to_owned_message(
11299                &self,
11300            ) -> ::core::result::Result<
11301                super::super::TriggerLimitFok,
11302                ::buffa::DecodeError,
11303            > {
11304                self.to_owned_from_source(None)
11305            }
11306            #[allow(clippy::useless_conversion, clippy::needless_update)]
11307            fn to_owned_from_source(
11308                &self,
11309                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11310            ) -> ::core::result::Result<
11311                super::super::TriggerLimitFok,
11312                ::buffa::DecodeError,
11313            > {
11314                #[allow(unused_imports)]
11315                use ::buffa::alloc::string::ToString as _;
11316                let _ = __buffa_src;
11317                ::core::result::Result::Ok(super::super::TriggerLimitFok {
11318                    price_ticks: self.price_ticks,
11319                    __buffa_unknown_fields: self
11320                        .__buffa_unknown_fields
11321                        .to_owned()?
11322                        .into(),
11323                    ..::core::default::Default::default()
11324                })
11325            }
11326        }
11327        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitFokView<'a> {
11328            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11329            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11330                #[allow(unused_imports)]
11331                use ::buffa::Enumeration as _;
11332                let mut size = 0u32;
11333                if self.price_ticks != 0i64 {
11334                    size
11335                        += 1u32
11336                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
11337                }
11338                size += self.__buffa_unknown_fields.encoded_len() as u32;
11339                size
11340            }
11341            #[allow(clippy::needless_borrow)]
11342            fn write_to(
11343                &self,
11344                _cache: &mut ::buffa::SizeCache,
11345                buf: &mut impl ::buffa::bytes::BufMut,
11346            ) {
11347                #[allow(unused_imports)]
11348                use ::buffa::Enumeration as _;
11349                if self.price_ticks != 0i64 {
11350                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
11351                }
11352                self.__buffa_unknown_fields.write_to(buf);
11353            }
11354        }
11355        /// Serializes this view as protobuf JSON.
11356        ///
11357        /// Implicit-presence fields with default values are omitted, `required`
11358        /// fields are always emitted, explicit-presence (`optional`) fields are
11359        /// emitted only when set, bytes fields are base64-encoded, and enum
11360        /// values are their proto name strings.
11361        ///
11362        /// This impl uses `serialize_map(None)` because the number of emitted
11363        /// fields depends on default-omission rules; serializers that require
11364        /// known map lengths (e.g. `bincode`) will return a runtime error.
11365        /// Use the owned message type for those formats.
11366        impl<'__a> ::serde::Serialize for TriggerLimitFokView<'__a> {
11367            fn serialize<__S: ::serde::Serializer>(
11368                &self,
11369                __s: __S,
11370            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11371                use ::serde::ser::SerializeMap as _;
11372                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11373                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
11374                    __map
11375                        .serialize_entry(
11376                            "priceTicks",
11377                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
11378                        )?;
11379                }
11380                __map.end()
11381            }
11382        }
11383        impl<'a> ::buffa::MessageName for TriggerLimitFokView<'a> {
11384            const PACKAGE: &'static str = "triggers.v1";
11385            const NAME: &'static str = "TriggerLimitFok";
11386            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitFok";
11387            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitFok";
11388        }
11389        ::buffa::impl_default_view_instance!(TriggerLimitFokView);
11390        ::buffa::impl_view_reborrow!(TriggerLimitFokView);
11391        /** Self-contained, `'static` owned view of a `TriggerLimitFok` message.
11392
11393 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.
11394
11395 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.*/
11396        #[derive(Clone, Debug)]
11397        pub struct TriggerLimitFokOwnedView(
11398            ::buffa::OwnedView<TriggerLimitFokView<'static>>,
11399        );
11400        impl TriggerLimitFokOwnedView {
11401            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11402            ///
11403            /// The view borrows directly from the buffer's data; the buffer is
11404            /// retained inside the returned handle.
11405            ///
11406            /// # Errors
11407            ///
11408            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11409            /// protobuf data.
11410            pub fn decode(
11411                bytes: ::buffa::bytes::Bytes,
11412            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11413                ::core::result::Result::Ok(
11414                    TriggerLimitFokOwnedView(::buffa::OwnedView::decode(bytes)?),
11415                )
11416            }
11417            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11418            /// max message size).
11419            ///
11420            /// # Errors
11421            ///
11422            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11423            /// exceeds the configured limits.
11424            pub fn decode_with_options(
11425                bytes: ::buffa::bytes::Bytes,
11426                opts: &::buffa::DecodeOptions,
11427            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11428                ::core::result::Result::Ok(
11429                    TriggerLimitFokOwnedView(
11430                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11431                    ),
11432                )
11433            }
11434            /// Build from an owned message via an encode → decode round-trip.
11435            ///
11436            /// # Errors
11437            ///
11438            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11439            /// somehow invalid (should not happen for well-formed messages).
11440            pub fn from_owned(
11441                msg: &super::super::TriggerLimitFok,
11442            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11443                ::core::result::Result::Ok(
11444                    TriggerLimitFokOwnedView(::buffa::OwnedView::from_owned(msg)?),
11445                )
11446            }
11447            /// Borrow the full [`TriggerLimitFokView`] with its lifetime tied to `&self`.
11448            #[must_use]
11449            pub fn view(&self) -> &TriggerLimitFokView<'_> {
11450                self.0.reborrow()
11451            }
11452            /// Convert to the owned message type.
11453            ///
11454            /// # Errors
11455            ///
11456            /// Returns an error if re-materializing preserved unknown fields
11457            /// fails (e.g. the unknown-field limit is exceeded).
11458            pub fn to_owned_message(
11459                &self,
11460            ) -> ::core::result::Result<
11461                super::super::TriggerLimitFok,
11462                ::buffa::DecodeError,
11463            > {
11464                self.0.to_owned_message()
11465            }
11466            /// The underlying bytes buffer.
11467            #[must_use]
11468            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11469                self.0.bytes()
11470            }
11471            /// Consume the handle, returning the underlying bytes buffer.
11472            #[must_use]
11473            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11474                self.0.into_bytes()
11475            }
11476            /// Limit price in quote units scaled by 1e6.
11477            ///
11478            /// Field 1: `price_ticks`
11479            #[must_use]
11480            pub fn price_ticks(&self) -> i64 {
11481                self.0.reborrow().price_ticks
11482            }
11483        }
11484        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitFokView<'static>>>
11485        for TriggerLimitFokOwnedView {
11486            fn from(inner: ::buffa::OwnedView<TriggerLimitFokView<'static>>) -> Self {
11487                TriggerLimitFokOwnedView(inner)
11488            }
11489        }
11490        impl ::core::convert::From<TriggerLimitFokOwnedView>
11491        for ::buffa::OwnedView<TriggerLimitFokView<'static>> {
11492            fn from(wrapper: TriggerLimitFokOwnedView) -> Self {
11493                wrapper.0
11494            }
11495        }
11496        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitFokView<'static>>>
11497        for TriggerLimitFokOwnedView {
11498            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitFokView<'static>> {
11499                &self.0
11500            }
11501        }
11502        impl ::buffa::HasMessageView for super::super::TriggerLimitFok {
11503            type View<'a> = TriggerLimitFokView<'a>;
11504            type ViewHandle = TriggerLimitFokOwnedView;
11505        }
11506        impl ::serde::Serialize for TriggerLimitFokOwnedView {
11507            fn serialize<__S: ::serde::Serializer>(
11508                &self,
11509                __s: __S,
11510            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11511                ::serde::Serialize::serialize(&self.0, __s)
11512            }
11513        }
11514        /// ConditionalChildExecution selects the child submitted by a stop-loss or
11515        /// take-profit trigger. BUY market children are not supported in spot.
11516        #[derive(Clone, Debug, Default)]
11517        pub struct ConditionalChildExecutionView<'a> {
11518            pub execution: ::core::option::Option<
11519                super::super::__buffa::view::oneof::conditional_child_execution::Execution<
11520                    'a,
11521                >,
11522            >,
11523            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11524        }
11525        impl<'a> ::buffa::MessageView<'a> for ConditionalChildExecutionView<'a> {
11526            type Owned = super::super::ConditionalChildExecution;
11527            fn decode_view(
11528                buf: &'a [u8],
11529            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11530                let __limit = ::core::cell::Cell::new(
11531                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11532                );
11533                <Self as ::buffa::MessageView>::decode_view_ctx(
11534                    buf,
11535                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11536                )
11537            }
11538            fn decode_view_with_ctx(
11539                buf: &'a [u8],
11540                ctx: ::buffa::DecodeContext<'_>,
11541            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11542                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11543            }
11544            fn merge_view_field(
11545                &mut self,
11546                tag: ::buffa::encoding::Tag,
11547                cur: &'a [u8],
11548                before_tag: &'a [u8],
11549                ctx: ::buffa::DecodeContext<'_>,
11550            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11551                let _ = ctx;
11552                #[allow(unused_variables)]
11553                let view = self;
11554                let mut cur = cur;
11555                match tag.field_number() {
11556                    1u32 => {
11557                        ::buffa::encoding::check_wire_type(
11558                            tag,
11559                            ::buffa::encoding::WireType::LengthDelimited,
11560                        )?;
11561                        let __sub_ctx = ctx.descend()?;
11562                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11563                        if let Some(
11564                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11565                                ref mut existing,
11566                            ),
11567                        ) = view.execution
11568                        {
11569                            ::buffa::MessageView::merge_into_view(
11570                                &mut **existing,
11571                                sub,
11572                                __sub_ctx,
11573                            )?;
11574                        } else {
11575                            view.execution = Some(
11576                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11577                                    ::buffa::alloc::boxed::Box::new(
11578                                        <super::super::__buffa::view::TriggerMarketIocView as ::buffa::MessageView>::decode_view_ctx(
11579                                            sub,
11580                                            __sub_ctx,
11581                                        )?,
11582                                    ),
11583                                ),
11584                            );
11585                        }
11586                    }
11587                    2u32 => {
11588                        ::buffa::encoding::check_wire_type(
11589                            tag,
11590                            ::buffa::encoding::WireType::LengthDelimited,
11591                        )?;
11592                        let __sub_ctx = ctx.descend()?;
11593                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11594                        if let Some(
11595                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11596                                ref mut existing,
11597                            ),
11598                        ) = view.execution
11599                        {
11600                            ::buffa::MessageView::merge_into_view(
11601                                &mut **existing,
11602                                sub,
11603                                __sub_ctx,
11604                            )?;
11605                        } else {
11606                            view.execution = Some(
11607                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11608                                    ::buffa::alloc::boxed::Box::new(
11609                                        <super::super::__buffa::view::TriggerLimitGtcView as ::buffa::MessageView>::decode_view_ctx(
11610                                            sub,
11611                                            __sub_ctx,
11612                                        )?,
11613                                    ),
11614                                ),
11615                            );
11616                        }
11617                    }
11618                    3u32 => {
11619                        ::buffa::encoding::check_wire_type(
11620                            tag,
11621                            ::buffa::encoding::WireType::LengthDelimited,
11622                        )?;
11623                        let __sub_ctx = ctx.descend()?;
11624                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11625                        if let Some(
11626                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11627                                ref mut existing,
11628                            ),
11629                        ) = view.execution
11630                        {
11631                            ::buffa::MessageView::merge_into_view(
11632                                &mut **existing,
11633                                sub,
11634                                __sub_ctx,
11635                            )?;
11636                        } else {
11637                            view.execution = Some(
11638                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11639                                    ::buffa::alloc::boxed::Box::new(
11640                                        <super::super::__buffa::view::TriggerLimitIocView as ::buffa::MessageView>::decode_view_ctx(
11641                                            sub,
11642                                            __sub_ctx,
11643                                        )?,
11644                                    ),
11645                                ),
11646                            );
11647                        }
11648                    }
11649                    4u32 => {
11650                        ::buffa::encoding::check_wire_type(
11651                            tag,
11652                            ::buffa::encoding::WireType::LengthDelimited,
11653                        )?;
11654                        let __sub_ctx = ctx.descend()?;
11655                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11656                        if let Some(
11657                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11658                                ref mut existing,
11659                            ),
11660                        ) = view.execution
11661                        {
11662                            ::buffa::MessageView::merge_into_view(
11663                                &mut **existing,
11664                                sub,
11665                                __sub_ctx,
11666                            )?;
11667                        } else {
11668                            view.execution = Some(
11669                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11670                                    ::buffa::alloc::boxed::Box::new(
11671                                        <super::super::__buffa::view::TriggerLimitFokView as ::buffa::MessageView>::decode_view_ctx(
11672                                            sub,
11673                                            __sub_ctx,
11674                                        )?,
11675                                    ),
11676                                ),
11677                            );
11678                        }
11679                    }
11680                    _ => {
11681                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11682                        let span_len = before_tag.len() - cur.len();
11683                        view.__buffa_unknown_fields
11684                            .push_record(before_tag, span_len, ctx)?;
11685                    }
11686                }
11687                ::core::result::Result::Ok(cur)
11688            }
11689            fn to_owned_message(
11690                &self,
11691            ) -> ::core::result::Result<
11692                super::super::ConditionalChildExecution,
11693                ::buffa::DecodeError,
11694            > {
11695                self.to_owned_from_source(None)
11696            }
11697            #[allow(clippy::useless_conversion, clippy::needless_update)]
11698            fn to_owned_from_source(
11699                &self,
11700                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11701            ) -> ::core::result::Result<
11702                super::super::ConditionalChildExecution,
11703                ::buffa::DecodeError,
11704            > {
11705                #[allow(unused_imports)]
11706                use ::buffa::alloc::string::ToString as _;
11707                let _ = __buffa_src;
11708                ::core::result::Result::Ok(super::super::ConditionalChildExecution {
11709                    execution: match self.execution.as_ref() {
11710                        ::core::option::Option::Some(v) => {
11711                            ::core::option::Option::Some(
11712                                match v {
11713                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11714                                        v,
11715                                    ) => {
11716                                        super::super::__buffa::oneof::conditional_child_execution::Execution::MarketIoc(
11717                                            ::buffa::alloc::boxed::Box::new(
11718                                                v.to_owned_from_source(__buffa_src)?,
11719                                            ),
11720                                        )
11721                                    }
11722                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11723                                        v,
11724                                    ) => {
11725                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitGtc(
11726                                            ::buffa::alloc::boxed::Box::new(
11727                                                v.to_owned_from_source(__buffa_src)?,
11728                                            ),
11729                                        )
11730                                    }
11731                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11732                                        v,
11733                                    ) => {
11734                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitIoc(
11735                                            ::buffa::alloc::boxed::Box::new(
11736                                                v.to_owned_from_source(__buffa_src)?,
11737                                            ),
11738                                        )
11739                                    }
11740                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11741                                        v,
11742                                    ) => {
11743                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitFok(
11744                                            ::buffa::alloc::boxed::Box::new(
11745                                                v.to_owned_from_source(__buffa_src)?,
11746                                            ),
11747                                        )
11748                                    }
11749                                },
11750                            )
11751                        }
11752                        ::core::option::Option::None => ::core::option::Option::None,
11753                    },
11754                    __buffa_unknown_fields: self
11755                        .__buffa_unknown_fields
11756                        .to_owned()?
11757                        .into(),
11758                    ..::core::default::Default::default()
11759                })
11760            }
11761        }
11762        impl<'a> ::buffa::ViewEncode<'a> for ConditionalChildExecutionView<'a> {
11763            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11764            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11765                #[allow(unused_imports)]
11766                use ::buffa::Enumeration as _;
11767                let mut size = 0u32;
11768                if let ::core::option::Option::Some(ref v) = self.execution {
11769                    match v {
11770                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11771                            x,
11772                        ) => {
11773                            let __slot = __cache.reserve();
11774                            let inner = x.compute_size(__cache);
11775                            __cache.set(__slot, inner);
11776                            size
11777                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11778                                    + inner;
11779                        }
11780                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11781                            x,
11782                        ) => {
11783                            let __slot = __cache.reserve();
11784                            let inner = x.compute_size(__cache);
11785                            __cache.set(__slot, inner);
11786                            size
11787                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11788                                    + inner;
11789                        }
11790                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11791                            x,
11792                        ) => {
11793                            let __slot = __cache.reserve();
11794                            let inner = x.compute_size(__cache);
11795                            __cache.set(__slot, inner);
11796                            size
11797                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11798                                    + inner;
11799                        }
11800                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11801                            x,
11802                        ) => {
11803                            let __slot = __cache.reserve();
11804                            let inner = x.compute_size(__cache);
11805                            __cache.set(__slot, inner);
11806                            size
11807                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11808                                    + inner;
11809                        }
11810                    }
11811                }
11812                size += self.__buffa_unknown_fields.encoded_len() as u32;
11813                size
11814            }
11815            #[allow(clippy::needless_borrow)]
11816            fn write_to(
11817                &self,
11818                __cache: &mut ::buffa::SizeCache,
11819                buf: &mut impl ::buffa::bytes::BufMut,
11820            ) {
11821                #[allow(unused_imports)]
11822                use ::buffa::Enumeration as _;
11823                if let ::core::option::Option::Some(ref v) = self.execution {
11824                    match v {
11825                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11826                            x,
11827                        ) => {
11828                            ::buffa::types::put_len_delimited_header(
11829                                1u32,
11830                                __cache.consume_next(),
11831                                buf,
11832                            );
11833                            x.write_to(__cache, buf);
11834                        }
11835                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11836                            x,
11837                        ) => {
11838                            ::buffa::types::put_len_delimited_header(
11839                                2u32,
11840                                __cache.consume_next(),
11841                                buf,
11842                            );
11843                            x.write_to(__cache, buf);
11844                        }
11845                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11846                            x,
11847                        ) => {
11848                            ::buffa::types::put_len_delimited_header(
11849                                3u32,
11850                                __cache.consume_next(),
11851                                buf,
11852                            );
11853                            x.write_to(__cache, buf);
11854                        }
11855                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11856                            x,
11857                        ) => {
11858                            ::buffa::types::put_len_delimited_header(
11859                                4u32,
11860                                __cache.consume_next(),
11861                                buf,
11862                            );
11863                            x.write_to(__cache, buf);
11864                        }
11865                    }
11866                }
11867                self.__buffa_unknown_fields.write_to(buf);
11868            }
11869        }
11870        /// Serializes this view as protobuf JSON.
11871        ///
11872        /// Implicit-presence fields with default values are omitted, `required`
11873        /// fields are always emitted, explicit-presence (`optional`) fields are
11874        /// emitted only when set, bytes fields are base64-encoded, and enum
11875        /// values are their proto name strings.
11876        ///
11877        /// This impl uses `serialize_map(None)` because the number of emitted
11878        /// fields depends on default-omission rules; serializers that require
11879        /// known map lengths (e.g. `bincode`) will return a runtime error.
11880        /// Use the owned message type for those formats.
11881        impl<'__a> ::serde::Serialize for ConditionalChildExecutionView<'__a> {
11882            fn serialize<__S: ::serde::Serializer>(
11883                &self,
11884                __s: __S,
11885            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11886                use ::serde::ser::SerializeMap as _;
11887                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11888                if let ::core::option::Option::Some(ref __ov) = self.execution {
11889                    match __ov {
11890                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11891                            v,
11892                        ) => {
11893                            __map.serialize_entry("marketIoc", v)?;
11894                        }
11895                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11896                            v,
11897                        ) => {
11898                            __map.serialize_entry("limitGtc", v)?;
11899                        }
11900                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11901                            v,
11902                        ) => {
11903                            __map.serialize_entry("limitIoc", v)?;
11904                        }
11905                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11906                            v,
11907                        ) => {
11908                            __map.serialize_entry("limitFok", v)?;
11909                        }
11910                    }
11911                }
11912                __map.end()
11913            }
11914        }
11915        impl<'a> ::buffa::MessageName for ConditionalChildExecutionView<'a> {
11916            const PACKAGE: &'static str = "triggers.v1";
11917            const NAME: &'static str = "ConditionalChildExecution";
11918            const FULL_NAME: &'static str = "triggers.v1.ConditionalChildExecution";
11919            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalChildExecution";
11920        }
11921        ::buffa::impl_default_view_instance!(ConditionalChildExecutionView);
11922        ::buffa::impl_view_reborrow!(ConditionalChildExecutionView);
11923        /** Self-contained, `'static` owned view of a `ConditionalChildExecution` message.
11924
11925 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.
11926
11927 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.*/
11928        #[derive(Clone, Debug)]
11929        pub struct ConditionalChildExecutionOwnedView(
11930            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
11931        );
11932        impl ConditionalChildExecutionOwnedView {
11933            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11934            ///
11935            /// The view borrows directly from the buffer's data; the buffer is
11936            /// retained inside the returned handle.
11937            ///
11938            /// # Errors
11939            ///
11940            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11941            /// protobuf data.
11942            pub fn decode(
11943                bytes: ::buffa::bytes::Bytes,
11944            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11945                ::core::result::Result::Ok(
11946                    ConditionalChildExecutionOwnedView(
11947                        ::buffa::OwnedView::decode(bytes)?,
11948                    ),
11949                )
11950            }
11951            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11952            /// max message size).
11953            ///
11954            /// # Errors
11955            ///
11956            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11957            /// exceeds the configured limits.
11958            pub fn decode_with_options(
11959                bytes: ::buffa::bytes::Bytes,
11960                opts: &::buffa::DecodeOptions,
11961            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11962                ::core::result::Result::Ok(
11963                    ConditionalChildExecutionOwnedView(
11964                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11965                    ),
11966                )
11967            }
11968            /// Build from an owned message via an encode → decode round-trip.
11969            ///
11970            /// # Errors
11971            ///
11972            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11973            /// somehow invalid (should not happen for well-formed messages).
11974            pub fn from_owned(
11975                msg: &super::super::ConditionalChildExecution,
11976            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11977                ::core::result::Result::Ok(
11978                    ConditionalChildExecutionOwnedView(
11979                        ::buffa::OwnedView::from_owned(msg)?,
11980                    ),
11981                )
11982            }
11983            /// Borrow the full [`ConditionalChildExecutionView`] with its lifetime tied to `&self`.
11984            #[must_use]
11985            pub fn view(&self) -> &ConditionalChildExecutionView<'_> {
11986                self.0.reborrow()
11987            }
11988            /// Convert to the owned message type.
11989            ///
11990            /// # Errors
11991            ///
11992            /// Returns an error if re-materializing preserved unknown fields
11993            /// fails (e.g. the unknown-field limit is exceeded).
11994            pub fn to_owned_message(
11995                &self,
11996            ) -> ::core::result::Result<
11997                super::super::ConditionalChildExecution,
11998                ::buffa::DecodeError,
11999            > {
12000                self.0.to_owned_message()
12001            }
12002            /// The underlying bytes buffer.
12003            #[must_use]
12004            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12005                self.0.bytes()
12006            }
12007            /// Consume the handle, returning the underlying bytes buffer.
12008            #[must_use]
12009            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12010                self.0.into_bytes()
12011            }
12012            /// Oneof `execution`.
12013            #[must_use]
12014            pub fn execution(
12015                &self,
12016            ) -> ::core::option::Option<
12017                &super::super::__buffa::view::oneof::conditional_child_execution::Execution<
12018                    '_,
12019                >,
12020            > {
12021                self.0.reborrow().execution.as_ref()
12022            }
12023        }
12024        impl ::core::convert::From<
12025            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12026        > for ConditionalChildExecutionOwnedView {
12027            fn from(
12028                inner: ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12029            ) -> Self {
12030                ConditionalChildExecutionOwnedView(inner)
12031            }
12032        }
12033        impl ::core::convert::From<ConditionalChildExecutionOwnedView>
12034        for ::buffa::OwnedView<ConditionalChildExecutionView<'static>> {
12035            fn from(wrapper: ConditionalChildExecutionOwnedView) -> Self {
12036                wrapper.0
12037            }
12038        }
12039        impl ::core::convert::AsRef<
12040            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12041        > for ConditionalChildExecutionOwnedView {
12042            fn as_ref(
12043                &self,
12044            ) -> &::buffa::OwnedView<ConditionalChildExecutionView<'static>> {
12045                &self.0
12046            }
12047        }
12048        impl ::buffa::HasMessageView for super::super::ConditionalChildExecution {
12049            type View<'a> = ConditionalChildExecutionView<'a>;
12050            type ViewHandle = ConditionalChildExecutionOwnedView;
12051        }
12052        impl ::serde::Serialize for ConditionalChildExecutionOwnedView {
12053            fn serialize<__S: ::serde::Serializer>(
12054                &self,
12055                __s: __S,
12056            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12057                ::serde::Serialize::serialize(&self.0, __s)
12058            }
12059        }
12060        /// ConditionalTrigger configures a standalone stop-loss or take-profit.
12061        #[derive(Clone, Debug, Default)]
12062        pub struct ConditionalTriggerView<'a> {
12063            /// Trigger threshold in quote units scaled by 1e6.
12064            ///
12065            /// Field 1: `trigger_price_ticks`
12066            pub trigger_price_ticks: i64,
12067            /// Child order side.
12068            ///
12069            /// Field 2: `side`
12070            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
12071            /// Child execution.
12072            ///
12073            /// Field 3: `child`
12074            pub child: ::buffa::MessageFieldView<
12075                super::super::__buffa::view::ConditionalChildExecutionView<'a>,
12076            >,
12077            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12078        }
12079        impl<'a> ::buffa::MessageView<'a> for ConditionalTriggerView<'a> {
12080            type Owned = super::super::ConditionalTrigger;
12081            fn decode_view(
12082                buf: &'a [u8],
12083            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12084                let __limit = ::core::cell::Cell::new(
12085                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12086                );
12087                <Self as ::buffa::MessageView>::decode_view_ctx(
12088                    buf,
12089                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12090                )
12091            }
12092            fn decode_view_with_ctx(
12093                buf: &'a [u8],
12094                ctx: ::buffa::DecodeContext<'_>,
12095            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12096                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12097            }
12098            fn merge_view_field(
12099                &mut self,
12100                tag: ::buffa::encoding::Tag,
12101                cur: &'a [u8],
12102                before_tag: &'a [u8],
12103                ctx: ::buffa::DecodeContext<'_>,
12104            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12105                let _ = ctx;
12106                #[allow(unused_variables)]
12107                let view = self;
12108                let mut cur = cur;
12109                match tag.field_number() {
12110                    1u32 => {
12111                        ::buffa::encoding::check_wire_type(
12112                            tag,
12113                            ::buffa::encoding::WireType::Varint,
12114                        )?;
12115                        view.trigger_price_ticks = ::buffa::types::decode_int64(
12116                            &mut cur,
12117                        )?;
12118                    }
12119                    2u32 => {
12120                        ::buffa::encoding::check_wire_type(
12121                            tag,
12122                            ::buffa::encoding::WireType::Varint,
12123                        )?;
12124                        view.side = ::buffa::EnumValue::from(
12125                            ::buffa::types::decode_int32(&mut cur)?,
12126                        );
12127                    }
12128                    3u32 => {
12129                        ::buffa::encoding::check_wire_type(
12130                            tag,
12131                            ::buffa::encoding::WireType::LengthDelimited,
12132                        )?;
12133                        let __sub_ctx = ctx.descend()?;
12134                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12135                        match view.child.as_mut() {
12136                            Some(existing) => {
12137                                ::buffa::MessageView::merge_into_view(
12138                                    existing,
12139                                    sub,
12140                                    __sub_ctx,
12141                                )?
12142                            }
12143                            None => {
12144                                view.child = ::buffa::MessageFieldView::set(
12145                                    <super::super::__buffa::view::ConditionalChildExecutionView as ::buffa::MessageView>::decode_view_ctx(
12146                                        sub,
12147                                        __sub_ctx,
12148                                    )?,
12149                                );
12150                            }
12151                        }
12152                    }
12153                    _ => {
12154                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12155                        let span_len = before_tag.len() - cur.len();
12156                        view.__buffa_unknown_fields
12157                            .push_record(before_tag, span_len, ctx)?;
12158                    }
12159                }
12160                ::core::result::Result::Ok(cur)
12161            }
12162            fn to_owned_message(
12163                &self,
12164            ) -> ::core::result::Result<
12165                super::super::ConditionalTrigger,
12166                ::buffa::DecodeError,
12167            > {
12168                self.to_owned_from_source(None)
12169            }
12170            #[allow(clippy::useless_conversion, clippy::needless_update)]
12171            fn to_owned_from_source(
12172                &self,
12173                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12174            ) -> ::core::result::Result<
12175                super::super::ConditionalTrigger,
12176                ::buffa::DecodeError,
12177            > {
12178                #[allow(unused_imports)]
12179                use ::buffa::alloc::string::ToString as _;
12180                let _ = __buffa_src;
12181                ::core::result::Result::Ok(super::super::ConditionalTrigger {
12182                    trigger_price_ticks: self.trigger_price_ticks,
12183                    side: self.side,
12184                    child: match self.child.as_option() {
12185                        Some(v) => {
12186                            ::buffa::MessageField::<
12187                                super::super::ConditionalChildExecution,
12188                            >::some(v.to_owned_from_source(__buffa_src)?)
12189                        }
12190                        None => ::buffa::MessageField::none(),
12191                    },
12192                    __buffa_unknown_fields: self
12193                        .__buffa_unknown_fields
12194                        .to_owned()?
12195                        .into(),
12196                    ..::core::default::Default::default()
12197                })
12198            }
12199        }
12200        impl<'a> ::buffa::ViewEncode<'a> for ConditionalTriggerView<'a> {
12201            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12202            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12203                #[allow(unused_imports)]
12204                use ::buffa::Enumeration as _;
12205                let mut size = 0u32;
12206                if self.trigger_price_ticks != 0i64 {
12207                    size
12208                        += 1u32
12209                            + ::buffa::types::int64_encoded_len(self.trigger_price_ticks)
12210                                as u32;
12211                }
12212                {
12213                    let val = self.side.to_i32();
12214                    if val != 0 {
12215                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12216                    }
12217                }
12218                if self.child.is_set() {
12219                    let __slot = __cache.reserve();
12220                    let inner_size = self.child.compute_size(__cache);
12221                    __cache.set(__slot, inner_size);
12222                    size
12223                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12224                            + inner_size;
12225                }
12226                size += self.__buffa_unknown_fields.encoded_len() as u32;
12227                size
12228            }
12229            #[allow(clippy::needless_borrow)]
12230            fn write_to(
12231                &self,
12232                __cache: &mut ::buffa::SizeCache,
12233                buf: &mut impl ::buffa::bytes::BufMut,
12234            ) {
12235                #[allow(unused_imports)]
12236                use ::buffa::Enumeration as _;
12237                if self.trigger_price_ticks != 0i64 {
12238                    ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
12239                }
12240                {
12241                    let val = self.side.to_i32();
12242                    if val != 0 {
12243                        ::buffa::types::put_int32_field(2u32, val, buf);
12244                    }
12245                }
12246                if self.child.is_set() {
12247                    ::buffa::types::put_len_delimited_header(
12248                        3u32,
12249                        __cache.consume_next(),
12250                        buf,
12251                    );
12252                    self.child.write_to(__cache, buf);
12253                }
12254                self.__buffa_unknown_fields.write_to(buf);
12255            }
12256        }
12257        /// Serializes this view as protobuf JSON.
12258        ///
12259        /// Implicit-presence fields with default values are omitted, `required`
12260        /// fields are always emitted, explicit-presence (`optional`) fields are
12261        /// emitted only when set, bytes fields are base64-encoded, and enum
12262        /// values are their proto name strings.
12263        ///
12264        /// This impl uses `serialize_map(None)` because the number of emitted
12265        /// fields depends on default-omission rules; serializers that require
12266        /// known map lengths (e.g. `bincode`) will return a runtime error.
12267        /// Use the owned message type for those formats.
12268        impl<'__a> ::serde::Serialize for ConditionalTriggerView<'__a> {
12269            fn serialize<__S: ::serde::Serializer>(
12270                &self,
12271                __s: __S,
12272            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12273                use ::serde::ser::SerializeMap as _;
12274                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12275                if !::buffa::json_helpers::skip_if::is_zero_i64(
12276                    &self.trigger_price_ticks,
12277                ) {
12278                    __map
12279                        .serialize_entry(
12280                            "triggerPriceTicks",
12281                            &::buffa::json_helpers::ProtoJson(&self.trigger_price_ticks),
12282                        )?;
12283                }
12284                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
12285                    __map.serialize_entry("side", &self.side)?;
12286                }
12287                {
12288                    if let ::core::option::Option::Some(__v) = self.child.as_option() {
12289                        __map.serialize_entry("child", __v)?;
12290                    }
12291                }
12292                __map.end()
12293            }
12294        }
12295        impl<'a> ::buffa::MessageName for ConditionalTriggerView<'a> {
12296            const PACKAGE: &'static str = "triggers.v1";
12297            const NAME: &'static str = "ConditionalTrigger";
12298            const FULL_NAME: &'static str = "triggers.v1.ConditionalTrigger";
12299            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalTrigger";
12300        }
12301        ::buffa::impl_default_view_instance!(ConditionalTriggerView);
12302        ::buffa::impl_view_reborrow!(ConditionalTriggerView);
12303        /** Self-contained, `'static` owned view of a `ConditionalTrigger` message.
12304
12305 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.
12306
12307 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.*/
12308        #[derive(Clone, Debug)]
12309        pub struct ConditionalTriggerOwnedView(
12310            ::buffa::OwnedView<ConditionalTriggerView<'static>>,
12311        );
12312        impl ConditionalTriggerOwnedView {
12313            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12314            ///
12315            /// The view borrows directly from the buffer's data; the buffer is
12316            /// retained inside the returned handle.
12317            ///
12318            /// # Errors
12319            ///
12320            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12321            /// protobuf data.
12322            pub fn decode(
12323                bytes: ::buffa::bytes::Bytes,
12324            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12325                ::core::result::Result::Ok(
12326                    ConditionalTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
12327                )
12328            }
12329            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12330            /// max message size).
12331            ///
12332            /// # Errors
12333            ///
12334            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12335            /// exceeds the configured limits.
12336            pub fn decode_with_options(
12337                bytes: ::buffa::bytes::Bytes,
12338                opts: &::buffa::DecodeOptions,
12339            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12340                ::core::result::Result::Ok(
12341                    ConditionalTriggerOwnedView(
12342                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12343                    ),
12344                )
12345            }
12346            /// Build from an owned message via an encode → decode round-trip.
12347            ///
12348            /// # Errors
12349            ///
12350            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12351            /// somehow invalid (should not happen for well-formed messages).
12352            pub fn from_owned(
12353                msg: &super::super::ConditionalTrigger,
12354            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12355                ::core::result::Result::Ok(
12356                    ConditionalTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
12357                )
12358            }
12359            /// Borrow the full [`ConditionalTriggerView`] with its lifetime tied to `&self`.
12360            #[must_use]
12361            pub fn view(&self) -> &ConditionalTriggerView<'_> {
12362                self.0.reborrow()
12363            }
12364            /// Convert to the owned message type.
12365            ///
12366            /// # Errors
12367            ///
12368            /// Returns an error if re-materializing preserved unknown fields
12369            /// fails (e.g. the unknown-field limit is exceeded).
12370            pub fn to_owned_message(
12371                &self,
12372            ) -> ::core::result::Result<
12373                super::super::ConditionalTrigger,
12374                ::buffa::DecodeError,
12375            > {
12376                self.0.to_owned_message()
12377            }
12378            /// The underlying bytes buffer.
12379            #[must_use]
12380            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12381                self.0.bytes()
12382            }
12383            /// Consume the handle, returning the underlying bytes buffer.
12384            #[must_use]
12385            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12386                self.0.into_bytes()
12387            }
12388            /// Trigger threshold in quote units scaled by 1e6.
12389            ///
12390            /// Field 1: `trigger_price_ticks`
12391            #[must_use]
12392            pub fn trigger_price_ticks(&self) -> i64 {
12393                self.0.reborrow().trigger_price_ticks
12394            }
12395            /// Child order side.
12396            ///
12397            /// Field 2: `side`
12398            #[must_use]
12399            pub fn side(
12400                &self,
12401            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
12402                self.0.reborrow().side
12403            }
12404            /// Child execution.
12405            ///
12406            /// Field 3: `child`
12407            #[must_use]
12408            pub fn child(
12409                &self,
12410            ) -> &::buffa::MessageFieldView<
12411                super::super::__buffa::view::ConditionalChildExecutionView<'_>,
12412            > {
12413                &self.0.reborrow().child
12414            }
12415        }
12416        impl ::core::convert::From<::buffa::OwnedView<ConditionalTriggerView<'static>>>
12417        for ConditionalTriggerOwnedView {
12418            fn from(inner: ::buffa::OwnedView<ConditionalTriggerView<'static>>) -> Self {
12419                ConditionalTriggerOwnedView(inner)
12420            }
12421        }
12422        impl ::core::convert::From<ConditionalTriggerOwnedView>
12423        for ::buffa::OwnedView<ConditionalTriggerView<'static>> {
12424            fn from(wrapper: ConditionalTriggerOwnedView) -> Self {
12425                wrapper.0
12426            }
12427        }
12428        impl ::core::convert::AsRef<::buffa::OwnedView<ConditionalTriggerView<'static>>>
12429        for ConditionalTriggerOwnedView {
12430            fn as_ref(&self) -> &::buffa::OwnedView<ConditionalTriggerView<'static>> {
12431                &self.0
12432            }
12433        }
12434        impl ::buffa::HasMessageView for super::super::ConditionalTrigger {
12435            type View<'a> = ConditionalTriggerView<'a>;
12436            type ViewHandle = ConditionalTriggerOwnedView;
12437        }
12438        impl ::serde::Serialize for ConditionalTriggerOwnedView {
12439            fn serialize<__S: ::serde::Serializer>(
12440                &self,
12441                __s: __S,
12442            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12443                ::serde::Serialize::serialize(&self.0, __s)
12444            }
12445        }
12446        /// TrailingStopTrigger configures a spot trailing-stop strategy.
12447        /// Standalone triggers currently support SELL market-IOC children. Attached
12448        /// trailing stops may use either side, opposite their parent order.
12449        #[derive(Clone, Debug, Default)]
12450        pub struct TrailingStopTriggerView<'a> {
12451            /// Optional activation price in quote units scaled by 1e6.
12452            ///
12453            /// Field 3: `activation_price_ticks`
12454            pub activation_price_ticks: i64,
12455            /// Child order side.
12456            ///
12457            /// Field 6: `side`
12458            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
12459            pub trailing_distance: ::core::option::Option<
12460                super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance,
12461            >,
12462            pub max_slippage: ::core::option::Option<
12463                super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage,
12464            >,
12465            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12466        }
12467        impl<'a> ::buffa::MessageView<'a> for TrailingStopTriggerView<'a> {
12468            type Owned = super::super::TrailingStopTrigger;
12469            fn decode_view(
12470                buf: &'a [u8],
12471            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12472                let __limit = ::core::cell::Cell::new(
12473                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12474                );
12475                <Self as ::buffa::MessageView>::decode_view_ctx(
12476                    buf,
12477                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12478                )
12479            }
12480            fn decode_view_with_ctx(
12481                buf: &'a [u8],
12482                ctx: ::buffa::DecodeContext<'_>,
12483            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12484                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12485            }
12486            fn merge_view_field(
12487                &mut self,
12488                tag: ::buffa::encoding::Tag,
12489                cur: &'a [u8],
12490                before_tag: &'a [u8],
12491                ctx: ::buffa::DecodeContext<'_>,
12492            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12493                let _ = ctx;
12494                #[allow(unused_variables)]
12495                let view = self;
12496                let mut cur = cur;
12497                match tag.field_number() {
12498                    3u32 => {
12499                        ::buffa::encoding::check_wire_type(
12500                            tag,
12501                            ::buffa::encoding::WireType::Varint,
12502                        )?;
12503                        view.activation_price_ticks = ::buffa::types::decode_int64(
12504                            &mut cur,
12505                        )?;
12506                    }
12507                    6u32 => {
12508                        ::buffa::encoding::check_wire_type(
12509                            tag,
12510                            ::buffa::encoding::WireType::Varint,
12511                        )?;
12512                        view.side = ::buffa::EnumValue::from(
12513                            ::buffa::types::decode_int32(&mut cur)?,
12514                        );
12515                    }
12516                    1u32 => {
12517                        ::buffa::encoding::check_wire_type(
12518                            tag,
12519                            ::buffa::encoding::WireType::Varint,
12520                        )?;
12521                        view.trailing_distance = Some(
12522                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12523                                ::buffa::types::decode_int64(&mut cur)?,
12524                            ),
12525                        );
12526                    }
12527                    2u32 => {
12528                        ::buffa::encoding::check_wire_type(
12529                            tag,
12530                            ::buffa::encoding::WireType::Varint,
12531                        )?;
12532                        view.trailing_distance = Some(
12533                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12534                                ::buffa::types::decode_int32(&mut cur)?,
12535                            ),
12536                        );
12537                    }
12538                    4u32 => {
12539                        ::buffa::encoding::check_wire_type(
12540                            tag,
12541                            ::buffa::encoding::WireType::Varint,
12542                        )?;
12543                        view.max_slippage = Some(
12544                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12545                                ::buffa::types::decode_int32(&mut cur)?,
12546                            ),
12547                        );
12548                    }
12549                    5u32 => {
12550                        ::buffa::encoding::check_wire_type(
12551                            tag,
12552                            ::buffa::encoding::WireType::Varint,
12553                        )?;
12554                        view.max_slippage = Some(
12555                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12556                                ::buffa::types::decode_int32(&mut cur)?,
12557                            ),
12558                        );
12559                    }
12560                    _ => {
12561                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12562                        let span_len = before_tag.len() - cur.len();
12563                        view.__buffa_unknown_fields
12564                            .push_record(before_tag, span_len, ctx)?;
12565                    }
12566                }
12567                ::core::result::Result::Ok(cur)
12568            }
12569            fn to_owned_message(
12570                &self,
12571            ) -> ::core::result::Result<
12572                super::super::TrailingStopTrigger,
12573                ::buffa::DecodeError,
12574            > {
12575                self.to_owned_from_source(None)
12576            }
12577            #[allow(clippy::useless_conversion, clippy::needless_update)]
12578            fn to_owned_from_source(
12579                &self,
12580                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12581            ) -> ::core::result::Result<
12582                super::super::TrailingStopTrigger,
12583                ::buffa::DecodeError,
12584            > {
12585                #[allow(unused_imports)]
12586                use ::buffa::alloc::string::ToString as _;
12587                let _ = __buffa_src;
12588                ::core::result::Result::Ok(super::super::TrailingStopTrigger {
12589                    activation_price_ticks: self.activation_price_ticks,
12590                    side: self.side,
12591                    trailing_distance: self
12592                        .trailing_distance
12593                        .as_ref()
12594                        .map(|v| match v {
12595                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12596                                v,
12597                            ) => {
12598                                super::super::__buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12599                                    *v,
12600                                )
12601                            }
12602                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12603                                v,
12604                            ) => {
12605                                super::super::__buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12606                                    *v,
12607                                )
12608                            }
12609                        }),
12610                    max_slippage: self
12611                        .max_slippage
12612                        .as_ref()
12613                        .map(|v| match v {
12614                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12615                                v,
12616                            ) => {
12617                                super::super::__buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12618                                    *v,
12619                                )
12620                            }
12621                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12622                                v,
12623                            ) => {
12624                                super::super::__buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12625                                    *v,
12626                                )
12627                            }
12628                        }),
12629                    __buffa_unknown_fields: self
12630                        .__buffa_unknown_fields
12631                        .to_owned()?
12632                        .into(),
12633                    ..::core::default::Default::default()
12634                })
12635            }
12636        }
12637        impl<'a> ::buffa::ViewEncode<'a> for TrailingStopTriggerView<'a> {
12638            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12639            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
12640                #[allow(unused_imports)]
12641                use ::buffa::Enumeration as _;
12642                let mut size = 0u32;
12643                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
12644                    match v {
12645                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12646                            v,
12647                        ) => {
12648                            size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
12649                        }
12650                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12651                            v,
12652                        ) => {
12653                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12654                        }
12655                    }
12656                }
12657                if self.activation_price_ticks != 0i64 {
12658                    size
12659                        += 1u32
12660                            + ::buffa::types::int64_encoded_len(
12661                                self.activation_price_ticks,
12662                            ) as u32;
12663                }
12664                if let ::core::option::Option::Some(ref v) = self.max_slippage {
12665                    match v {
12666                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12667                            v,
12668                        ) => {
12669                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12670                        }
12671                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12672                            v,
12673                        ) => {
12674                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12675                        }
12676                    }
12677                }
12678                {
12679                    let val = self.side.to_i32();
12680                    if val != 0 {
12681                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12682                    }
12683                }
12684                size += self.__buffa_unknown_fields.encoded_len() as u32;
12685                size
12686            }
12687            #[allow(clippy::needless_borrow)]
12688            fn write_to(
12689                &self,
12690                _cache: &mut ::buffa::SizeCache,
12691                buf: &mut impl ::buffa::bytes::BufMut,
12692            ) {
12693                #[allow(unused_imports)]
12694                use ::buffa::Enumeration as _;
12695                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
12696                    match v {
12697                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12698                            x,
12699                        ) => {
12700                            ::buffa::types::put_int64_field(1u32, *x, buf);
12701                        }
12702                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12703                            x,
12704                        ) => {
12705                            ::buffa::types::put_int32_field(2u32, *x, buf);
12706                        }
12707                    }
12708                }
12709                if self.activation_price_ticks != 0i64 {
12710                    ::buffa::types::put_int64_field(
12711                        3u32,
12712                        self.activation_price_ticks,
12713                        buf,
12714                    );
12715                }
12716                if let ::core::option::Option::Some(ref v) = self.max_slippage {
12717                    match v {
12718                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12719                            x,
12720                        ) => {
12721                            ::buffa::types::put_int32_field(4u32, *x, buf);
12722                        }
12723                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12724                            x,
12725                        ) => {
12726                            ::buffa::types::put_int32_field(5u32, *x, buf);
12727                        }
12728                    }
12729                }
12730                {
12731                    let val = self.side.to_i32();
12732                    if val != 0 {
12733                        ::buffa::types::put_int32_field(6u32, val, buf);
12734                    }
12735                }
12736                self.__buffa_unknown_fields.write_to(buf);
12737            }
12738        }
12739        /// Serializes this view as protobuf JSON.
12740        ///
12741        /// Implicit-presence fields with default values are omitted, `required`
12742        /// fields are always emitted, explicit-presence (`optional`) fields are
12743        /// emitted only when set, bytes fields are base64-encoded, and enum
12744        /// values are their proto name strings.
12745        ///
12746        /// This impl uses `serialize_map(None)` because the number of emitted
12747        /// fields depends on default-omission rules; serializers that require
12748        /// known map lengths (e.g. `bincode`) will return a runtime error.
12749        /// Use the owned message type for those formats.
12750        impl<'__a> ::serde::Serialize for TrailingStopTriggerView<'__a> {
12751            fn serialize<__S: ::serde::Serializer>(
12752                &self,
12753                __s: __S,
12754            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12755                use ::serde::ser::SerializeMap as _;
12756                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12757                if !::buffa::json_helpers::skip_if::is_zero_i64(
12758                    &self.activation_price_ticks,
12759                ) {
12760                    __map
12761                        .serialize_entry(
12762                            "activationPriceTicks",
12763                            &::buffa::json_helpers::ProtoJson(
12764                                &self.activation_price_ticks,
12765                            ),
12766                        )?;
12767                }
12768                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
12769                    __map.serialize_entry("side", &self.side)?;
12770                }
12771                if let ::core::option::Option::Some(ref __ov) = self.trailing_distance {
12772                    match __ov {
12773                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12774                            v,
12775                        ) => {
12776                            __map
12777                                .serialize_entry(
12778                                    "trailingDistanceTicks",
12779                                    &::buffa::json_helpers::ProtoJson(v),
12780                                )?;
12781                        }
12782                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12783                            v,
12784                        ) => {
12785                            __map
12786                                .serialize_entry(
12787                                    "trailingDistanceBps",
12788                                    &::buffa::json_helpers::ProtoJson(v),
12789                                )?;
12790                        }
12791                    }
12792                }
12793                if let ::core::option::Option::Some(ref __ov) = self.max_slippage {
12794                    match __ov {
12795                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12796                            v,
12797                        ) => {
12798                            __map
12799                                .serialize_entry(
12800                                    "maxSlippageTicks",
12801                                    &::buffa::json_helpers::ProtoJson(v),
12802                                )?;
12803                        }
12804                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12805                            v,
12806                        ) => {
12807                            __map
12808                                .serialize_entry(
12809                                    "maxSlippageBps",
12810                                    &::buffa::json_helpers::ProtoJson(v),
12811                                )?;
12812                        }
12813                    }
12814                }
12815                __map.end()
12816            }
12817        }
12818        impl<'a> ::buffa::MessageName for TrailingStopTriggerView<'a> {
12819            const PACKAGE: &'static str = "triggers.v1";
12820            const NAME: &'static str = "TrailingStopTrigger";
12821            const FULL_NAME: &'static str = "triggers.v1.TrailingStopTrigger";
12822            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
12823        }
12824        ::buffa::impl_default_view_instance!(TrailingStopTriggerView);
12825        ::buffa::impl_view_reborrow!(TrailingStopTriggerView);
12826        /** Self-contained, `'static` owned view of a `TrailingStopTrigger` message.
12827
12828 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.
12829
12830 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.*/
12831        #[derive(Clone, Debug)]
12832        pub struct TrailingStopTriggerOwnedView(
12833            ::buffa::OwnedView<TrailingStopTriggerView<'static>>,
12834        );
12835        impl TrailingStopTriggerOwnedView {
12836            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12837            ///
12838            /// The view borrows directly from the buffer's data; the buffer is
12839            /// retained inside the returned handle.
12840            ///
12841            /// # Errors
12842            ///
12843            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12844            /// protobuf data.
12845            pub fn decode(
12846                bytes: ::buffa::bytes::Bytes,
12847            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12848                ::core::result::Result::Ok(
12849                    TrailingStopTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
12850                )
12851            }
12852            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12853            /// max message size).
12854            ///
12855            /// # Errors
12856            ///
12857            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12858            /// exceeds the configured limits.
12859            pub fn decode_with_options(
12860                bytes: ::buffa::bytes::Bytes,
12861                opts: &::buffa::DecodeOptions,
12862            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12863                ::core::result::Result::Ok(
12864                    TrailingStopTriggerOwnedView(
12865                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12866                    ),
12867                )
12868            }
12869            /// Build from an owned message via an encode → decode round-trip.
12870            ///
12871            /// # Errors
12872            ///
12873            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12874            /// somehow invalid (should not happen for well-formed messages).
12875            pub fn from_owned(
12876                msg: &super::super::TrailingStopTrigger,
12877            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12878                ::core::result::Result::Ok(
12879                    TrailingStopTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
12880                )
12881            }
12882            /// Borrow the full [`TrailingStopTriggerView`] with its lifetime tied to `&self`.
12883            #[must_use]
12884            pub fn view(&self) -> &TrailingStopTriggerView<'_> {
12885                self.0.reborrow()
12886            }
12887            /// Convert to the owned message type.
12888            ///
12889            /// # Errors
12890            ///
12891            /// Returns an error if re-materializing preserved unknown fields
12892            /// fails (e.g. the unknown-field limit is exceeded).
12893            pub fn to_owned_message(
12894                &self,
12895            ) -> ::core::result::Result<
12896                super::super::TrailingStopTrigger,
12897                ::buffa::DecodeError,
12898            > {
12899                self.0.to_owned_message()
12900            }
12901            /// The underlying bytes buffer.
12902            #[must_use]
12903            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12904                self.0.bytes()
12905            }
12906            /// Consume the handle, returning the underlying bytes buffer.
12907            #[must_use]
12908            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12909                self.0.into_bytes()
12910            }
12911            /// Optional activation price in quote units scaled by 1e6.
12912            ///
12913            /// Field 3: `activation_price_ticks`
12914            #[must_use]
12915            pub fn activation_price_ticks(&self) -> i64 {
12916                self.0.reborrow().activation_price_ticks
12917            }
12918            /// Child order side.
12919            ///
12920            /// Field 6: `side`
12921            #[must_use]
12922            pub fn side(
12923                &self,
12924            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
12925                self.0.reborrow().side
12926            }
12927            /// Oneof `trailing_distance`.
12928            #[must_use]
12929            pub fn trailing_distance(
12930                &self,
12931            ) -> ::core::option::Option<
12932                &super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance,
12933            > {
12934                self.0.reborrow().trailing_distance.as_ref()
12935            }
12936            /// Oneof `max_slippage`.
12937            #[must_use]
12938            pub fn max_slippage(
12939                &self,
12940            ) -> ::core::option::Option<
12941                &super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage,
12942            > {
12943                self.0.reborrow().max_slippage.as_ref()
12944            }
12945        }
12946        impl ::core::convert::From<::buffa::OwnedView<TrailingStopTriggerView<'static>>>
12947        for TrailingStopTriggerOwnedView {
12948            fn from(
12949                inner: ::buffa::OwnedView<TrailingStopTriggerView<'static>>,
12950            ) -> Self {
12951                TrailingStopTriggerOwnedView(inner)
12952            }
12953        }
12954        impl ::core::convert::From<TrailingStopTriggerOwnedView>
12955        for ::buffa::OwnedView<TrailingStopTriggerView<'static>> {
12956            fn from(wrapper: TrailingStopTriggerOwnedView) -> Self {
12957                wrapper.0
12958            }
12959        }
12960        impl ::core::convert::AsRef<::buffa::OwnedView<TrailingStopTriggerView<'static>>>
12961        for TrailingStopTriggerOwnedView {
12962            fn as_ref(&self) -> &::buffa::OwnedView<TrailingStopTriggerView<'static>> {
12963                &self.0
12964            }
12965        }
12966        impl ::buffa::HasMessageView for super::super::TrailingStopTrigger {
12967            type View<'a> = TrailingStopTriggerView<'a>;
12968            type ViewHandle = TrailingStopTriggerOwnedView;
12969        }
12970        impl ::serde::Serialize for TrailingStopTriggerOwnedView {
12971            fn serialize<__S: ::serde::Serializer>(
12972                &self,
12973                __s: __S,
12974            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12975                ::serde::Serialize::serialize(&self.0, __s)
12976            }
12977        }
12978        /// TwapMarketIoc configures server-priced market-IOC slices.
12979        #[derive(Clone, Debug, Default)]
12980        pub struct TwapMarketIocView<'a> {
12981            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12982        }
12983        impl<'a> ::buffa::MessageView<'a> for TwapMarketIocView<'a> {
12984            type Owned = super::super::TwapMarketIoc;
12985            fn decode_view(
12986                buf: &'a [u8],
12987            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12988                let __limit = ::core::cell::Cell::new(
12989                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12990                );
12991                <Self as ::buffa::MessageView>::decode_view_ctx(
12992                    buf,
12993                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12994                )
12995            }
12996            fn decode_view_with_ctx(
12997                buf: &'a [u8],
12998                ctx: ::buffa::DecodeContext<'_>,
12999            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13000                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13001            }
13002            fn merge_view_field(
13003                &mut self,
13004                tag: ::buffa::encoding::Tag,
13005                cur: &'a [u8],
13006                before_tag: &'a [u8],
13007                ctx: ::buffa::DecodeContext<'_>,
13008            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13009                let _ = ctx;
13010                #[allow(unused_variables)]
13011                let view = self;
13012                let mut cur = cur;
13013                match tag.field_number() {
13014                    _ => {
13015                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13016                        let span_len = before_tag.len() - cur.len();
13017                        view.__buffa_unknown_fields
13018                            .push_record(before_tag, span_len, ctx)?;
13019                    }
13020                }
13021                ::core::result::Result::Ok(cur)
13022            }
13023            fn to_owned_message(
13024                &self,
13025            ) -> ::core::result::Result<
13026                super::super::TwapMarketIoc,
13027                ::buffa::DecodeError,
13028            > {
13029                self.to_owned_from_source(None)
13030            }
13031            #[allow(clippy::useless_conversion, clippy::needless_update)]
13032            fn to_owned_from_source(
13033                &self,
13034                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13035            ) -> ::core::result::Result<
13036                super::super::TwapMarketIoc,
13037                ::buffa::DecodeError,
13038            > {
13039                #[allow(unused_imports)]
13040                use ::buffa::alloc::string::ToString as _;
13041                let _ = __buffa_src;
13042                ::core::result::Result::Ok(super::super::TwapMarketIoc {
13043                    __buffa_unknown_fields: self
13044                        .__buffa_unknown_fields
13045                        .to_owned()?
13046                        .into(),
13047                    ..::core::default::Default::default()
13048                })
13049            }
13050        }
13051        impl<'a> ::buffa::ViewEncode<'a> for TwapMarketIocView<'a> {
13052            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13053            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13054                #[allow(unused_imports)]
13055                use ::buffa::Enumeration as _;
13056                let mut size = 0u32;
13057                size += self.__buffa_unknown_fields.encoded_len() as u32;
13058                size
13059            }
13060            #[allow(clippy::needless_borrow)]
13061            fn write_to(
13062                &self,
13063                _cache: &mut ::buffa::SizeCache,
13064                buf: &mut impl ::buffa::bytes::BufMut,
13065            ) {
13066                #[allow(unused_imports)]
13067                use ::buffa::Enumeration as _;
13068                self.__buffa_unknown_fields.write_to(buf);
13069            }
13070        }
13071        /// Serializes this view as protobuf JSON.
13072        ///
13073        /// Implicit-presence fields with default values are omitted, `required`
13074        /// fields are always emitted, explicit-presence (`optional`) fields are
13075        /// emitted only when set, bytes fields are base64-encoded, and enum
13076        /// values are their proto name strings.
13077        ///
13078        /// This impl uses `serialize_map(None)` because the number of emitted
13079        /// fields depends on default-omission rules; serializers that require
13080        /// known map lengths (e.g. `bincode`) will return a runtime error.
13081        /// Use the owned message type for those formats.
13082        impl<'__a> ::serde::Serialize for TwapMarketIocView<'__a> {
13083            fn serialize<__S: ::serde::Serializer>(
13084                &self,
13085                __s: __S,
13086            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13087                use ::serde::ser::SerializeMap as _;
13088                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13089                __map.end()
13090            }
13091        }
13092        impl<'a> ::buffa::MessageName for TwapMarketIocView<'a> {
13093            const PACKAGE: &'static str = "triggers.v1";
13094            const NAME: &'static str = "TwapMarketIoc";
13095            const FULL_NAME: &'static str = "triggers.v1.TwapMarketIoc";
13096            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
13097        }
13098        ::buffa::impl_default_view_instance!(TwapMarketIocView);
13099        ::buffa::impl_view_reborrow!(TwapMarketIocView);
13100        /** Self-contained, `'static` owned view of a `TwapMarketIoc` message.
13101
13102 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.
13103
13104 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.*/
13105        #[derive(Clone, Debug)]
13106        pub struct TwapMarketIocOwnedView(
13107            ::buffa::OwnedView<TwapMarketIocView<'static>>,
13108        );
13109        impl TwapMarketIocOwnedView {
13110            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13111            ///
13112            /// The view borrows directly from the buffer's data; the buffer is
13113            /// retained inside the returned handle.
13114            ///
13115            /// # Errors
13116            ///
13117            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13118            /// protobuf data.
13119            pub fn decode(
13120                bytes: ::buffa::bytes::Bytes,
13121            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13122                ::core::result::Result::Ok(
13123                    TwapMarketIocOwnedView(::buffa::OwnedView::decode(bytes)?),
13124                )
13125            }
13126            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13127            /// max message size).
13128            ///
13129            /// # Errors
13130            ///
13131            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13132            /// exceeds the configured limits.
13133            pub fn decode_with_options(
13134                bytes: ::buffa::bytes::Bytes,
13135                opts: &::buffa::DecodeOptions,
13136            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13137                ::core::result::Result::Ok(
13138                    TwapMarketIocOwnedView(
13139                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13140                    ),
13141                )
13142            }
13143            /// Build from an owned message via an encode → decode round-trip.
13144            ///
13145            /// # Errors
13146            ///
13147            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13148            /// somehow invalid (should not happen for well-formed messages).
13149            pub fn from_owned(
13150                msg: &super::super::TwapMarketIoc,
13151            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13152                ::core::result::Result::Ok(
13153                    TwapMarketIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
13154                )
13155            }
13156            /// Borrow the full [`TwapMarketIocView`] with its lifetime tied to `&self`.
13157            #[must_use]
13158            pub fn view(&self) -> &TwapMarketIocView<'_> {
13159                self.0.reborrow()
13160            }
13161            /// Convert to the owned message type.
13162            ///
13163            /// # Errors
13164            ///
13165            /// Returns an error if re-materializing preserved unknown fields
13166            /// fails (e.g. the unknown-field limit is exceeded).
13167            pub fn to_owned_message(
13168                &self,
13169            ) -> ::core::result::Result<
13170                super::super::TwapMarketIoc,
13171                ::buffa::DecodeError,
13172            > {
13173                self.0.to_owned_message()
13174            }
13175            /// The underlying bytes buffer.
13176            #[must_use]
13177            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13178                self.0.bytes()
13179            }
13180            /// Consume the handle, returning the underlying bytes buffer.
13181            #[must_use]
13182            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13183                self.0.into_bytes()
13184            }
13185        }
13186        impl ::core::convert::From<::buffa::OwnedView<TwapMarketIocView<'static>>>
13187        for TwapMarketIocOwnedView {
13188            fn from(inner: ::buffa::OwnedView<TwapMarketIocView<'static>>) -> Self {
13189                TwapMarketIocOwnedView(inner)
13190            }
13191        }
13192        impl ::core::convert::From<TwapMarketIocOwnedView>
13193        for ::buffa::OwnedView<TwapMarketIocView<'static>> {
13194            fn from(wrapper: TwapMarketIocOwnedView) -> Self {
13195                wrapper.0
13196            }
13197        }
13198        impl ::core::convert::AsRef<::buffa::OwnedView<TwapMarketIocView<'static>>>
13199        for TwapMarketIocOwnedView {
13200            fn as_ref(&self) -> &::buffa::OwnedView<TwapMarketIocView<'static>> {
13201                &self.0
13202            }
13203        }
13204        impl ::buffa::HasMessageView for super::super::TwapMarketIoc {
13205            type View<'a> = TwapMarketIocView<'a>;
13206            type ViewHandle = TwapMarketIocOwnedView;
13207        }
13208        impl ::serde::Serialize for TwapMarketIocOwnedView {
13209            fn serialize<__S: ::serde::Serializer>(
13210                &self,
13211                __s: __S,
13212            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13213                ::serde::Serialize::serialize(&self.0, __s)
13214            }
13215        }
13216        /// TwapLimitGtc configures one resting limit slice at a time. A previous open
13217        /// slice is canceled before the next interval.
13218        #[derive(Clone, Debug, Default)]
13219        pub struct TwapLimitGtcView<'a> {
13220            /// Slice limit price in quote units scaled by 1e6.
13221            ///
13222            /// Field 1: `price_ticks`
13223            pub price_ticks: i64,
13224            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13225        }
13226        impl<'a> ::buffa::MessageView<'a> for TwapLimitGtcView<'a> {
13227            type Owned = super::super::TwapLimitGtc;
13228            fn decode_view(
13229                buf: &'a [u8],
13230            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13231                let __limit = ::core::cell::Cell::new(
13232                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13233                );
13234                <Self as ::buffa::MessageView>::decode_view_ctx(
13235                    buf,
13236                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13237                )
13238            }
13239            fn decode_view_with_ctx(
13240                buf: &'a [u8],
13241                ctx: ::buffa::DecodeContext<'_>,
13242            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13243                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13244            }
13245            fn merge_view_field(
13246                &mut self,
13247                tag: ::buffa::encoding::Tag,
13248                cur: &'a [u8],
13249                before_tag: &'a [u8],
13250                ctx: ::buffa::DecodeContext<'_>,
13251            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13252                let _ = ctx;
13253                #[allow(unused_variables)]
13254                let view = self;
13255                let mut cur = cur;
13256                match tag.field_number() {
13257                    1u32 => {
13258                        ::buffa::encoding::check_wire_type(
13259                            tag,
13260                            ::buffa::encoding::WireType::Varint,
13261                        )?;
13262                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
13263                    }
13264                    _ => {
13265                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13266                        let span_len = before_tag.len() - cur.len();
13267                        view.__buffa_unknown_fields
13268                            .push_record(before_tag, span_len, ctx)?;
13269                    }
13270                }
13271                ::core::result::Result::Ok(cur)
13272            }
13273            fn to_owned_message(
13274                &self,
13275            ) -> ::core::result::Result<
13276                super::super::TwapLimitGtc,
13277                ::buffa::DecodeError,
13278            > {
13279                self.to_owned_from_source(None)
13280            }
13281            #[allow(clippy::useless_conversion, clippy::needless_update)]
13282            fn to_owned_from_source(
13283                &self,
13284                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13285            ) -> ::core::result::Result<
13286                super::super::TwapLimitGtc,
13287                ::buffa::DecodeError,
13288            > {
13289                #[allow(unused_imports)]
13290                use ::buffa::alloc::string::ToString as _;
13291                let _ = __buffa_src;
13292                ::core::result::Result::Ok(super::super::TwapLimitGtc {
13293                    price_ticks: self.price_ticks,
13294                    __buffa_unknown_fields: self
13295                        .__buffa_unknown_fields
13296                        .to_owned()?
13297                        .into(),
13298                    ..::core::default::Default::default()
13299                })
13300            }
13301        }
13302        impl<'a> ::buffa::ViewEncode<'a> for TwapLimitGtcView<'a> {
13303            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13304            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13305                #[allow(unused_imports)]
13306                use ::buffa::Enumeration as _;
13307                let mut size = 0u32;
13308                if self.price_ticks != 0i64 {
13309                    size
13310                        += 1u32
13311                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
13312                }
13313                size += self.__buffa_unknown_fields.encoded_len() as u32;
13314                size
13315            }
13316            #[allow(clippy::needless_borrow)]
13317            fn write_to(
13318                &self,
13319                _cache: &mut ::buffa::SizeCache,
13320                buf: &mut impl ::buffa::bytes::BufMut,
13321            ) {
13322                #[allow(unused_imports)]
13323                use ::buffa::Enumeration as _;
13324                if self.price_ticks != 0i64 {
13325                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
13326                }
13327                self.__buffa_unknown_fields.write_to(buf);
13328            }
13329        }
13330        /// Serializes this view as protobuf JSON.
13331        ///
13332        /// Implicit-presence fields with default values are omitted, `required`
13333        /// fields are always emitted, explicit-presence (`optional`) fields are
13334        /// emitted only when set, bytes fields are base64-encoded, and enum
13335        /// values are their proto name strings.
13336        ///
13337        /// This impl uses `serialize_map(None)` because the number of emitted
13338        /// fields depends on default-omission rules; serializers that require
13339        /// known map lengths (e.g. `bincode`) will return a runtime error.
13340        /// Use the owned message type for those formats.
13341        impl<'__a> ::serde::Serialize for TwapLimitGtcView<'__a> {
13342            fn serialize<__S: ::serde::Serializer>(
13343                &self,
13344                __s: __S,
13345            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13346                use ::serde::ser::SerializeMap as _;
13347                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13348                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
13349                    __map
13350                        .serialize_entry(
13351                            "priceTicks",
13352                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
13353                        )?;
13354                }
13355                __map.end()
13356            }
13357        }
13358        impl<'a> ::buffa::MessageName for TwapLimitGtcView<'a> {
13359            const PACKAGE: &'static str = "triggers.v1";
13360            const NAME: &'static str = "TwapLimitGtc";
13361            const FULL_NAME: &'static str = "triggers.v1.TwapLimitGtc";
13362            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
13363        }
13364        ::buffa::impl_default_view_instance!(TwapLimitGtcView);
13365        ::buffa::impl_view_reborrow!(TwapLimitGtcView);
13366        /** Self-contained, `'static` owned view of a `TwapLimitGtc` message.
13367
13368 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.
13369
13370 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.*/
13371        #[derive(Clone, Debug)]
13372        pub struct TwapLimitGtcOwnedView(::buffa::OwnedView<TwapLimitGtcView<'static>>);
13373        impl TwapLimitGtcOwnedView {
13374            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13375            ///
13376            /// The view borrows directly from the buffer's data; the buffer is
13377            /// retained inside the returned handle.
13378            ///
13379            /// # Errors
13380            ///
13381            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13382            /// protobuf data.
13383            pub fn decode(
13384                bytes: ::buffa::bytes::Bytes,
13385            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13386                ::core::result::Result::Ok(
13387                    TwapLimitGtcOwnedView(::buffa::OwnedView::decode(bytes)?),
13388                )
13389            }
13390            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13391            /// max message size).
13392            ///
13393            /// # Errors
13394            ///
13395            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13396            /// exceeds the configured limits.
13397            pub fn decode_with_options(
13398                bytes: ::buffa::bytes::Bytes,
13399                opts: &::buffa::DecodeOptions,
13400            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13401                ::core::result::Result::Ok(
13402                    TwapLimitGtcOwnedView(
13403                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13404                    ),
13405                )
13406            }
13407            /// Build from an owned message via an encode → decode round-trip.
13408            ///
13409            /// # Errors
13410            ///
13411            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13412            /// somehow invalid (should not happen for well-formed messages).
13413            pub fn from_owned(
13414                msg: &super::super::TwapLimitGtc,
13415            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13416                ::core::result::Result::Ok(
13417                    TwapLimitGtcOwnedView(::buffa::OwnedView::from_owned(msg)?),
13418                )
13419            }
13420            /// Borrow the full [`TwapLimitGtcView`] with its lifetime tied to `&self`.
13421            #[must_use]
13422            pub fn view(&self) -> &TwapLimitGtcView<'_> {
13423                self.0.reborrow()
13424            }
13425            /// Convert to the owned message type.
13426            ///
13427            /// # Errors
13428            ///
13429            /// Returns an error if re-materializing preserved unknown fields
13430            /// fails (e.g. the unknown-field limit is exceeded).
13431            pub fn to_owned_message(
13432                &self,
13433            ) -> ::core::result::Result<
13434                super::super::TwapLimitGtc,
13435                ::buffa::DecodeError,
13436            > {
13437                self.0.to_owned_message()
13438            }
13439            /// The underlying bytes buffer.
13440            #[must_use]
13441            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13442                self.0.bytes()
13443            }
13444            /// Consume the handle, returning the underlying bytes buffer.
13445            #[must_use]
13446            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13447                self.0.into_bytes()
13448            }
13449            /// Slice limit price in quote units scaled by 1e6.
13450            ///
13451            /// Field 1: `price_ticks`
13452            #[must_use]
13453            pub fn price_ticks(&self) -> i64 {
13454                self.0.reborrow().price_ticks
13455            }
13456        }
13457        impl ::core::convert::From<::buffa::OwnedView<TwapLimitGtcView<'static>>>
13458        for TwapLimitGtcOwnedView {
13459            fn from(inner: ::buffa::OwnedView<TwapLimitGtcView<'static>>) -> Self {
13460                TwapLimitGtcOwnedView(inner)
13461            }
13462        }
13463        impl ::core::convert::From<TwapLimitGtcOwnedView>
13464        for ::buffa::OwnedView<TwapLimitGtcView<'static>> {
13465            fn from(wrapper: TwapLimitGtcOwnedView) -> Self {
13466                wrapper.0
13467            }
13468        }
13469        impl ::core::convert::AsRef<::buffa::OwnedView<TwapLimitGtcView<'static>>>
13470        for TwapLimitGtcOwnedView {
13471            fn as_ref(&self) -> &::buffa::OwnedView<TwapLimitGtcView<'static>> {
13472                &self.0
13473            }
13474        }
13475        impl ::buffa::HasMessageView for super::super::TwapLimitGtc {
13476            type View<'a> = TwapLimitGtcView<'a>;
13477            type ViewHandle = TwapLimitGtcOwnedView;
13478        }
13479        impl ::serde::Serialize for TwapLimitGtcOwnedView {
13480            fn serialize<__S: ::serde::Serializer>(
13481                &self,
13482                __s: __S,
13483            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13484                ::serde::Serialize::serialize(&self.0, __s)
13485            }
13486        }
13487        /// TwapTrigger configures a proven TWAP execution mode.
13488        #[derive(Clone, Debug, Default)]
13489        pub struct TwapTriggerView<'a> {
13490            /// Child side.
13491            ///
13492            /// Field 1: `side`
13493            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
13494            /// Total execution duration in milliseconds.
13495            ///
13496            /// Field 2: `duration_ms`
13497            pub duration_ms: i64,
13498            /// Interval between slices in milliseconds.
13499            ///
13500            /// Field 3: `slice_interval_ms`
13501            pub slice_interval_ms: i64,
13502            pub execution: ::core::option::Option<
13503                super::super::__buffa::view::oneof::twap_trigger::Execution<'a>,
13504            >,
13505            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13506        }
13507        impl<'a> ::buffa::MessageView<'a> for TwapTriggerView<'a> {
13508            type Owned = super::super::TwapTrigger;
13509            fn decode_view(
13510                buf: &'a [u8],
13511            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13512                let __limit = ::core::cell::Cell::new(
13513                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13514                );
13515                <Self as ::buffa::MessageView>::decode_view_ctx(
13516                    buf,
13517                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13518                )
13519            }
13520            fn decode_view_with_ctx(
13521                buf: &'a [u8],
13522                ctx: ::buffa::DecodeContext<'_>,
13523            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13524                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13525            }
13526            fn merge_view_field(
13527                &mut self,
13528                tag: ::buffa::encoding::Tag,
13529                cur: &'a [u8],
13530                before_tag: &'a [u8],
13531                ctx: ::buffa::DecodeContext<'_>,
13532            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13533                let _ = ctx;
13534                #[allow(unused_variables)]
13535                let view = self;
13536                let mut cur = cur;
13537                match tag.field_number() {
13538                    1u32 => {
13539                        ::buffa::encoding::check_wire_type(
13540                            tag,
13541                            ::buffa::encoding::WireType::Varint,
13542                        )?;
13543                        view.side = ::buffa::EnumValue::from(
13544                            ::buffa::types::decode_int32(&mut cur)?,
13545                        );
13546                    }
13547                    2u32 => {
13548                        ::buffa::encoding::check_wire_type(
13549                            tag,
13550                            ::buffa::encoding::WireType::Varint,
13551                        )?;
13552                        view.duration_ms = ::buffa::types::decode_int64(&mut cur)?;
13553                    }
13554                    3u32 => {
13555                        ::buffa::encoding::check_wire_type(
13556                            tag,
13557                            ::buffa::encoding::WireType::Varint,
13558                        )?;
13559                        view.slice_interval_ms = ::buffa::types::decode_int64(&mut cur)?;
13560                    }
13561                    4u32 => {
13562                        ::buffa::encoding::check_wire_type(
13563                            tag,
13564                            ::buffa::encoding::WireType::LengthDelimited,
13565                        )?;
13566                        let __sub_ctx = ctx.descend()?;
13567                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13568                        if let Some(
13569                            super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13570                                ref mut existing,
13571                            ),
13572                        ) = view.execution
13573                        {
13574                            ::buffa::MessageView::merge_into_view(
13575                                &mut **existing,
13576                                sub,
13577                                __sub_ctx,
13578                            )?;
13579                        } else {
13580                            view.execution = Some(
13581                                super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13582                                    ::buffa::alloc::boxed::Box::new(
13583                                        <super::super::__buffa::view::TwapMarketIocView as ::buffa::MessageView>::decode_view_ctx(
13584                                            sub,
13585                                            __sub_ctx,
13586                                        )?,
13587                                    ),
13588                                ),
13589                            );
13590                        }
13591                    }
13592                    5u32 => {
13593                        ::buffa::encoding::check_wire_type(
13594                            tag,
13595                            ::buffa::encoding::WireType::LengthDelimited,
13596                        )?;
13597                        let __sub_ctx = ctx.descend()?;
13598                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13599                        if let Some(
13600                            super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13601                                ref mut existing,
13602                            ),
13603                        ) = view.execution
13604                        {
13605                            ::buffa::MessageView::merge_into_view(
13606                                &mut **existing,
13607                                sub,
13608                                __sub_ctx,
13609                            )?;
13610                        } else {
13611                            view.execution = Some(
13612                                super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13613                                    ::buffa::alloc::boxed::Box::new(
13614                                        <super::super::__buffa::view::TwapLimitGtcView as ::buffa::MessageView>::decode_view_ctx(
13615                                            sub,
13616                                            __sub_ctx,
13617                                        )?,
13618                                    ),
13619                                ),
13620                            );
13621                        }
13622                    }
13623                    _ => {
13624                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13625                        let span_len = before_tag.len() - cur.len();
13626                        view.__buffa_unknown_fields
13627                            .push_record(before_tag, span_len, ctx)?;
13628                    }
13629                }
13630                ::core::result::Result::Ok(cur)
13631            }
13632            fn to_owned_message(
13633                &self,
13634            ) -> ::core::result::Result<
13635                super::super::TwapTrigger,
13636                ::buffa::DecodeError,
13637            > {
13638                self.to_owned_from_source(None)
13639            }
13640            #[allow(clippy::useless_conversion, clippy::needless_update)]
13641            fn to_owned_from_source(
13642                &self,
13643                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13644            ) -> ::core::result::Result<
13645                super::super::TwapTrigger,
13646                ::buffa::DecodeError,
13647            > {
13648                #[allow(unused_imports)]
13649                use ::buffa::alloc::string::ToString as _;
13650                let _ = __buffa_src;
13651                ::core::result::Result::Ok(super::super::TwapTrigger {
13652                    side: self.side,
13653                    duration_ms: self.duration_ms,
13654                    slice_interval_ms: self.slice_interval_ms,
13655                    execution: match self.execution.as_ref() {
13656                        ::core::option::Option::Some(v) => {
13657                            ::core::option::Option::Some(
13658                                match v {
13659                                    super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13660                                        v,
13661                                    ) => {
13662                                        super::super::__buffa::oneof::twap_trigger::Execution::MarketIoc(
13663                                            ::buffa::alloc::boxed::Box::new(
13664                                                v.to_owned_from_source(__buffa_src)?,
13665                                            ),
13666                                        )
13667                                    }
13668                                    super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13669                                        v,
13670                                    ) => {
13671                                        super::super::__buffa::oneof::twap_trigger::Execution::LimitGtc(
13672                                            ::buffa::alloc::boxed::Box::new(
13673                                                v.to_owned_from_source(__buffa_src)?,
13674                                            ),
13675                                        )
13676                                    }
13677                                },
13678                            )
13679                        }
13680                        ::core::option::Option::None => ::core::option::Option::None,
13681                    },
13682                    __buffa_unknown_fields: self
13683                        .__buffa_unknown_fields
13684                        .to_owned()?
13685                        .into(),
13686                    ..::core::default::Default::default()
13687                })
13688            }
13689        }
13690        impl<'a> ::buffa::ViewEncode<'a> for TwapTriggerView<'a> {
13691            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13692            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
13693                #[allow(unused_imports)]
13694                use ::buffa::Enumeration as _;
13695                let mut size = 0u32;
13696                {
13697                    let val = self.side.to_i32();
13698                    if val != 0 {
13699                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
13700                    }
13701                }
13702                if self.duration_ms != 0i64 {
13703                    size
13704                        += 1u32
13705                            + ::buffa::types::int64_encoded_len(self.duration_ms) as u32;
13706                }
13707                if self.slice_interval_ms != 0i64 {
13708                    size
13709                        += 1u32
13710                            + ::buffa::types::int64_encoded_len(self.slice_interval_ms)
13711                                as u32;
13712                }
13713                if let ::core::option::Option::Some(ref v) = self.execution {
13714                    match v {
13715                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13716                            x,
13717                        ) => {
13718                            let __slot = __cache.reserve();
13719                            let inner = x.compute_size(__cache);
13720                            __cache.set(__slot, inner);
13721                            size
13722                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
13723                                    + inner;
13724                        }
13725                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13726                            x,
13727                        ) => {
13728                            let __slot = __cache.reserve();
13729                            let inner = x.compute_size(__cache);
13730                            __cache.set(__slot, inner);
13731                            size
13732                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
13733                                    + inner;
13734                        }
13735                    }
13736                }
13737                size += self.__buffa_unknown_fields.encoded_len() as u32;
13738                size
13739            }
13740            #[allow(clippy::needless_borrow)]
13741            fn write_to(
13742                &self,
13743                __cache: &mut ::buffa::SizeCache,
13744                buf: &mut impl ::buffa::bytes::BufMut,
13745            ) {
13746                #[allow(unused_imports)]
13747                use ::buffa::Enumeration as _;
13748                {
13749                    let val = self.side.to_i32();
13750                    if val != 0 {
13751                        ::buffa::types::put_int32_field(1u32, val, buf);
13752                    }
13753                }
13754                if self.duration_ms != 0i64 {
13755                    ::buffa::types::put_int64_field(2u32, self.duration_ms, buf);
13756                }
13757                if self.slice_interval_ms != 0i64 {
13758                    ::buffa::types::put_int64_field(3u32, self.slice_interval_ms, buf);
13759                }
13760                if let ::core::option::Option::Some(ref v) = self.execution {
13761                    match v {
13762                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13763                            x,
13764                        ) => {
13765                            ::buffa::types::put_len_delimited_header(
13766                                4u32,
13767                                __cache.consume_next(),
13768                                buf,
13769                            );
13770                            x.write_to(__cache, buf);
13771                        }
13772                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13773                            x,
13774                        ) => {
13775                            ::buffa::types::put_len_delimited_header(
13776                                5u32,
13777                                __cache.consume_next(),
13778                                buf,
13779                            );
13780                            x.write_to(__cache, buf);
13781                        }
13782                    }
13783                }
13784                self.__buffa_unknown_fields.write_to(buf);
13785            }
13786        }
13787        /// Serializes this view as protobuf JSON.
13788        ///
13789        /// Implicit-presence fields with default values are omitted, `required`
13790        /// fields are always emitted, explicit-presence (`optional`) fields are
13791        /// emitted only when set, bytes fields are base64-encoded, and enum
13792        /// values are their proto name strings.
13793        ///
13794        /// This impl uses `serialize_map(None)` because the number of emitted
13795        /// fields depends on default-omission rules; serializers that require
13796        /// known map lengths (e.g. `bincode`) will return a runtime error.
13797        /// Use the owned message type for those formats.
13798        impl<'__a> ::serde::Serialize for TwapTriggerView<'__a> {
13799            fn serialize<__S: ::serde::Serializer>(
13800                &self,
13801                __s: __S,
13802            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13803                use ::serde::ser::SerializeMap as _;
13804                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13805                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
13806                    __map.serialize_entry("side", &self.side)?;
13807                }
13808                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.duration_ms) {
13809                    __map
13810                        .serialize_entry(
13811                            "durationMs",
13812                            &::buffa::json_helpers::ProtoJson(&self.duration_ms),
13813                        )?;
13814                }
13815                if !::buffa::json_helpers::skip_if::is_zero_i64(
13816                    &self.slice_interval_ms,
13817                ) {
13818                    __map
13819                        .serialize_entry(
13820                            "sliceIntervalMs",
13821                            &::buffa::json_helpers::ProtoJson(&self.slice_interval_ms),
13822                        )?;
13823                }
13824                if let ::core::option::Option::Some(ref __ov) = self.execution {
13825                    match __ov {
13826                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13827                            v,
13828                        ) => {
13829                            __map.serialize_entry("marketIoc", v)?;
13830                        }
13831                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13832                            v,
13833                        ) => {
13834                            __map.serialize_entry("limitGtc", v)?;
13835                        }
13836                    }
13837                }
13838                __map.end()
13839            }
13840        }
13841        impl<'a> ::buffa::MessageName for TwapTriggerView<'a> {
13842            const PACKAGE: &'static str = "triggers.v1";
13843            const NAME: &'static str = "TwapTrigger";
13844            const FULL_NAME: &'static str = "triggers.v1.TwapTrigger";
13845            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
13846        }
13847        ::buffa::impl_default_view_instance!(TwapTriggerView);
13848        ::buffa::impl_view_reborrow!(TwapTriggerView);
13849        /** Self-contained, `'static` owned view of a `TwapTrigger` message.
13850
13851 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.
13852
13853 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.*/
13854        #[derive(Clone, Debug)]
13855        pub struct TwapTriggerOwnedView(::buffa::OwnedView<TwapTriggerView<'static>>);
13856        impl TwapTriggerOwnedView {
13857            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13858            ///
13859            /// The view borrows directly from the buffer's data; the buffer is
13860            /// retained inside the returned handle.
13861            ///
13862            /// # Errors
13863            ///
13864            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13865            /// protobuf data.
13866            pub fn decode(
13867                bytes: ::buffa::bytes::Bytes,
13868            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13869                ::core::result::Result::Ok(
13870                    TwapTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
13871                )
13872            }
13873            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13874            /// max message size).
13875            ///
13876            /// # Errors
13877            ///
13878            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13879            /// exceeds the configured limits.
13880            pub fn decode_with_options(
13881                bytes: ::buffa::bytes::Bytes,
13882                opts: &::buffa::DecodeOptions,
13883            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13884                ::core::result::Result::Ok(
13885                    TwapTriggerOwnedView(
13886                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13887                    ),
13888                )
13889            }
13890            /// Build from an owned message via an encode → decode round-trip.
13891            ///
13892            /// # Errors
13893            ///
13894            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13895            /// somehow invalid (should not happen for well-formed messages).
13896            pub fn from_owned(
13897                msg: &super::super::TwapTrigger,
13898            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13899                ::core::result::Result::Ok(
13900                    TwapTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
13901                )
13902            }
13903            /// Borrow the full [`TwapTriggerView`] with its lifetime tied to `&self`.
13904            #[must_use]
13905            pub fn view(&self) -> &TwapTriggerView<'_> {
13906                self.0.reborrow()
13907            }
13908            /// Convert to the owned message type.
13909            ///
13910            /// # Errors
13911            ///
13912            /// Returns an error if re-materializing preserved unknown fields
13913            /// fails (e.g. the unknown-field limit is exceeded).
13914            pub fn to_owned_message(
13915                &self,
13916            ) -> ::core::result::Result<
13917                super::super::TwapTrigger,
13918                ::buffa::DecodeError,
13919            > {
13920                self.0.to_owned_message()
13921            }
13922            /// The underlying bytes buffer.
13923            #[must_use]
13924            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13925                self.0.bytes()
13926            }
13927            /// Consume the handle, returning the underlying bytes buffer.
13928            #[must_use]
13929            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13930                self.0.into_bytes()
13931            }
13932            /// Child side.
13933            ///
13934            /// Field 1: `side`
13935            #[must_use]
13936            pub fn side(
13937                &self,
13938            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
13939                self.0.reborrow().side
13940            }
13941            /// Total execution duration in milliseconds.
13942            ///
13943            /// Field 2: `duration_ms`
13944            #[must_use]
13945            pub fn duration_ms(&self) -> i64 {
13946                self.0.reborrow().duration_ms
13947            }
13948            /// Interval between slices in milliseconds.
13949            ///
13950            /// Field 3: `slice_interval_ms`
13951            #[must_use]
13952            pub fn slice_interval_ms(&self) -> i64 {
13953                self.0.reborrow().slice_interval_ms
13954            }
13955            /// Oneof `execution`.
13956            #[must_use]
13957            pub fn execution(
13958                &self,
13959            ) -> ::core::option::Option<
13960                &super::super::__buffa::view::oneof::twap_trigger::Execution<'_>,
13961            > {
13962                self.0.reborrow().execution.as_ref()
13963            }
13964        }
13965        impl ::core::convert::From<::buffa::OwnedView<TwapTriggerView<'static>>>
13966        for TwapTriggerOwnedView {
13967            fn from(inner: ::buffa::OwnedView<TwapTriggerView<'static>>) -> Self {
13968                TwapTriggerOwnedView(inner)
13969            }
13970        }
13971        impl ::core::convert::From<TwapTriggerOwnedView>
13972        for ::buffa::OwnedView<TwapTriggerView<'static>> {
13973            fn from(wrapper: TwapTriggerOwnedView) -> Self {
13974                wrapper.0
13975            }
13976        }
13977        impl ::core::convert::AsRef<::buffa::OwnedView<TwapTriggerView<'static>>>
13978        for TwapTriggerOwnedView {
13979            fn as_ref(&self) -> &::buffa::OwnedView<TwapTriggerView<'static>> {
13980                &self.0
13981            }
13982        }
13983        impl ::buffa::HasMessageView for super::super::TwapTrigger {
13984            type View<'a> = TwapTriggerView<'a>;
13985            type ViewHandle = TwapTriggerOwnedView;
13986        }
13987        impl ::serde::Serialize for TwapTriggerOwnedView {
13988            fn serialize<__S: ::serde::Serializer>(
13989                &self,
13990                __s: __S,
13991            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13992                ::serde::Serialize::serialize(&self.0, __s)
13993            }
13994        }
13995        /// LadderTrigger configures the supported LINEAR limit-GTC ladder. All levels
13996        /// are admitted immediately and may rest concurrently.
13997        #[derive(Clone, Debug, Default)]
13998        pub struct LadderTriggerView<'a> {
13999            /// Child side.
14000            ///
14001            /// Field 1: `side`
14002            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
14003            /// Minimum generated level price in quote units scaled by 1e6.
14004            ///
14005            /// Field 2: `price_min_ticks`
14006            pub price_min_ticks: i64,
14007            /// Maximum generated level price in quote units scaled by 1e6.
14008            ///
14009            /// Field 3: `price_max_ticks`
14010            pub price_max_ticks: i64,
14011            /// Number of linearly distributed levels.
14012            ///
14013            /// Field 4: `levels`
14014            pub levels: i32,
14015            /// Reject each level instead of taking liquidity.
14016            ///
14017            /// Field 5: `post_only`
14018            pub post_only: bool,
14019            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14020        }
14021        impl<'a> ::buffa::MessageView<'a> for LadderTriggerView<'a> {
14022            type Owned = super::super::LadderTrigger;
14023            fn decode_view(
14024                buf: &'a [u8],
14025            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14026                let __limit = ::core::cell::Cell::new(
14027                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14028                );
14029                <Self as ::buffa::MessageView>::decode_view_ctx(
14030                    buf,
14031                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14032                )
14033            }
14034            fn decode_view_with_ctx(
14035                buf: &'a [u8],
14036                ctx: ::buffa::DecodeContext<'_>,
14037            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14038                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14039            }
14040            fn merge_view_field(
14041                &mut self,
14042                tag: ::buffa::encoding::Tag,
14043                cur: &'a [u8],
14044                before_tag: &'a [u8],
14045                ctx: ::buffa::DecodeContext<'_>,
14046            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14047                let _ = ctx;
14048                #[allow(unused_variables)]
14049                let view = self;
14050                let mut cur = cur;
14051                match tag.field_number() {
14052                    1u32 => {
14053                        ::buffa::encoding::check_wire_type(
14054                            tag,
14055                            ::buffa::encoding::WireType::Varint,
14056                        )?;
14057                        view.side = ::buffa::EnumValue::from(
14058                            ::buffa::types::decode_int32(&mut cur)?,
14059                        );
14060                    }
14061                    2u32 => {
14062                        ::buffa::encoding::check_wire_type(
14063                            tag,
14064                            ::buffa::encoding::WireType::Varint,
14065                        )?;
14066                        view.price_min_ticks = ::buffa::types::decode_int64(&mut cur)?;
14067                    }
14068                    3u32 => {
14069                        ::buffa::encoding::check_wire_type(
14070                            tag,
14071                            ::buffa::encoding::WireType::Varint,
14072                        )?;
14073                        view.price_max_ticks = ::buffa::types::decode_int64(&mut cur)?;
14074                    }
14075                    4u32 => {
14076                        ::buffa::encoding::check_wire_type(
14077                            tag,
14078                            ::buffa::encoding::WireType::Varint,
14079                        )?;
14080                        view.levels = ::buffa::types::decode_int32(&mut cur)?;
14081                    }
14082                    5u32 => {
14083                        ::buffa::encoding::check_wire_type(
14084                            tag,
14085                            ::buffa::encoding::WireType::Varint,
14086                        )?;
14087                        view.post_only = ::buffa::types::decode_bool(&mut cur)?;
14088                    }
14089                    _ => {
14090                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14091                        let span_len = before_tag.len() - cur.len();
14092                        view.__buffa_unknown_fields
14093                            .push_record(before_tag, span_len, ctx)?;
14094                    }
14095                }
14096                ::core::result::Result::Ok(cur)
14097            }
14098            fn to_owned_message(
14099                &self,
14100            ) -> ::core::result::Result<
14101                super::super::LadderTrigger,
14102                ::buffa::DecodeError,
14103            > {
14104                self.to_owned_from_source(None)
14105            }
14106            #[allow(clippy::useless_conversion, clippy::needless_update)]
14107            fn to_owned_from_source(
14108                &self,
14109                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14110            ) -> ::core::result::Result<
14111                super::super::LadderTrigger,
14112                ::buffa::DecodeError,
14113            > {
14114                #[allow(unused_imports)]
14115                use ::buffa::alloc::string::ToString as _;
14116                let _ = __buffa_src;
14117                ::core::result::Result::Ok(super::super::LadderTrigger {
14118                    side: self.side,
14119                    price_min_ticks: self.price_min_ticks,
14120                    price_max_ticks: self.price_max_ticks,
14121                    levels: self.levels,
14122                    post_only: self.post_only,
14123                    __buffa_unknown_fields: self
14124                        .__buffa_unknown_fields
14125                        .to_owned()?
14126                        .into(),
14127                    ..::core::default::Default::default()
14128                })
14129            }
14130        }
14131        impl<'a> ::buffa::ViewEncode<'a> for LadderTriggerView<'a> {
14132            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14133            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
14134                #[allow(unused_imports)]
14135                use ::buffa::Enumeration as _;
14136                let mut size = 0u32;
14137                {
14138                    let val = self.side.to_i32();
14139                    if val != 0 {
14140                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14141                    }
14142                }
14143                if self.price_min_ticks != 0i64 {
14144                    size
14145                        += 1u32
14146                            + ::buffa::types::int64_encoded_len(self.price_min_ticks)
14147                                as u32;
14148                }
14149                if self.price_max_ticks != 0i64 {
14150                    size
14151                        += 1u32
14152                            + ::buffa::types::int64_encoded_len(self.price_max_ticks)
14153                                as u32;
14154                }
14155                if self.levels != 0i32 {
14156                    size += 1u32 + ::buffa::types::int32_encoded_len(self.levels) as u32;
14157                }
14158                if self.post_only {
14159                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14160                }
14161                size += self.__buffa_unknown_fields.encoded_len() as u32;
14162                size
14163            }
14164            #[allow(clippy::needless_borrow)]
14165            fn write_to(
14166                &self,
14167                _cache: &mut ::buffa::SizeCache,
14168                buf: &mut impl ::buffa::bytes::BufMut,
14169            ) {
14170                #[allow(unused_imports)]
14171                use ::buffa::Enumeration as _;
14172                {
14173                    let val = self.side.to_i32();
14174                    if val != 0 {
14175                        ::buffa::types::put_int32_field(1u32, val, buf);
14176                    }
14177                }
14178                if self.price_min_ticks != 0i64 {
14179                    ::buffa::types::put_int64_field(2u32, self.price_min_ticks, buf);
14180                }
14181                if self.price_max_ticks != 0i64 {
14182                    ::buffa::types::put_int64_field(3u32, self.price_max_ticks, buf);
14183                }
14184                if self.levels != 0i32 {
14185                    ::buffa::types::put_int32_field(4u32, self.levels, buf);
14186                }
14187                if self.post_only {
14188                    ::buffa::types::put_bool_field(5u32, self.post_only, buf);
14189                }
14190                self.__buffa_unknown_fields.write_to(buf);
14191            }
14192        }
14193        /// Serializes this view as protobuf JSON.
14194        ///
14195        /// Implicit-presence fields with default values are omitted, `required`
14196        /// fields are always emitted, explicit-presence (`optional`) fields are
14197        /// emitted only when set, bytes fields are base64-encoded, and enum
14198        /// values are their proto name strings.
14199        ///
14200        /// This impl uses `serialize_map(None)` because the number of emitted
14201        /// fields depends on default-omission rules; serializers that require
14202        /// known map lengths (e.g. `bincode`) will return a runtime error.
14203        /// Use the owned message type for those formats.
14204        impl<'__a> ::serde::Serialize for LadderTriggerView<'__a> {
14205            fn serialize<__S: ::serde::Serializer>(
14206                &self,
14207                __s: __S,
14208            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14209                use ::serde::ser::SerializeMap as _;
14210                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14211                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
14212                    __map.serialize_entry("side", &self.side)?;
14213                }
14214                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_min_ticks) {
14215                    __map
14216                        .serialize_entry(
14217                            "priceMinTicks",
14218                            &::buffa::json_helpers::ProtoJson(&self.price_min_ticks),
14219                        )?;
14220                }
14221                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_max_ticks) {
14222                    __map
14223                        .serialize_entry(
14224                            "priceMaxTicks",
14225                            &::buffa::json_helpers::ProtoJson(&self.price_max_ticks),
14226                        )?;
14227                }
14228                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.levels) {
14229                    __map
14230                        .serialize_entry(
14231                            "levels",
14232                            &::buffa::json_helpers::ProtoJson(&self.levels),
14233                        )?;
14234                }
14235                if self.post_only {
14236                    __map.serialize_entry("postOnly", &self.post_only)?;
14237                }
14238                __map.end()
14239            }
14240        }
14241        impl<'a> ::buffa::MessageName for LadderTriggerView<'a> {
14242            const PACKAGE: &'static str = "triggers.v1";
14243            const NAME: &'static str = "LadderTrigger";
14244            const FULL_NAME: &'static str = "triggers.v1.LadderTrigger";
14245            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
14246        }
14247        ::buffa::impl_default_view_instance!(LadderTriggerView);
14248        ::buffa::impl_view_reborrow!(LadderTriggerView);
14249        /** Self-contained, `'static` owned view of a `LadderTrigger` message.
14250
14251 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.
14252
14253 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.*/
14254        #[derive(Clone, Debug)]
14255        pub struct LadderTriggerOwnedView(
14256            ::buffa::OwnedView<LadderTriggerView<'static>>,
14257        );
14258        impl LadderTriggerOwnedView {
14259            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
14260            ///
14261            /// The view borrows directly from the buffer's data; the buffer is
14262            /// retained inside the returned handle.
14263            ///
14264            /// # Errors
14265            ///
14266            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
14267            /// protobuf data.
14268            pub fn decode(
14269                bytes: ::buffa::bytes::Bytes,
14270            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14271                ::core::result::Result::Ok(
14272                    LadderTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
14273                )
14274            }
14275            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
14276            /// max message size).
14277            ///
14278            /// # Errors
14279            ///
14280            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
14281            /// exceeds the configured limits.
14282            pub fn decode_with_options(
14283                bytes: ::buffa::bytes::Bytes,
14284                opts: &::buffa::DecodeOptions,
14285            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14286                ::core::result::Result::Ok(
14287                    LadderTriggerOwnedView(
14288                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
14289                    ),
14290                )
14291            }
14292            /// Build from an owned message via an encode → decode round-trip.
14293            ///
14294            /// # Errors
14295            ///
14296            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
14297            /// somehow invalid (should not happen for well-formed messages).
14298            pub fn from_owned(
14299                msg: &super::super::LadderTrigger,
14300            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14301                ::core::result::Result::Ok(
14302                    LadderTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
14303                )
14304            }
14305            /// Borrow the full [`LadderTriggerView`] with its lifetime tied to `&self`.
14306            #[must_use]
14307            pub fn view(&self) -> &LadderTriggerView<'_> {
14308                self.0.reborrow()
14309            }
14310            /// Convert to the owned message type.
14311            ///
14312            /// # Errors
14313            ///
14314            /// Returns an error if re-materializing preserved unknown fields
14315            /// fails (e.g. the unknown-field limit is exceeded).
14316            pub fn to_owned_message(
14317                &self,
14318            ) -> ::core::result::Result<
14319                super::super::LadderTrigger,
14320                ::buffa::DecodeError,
14321            > {
14322                self.0.to_owned_message()
14323            }
14324            /// The underlying bytes buffer.
14325            #[must_use]
14326            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
14327                self.0.bytes()
14328            }
14329            /// Consume the handle, returning the underlying bytes buffer.
14330            #[must_use]
14331            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
14332                self.0.into_bytes()
14333            }
14334            /// Child side.
14335            ///
14336            /// Field 1: `side`
14337            #[must_use]
14338            pub fn side(
14339                &self,
14340            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
14341                self.0.reborrow().side
14342            }
14343            /// Minimum generated level price in quote units scaled by 1e6.
14344            ///
14345            /// Field 2: `price_min_ticks`
14346            #[must_use]
14347            pub fn price_min_ticks(&self) -> i64 {
14348                self.0.reborrow().price_min_ticks
14349            }
14350            /// Maximum generated level price in quote units scaled by 1e6.
14351            ///
14352            /// Field 3: `price_max_ticks`
14353            #[must_use]
14354            pub fn price_max_ticks(&self) -> i64 {
14355                self.0.reborrow().price_max_ticks
14356            }
14357            /// Number of linearly distributed levels.
14358            ///
14359            /// Field 4: `levels`
14360            #[must_use]
14361            pub fn levels(&self) -> i32 {
14362                self.0.reborrow().levels
14363            }
14364            /// Reject each level instead of taking liquidity.
14365            ///
14366            /// Field 5: `post_only`
14367            #[must_use]
14368            pub fn post_only(&self) -> bool {
14369                self.0.reborrow().post_only
14370            }
14371        }
14372        impl ::core::convert::From<::buffa::OwnedView<LadderTriggerView<'static>>>
14373        for LadderTriggerOwnedView {
14374            fn from(inner: ::buffa::OwnedView<LadderTriggerView<'static>>) -> Self {
14375                LadderTriggerOwnedView(inner)
14376            }
14377        }
14378        impl ::core::convert::From<LadderTriggerOwnedView>
14379        for ::buffa::OwnedView<LadderTriggerView<'static>> {
14380            fn from(wrapper: LadderTriggerOwnedView) -> Self {
14381                wrapper.0
14382            }
14383        }
14384        impl ::core::convert::AsRef<::buffa::OwnedView<LadderTriggerView<'static>>>
14385        for LadderTriggerOwnedView {
14386            fn as_ref(&self) -> &::buffa::OwnedView<LadderTriggerView<'static>> {
14387                &self.0
14388            }
14389        }
14390        impl ::buffa::HasMessageView for super::super::LadderTrigger {
14391            type View<'a> = LadderTriggerView<'a>;
14392            type ViewHandle = LadderTriggerOwnedView;
14393        }
14394        impl ::serde::Serialize for LadderTriggerOwnedView {
14395            fn serialize<__S: ::serde::Serializer>(
14396                &self,
14397                __s: __S,
14398            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14399                ::serde::Serialize::serialize(&self.0, __s)
14400            }
14401        }
14402        /// TriggerIntent contains one standalone trigger's immutable configuration.
14403        #[derive(Clone, Debug, Default)]
14404        pub struct TriggerIntentView<'a> {
14405            /// Symbol, for example "BTC-USDT".
14406            ///
14407            /// Field 1: `symbol`
14408            pub symbol: &'a str,
14409            /// Total quantity scaled by the pair's base_quantity_scale.
14410            ///
14411            /// Field 2: `qty_scaled`
14412            pub qty_scaled: i64,
14413            /// Fee asset for BUY children. SELL children must use QUOTE.
14414            ///
14415            /// Field 3: `fee_asset`
14416            pub fee_asset: ::buffa::EnumValue<
14417                super::super::super::super::orders::v1::FeeAsset,
14418            >,
14419            /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
14420            ///
14421            /// Field 4: `self_trade_prevention_mode`
14422            pub self_trade_prevention_mode: ::buffa::EnumValue<
14423                super::super::super::super::orders::v1::SelfTradePreventionMode,
14424            >,
14425            /// Client-provided trigger ID for idempotency.
14426            ///
14427            /// Field 5: `client_trigger_id`
14428            pub client_trigger_id: &'a str,
14429            pub strategy: ::core::option::Option<
14430                super::super::__buffa::view::oneof::trigger_intent::Strategy<'a>,
14431            >,
14432            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14433        }
14434        impl<'a> ::buffa::MessageView<'a> for TriggerIntentView<'a> {
14435            type Owned = super::super::TriggerIntent;
14436            fn decode_view(
14437                buf: &'a [u8],
14438            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14439                let __limit = ::core::cell::Cell::new(
14440                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14441                );
14442                <Self as ::buffa::MessageView>::decode_view_ctx(
14443                    buf,
14444                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14445                )
14446            }
14447            fn decode_view_with_ctx(
14448                buf: &'a [u8],
14449                ctx: ::buffa::DecodeContext<'_>,
14450            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14451                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14452            }
14453            fn merge_view_field(
14454                &mut self,
14455                tag: ::buffa::encoding::Tag,
14456                cur: &'a [u8],
14457                before_tag: &'a [u8],
14458                ctx: ::buffa::DecodeContext<'_>,
14459            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14460                let _ = ctx;
14461                #[allow(unused_variables)]
14462                let view = self;
14463                let mut cur = cur;
14464                match tag.field_number() {
14465                    1u32 => {
14466                        ::buffa::encoding::check_wire_type(
14467                            tag,
14468                            ::buffa::encoding::WireType::LengthDelimited,
14469                        )?;
14470                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
14471                    }
14472                    2u32 => {
14473                        ::buffa::encoding::check_wire_type(
14474                            tag,
14475                            ::buffa::encoding::WireType::Varint,
14476                        )?;
14477                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
14478                    }
14479                    3u32 => {
14480                        ::buffa::encoding::check_wire_type(
14481                            tag,
14482                            ::buffa::encoding::WireType::Varint,
14483                        )?;
14484                        view.fee_asset = ::buffa::EnumValue::from(
14485                            ::buffa::types::decode_int32(&mut cur)?,
14486                        );
14487                    }
14488                    4u32 => {
14489                        ::buffa::encoding::check_wire_type(
14490                            tag,
14491                            ::buffa::encoding::WireType::Varint,
14492                        )?;
14493                        view.self_trade_prevention_mode = ::buffa::EnumValue::from(
14494                            ::buffa::types::decode_int32(&mut cur)?,
14495                        );
14496                    }
14497                    5u32 => {
14498                        ::buffa::encoding::check_wire_type(
14499                            tag,
14500                            ::buffa::encoding::WireType::LengthDelimited,
14501                        )?;
14502                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
14503                    }
14504                    10u32 => {
14505                        ::buffa::encoding::check_wire_type(
14506                            tag,
14507                            ::buffa::encoding::WireType::LengthDelimited,
14508                        )?;
14509                        let __sub_ctx = ctx.descend()?;
14510                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14511                        if let Some(
14512                            super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14513                                ref mut existing,
14514                            ),
14515                        ) = view.strategy
14516                        {
14517                            ::buffa::MessageView::merge_into_view(
14518                                &mut **existing,
14519                                sub,
14520                                __sub_ctx,
14521                            )?;
14522                        } else {
14523                            view.strategy = Some(
14524                                super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14525                                    ::buffa::alloc::boxed::Box::new(
14526                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
14527                                            sub,
14528                                            __sub_ctx,
14529                                        )?,
14530                                    ),
14531                                ),
14532                            );
14533                        }
14534                    }
14535                    11u32 => {
14536                        ::buffa::encoding::check_wire_type(
14537                            tag,
14538                            ::buffa::encoding::WireType::LengthDelimited,
14539                        )?;
14540                        let __sub_ctx = ctx.descend()?;
14541                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14542                        if let Some(
14543                            super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14544                                ref mut existing,
14545                            ),
14546                        ) = view.strategy
14547                        {
14548                            ::buffa::MessageView::merge_into_view(
14549                                &mut **existing,
14550                                sub,
14551                                __sub_ctx,
14552                            )?;
14553                        } else {
14554                            view.strategy = Some(
14555                                super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14556                                    ::buffa::alloc::boxed::Box::new(
14557                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
14558                                            sub,
14559                                            __sub_ctx,
14560                                        )?,
14561                                    ),
14562                                ),
14563                            );
14564                        }
14565                    }
14566                    12u32 => {
14567                        ::buffa::encoding::check_wire_type(
14568                            tag,
14569                            ::buffa::encoding::WireType::LengthDelimited,
14570                        )?;
14571                        let __sub_ctx = ctx.descend()?;
14572                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14573                        if let Some(
14574                            super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14575                                ref mut existing,
14576                            ),
14577                        ) = view.strategy
14578                        {
14579                            ::buffa::MessageView::merge_into_view(
14580                                &mut **existing,
14581                                sub,
14582                                __sub_ctx,
14583                            )?;
14584                        } else {
14585                            view.strategy = Some(
14586                                super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14587                                    ::buffa::alloc::boxed::Box::new(
14588                                        <super::super::__buffa::view::TrailingStopTriggerView as ::buffa::MessageView>::decode_view_ctx(
14589                                            sub,
14590                                            __sub_ctx,
14591                                        )?,
14592                                    ),
14593                                ),
14594                            );
14595                        }
14596                    }
14597                    13u32 => {
14598                        ::buffa::encoding::check_wire_type(
14599                            tag,
14600                            ::buffa::encoding::WireType::LengthDelimited,
14601                        )?;
14602                        let __sub_ctx = ctx.descend()?;
14603                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14604                        if let Some(
14605                            super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14606                                ref mut existing,
14607                            ),
14608                        ) = view.strategy
14609                        {
14610                            ::buffa::MessageView::merge_into_view(
14611                                &mut **existing,
14612                                sub,
14613                                __sub_ctx,
14614                            )?;
14615                        } else {
14616                            view.strategy = Some(
14617                                super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14618                                    ::buffa::alloc::boxed::Box::new(
14619                                        <super::super::__buffa::view::TwapTriggerView as ::buffa::MessageView>::decode_view_ctx(
14620                                            sub,
14621                                            __sub_ctx,
14622                                        )?,
14623                                    ),
14624                                ),
14625                            );
14626                        }
14627                    }
14628                    14u32 => {
14629                        ::buffa::encoding::check_wire_type(
14630                            tag,
14631                            ::buffa::encoding::WireType::LengthDelimited,
14632                        )?;
14633                        let __sub_ctx = ctx.descend()?;
14634                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14635                        if let Some(
14636                            super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14637                                ref mut existing,
14638                            ),
14639                        ) = view.strategy
14640                        {
14641                            ::buffa::MessageView::merge_into_view(
14642                                &mut **existing,
14643                                sub,
14644                                __sub_ctx,
14645                            )?;
14646                        } else {
14647                            view.strategy = Some(
14648                                super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14649                                    ::buffa::alloc::boxed::Box::new(
14650                                        <super::super::__buffa::view::LadderTriggerView as ::buffa::MessageView>::decode_view_ctx(
14651                                            sub,
14652                                            __sub_ctx,
14653                                        )?,
14654                                    ),
14655                                ),
14656                            );
14657                        }
14658                    }
14659                    _ => {
14660                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14661                        let span_len = before_tag.len() - cur.len();
14662                        view.__buffa_unknown_fields
14663                            .push_record(before_tag, span_len, ctx)?;
14664                    }
14665                }
14666                ::core::result::Result::Ok(cur)
14667            }
14668            fn to_owned_message(
14669                &self,
14670            ) -> ::core::result::Result<
14671                super::super::TriggerIntent,
14672                ::buffa::DecodeError,
14673            > {
14674                self.to_owned_from_source(None)
14675            }
14676            #[allow(clippy::useless_conversion, clippy::needless_update)]
14677            fn to_owned_from_source(
14678                &self,
14679                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14680            ) -> ::core::result::Result<
14681                super::super::TriggerIntent,
14682                ::buffa::DecodeError,
14683            > {
14684                #[allow(unused_imports)]
14685                use ::buffa::alloc::string::ToString as _;
14686                let _ = __buffa_src;
14687                ::core::result::Result::Ok(super::super::TriggerIntent {
14688                    symbol: self.symbol.to_string(),
14689                    qty_scaled: self.qty_scaled,
14690                    fee_asset: self.fee_asset,
14691                    self_trade_prevention_mode: self.self_trade_prevention_mode,
14692                    client_trigger_id: self.client_trigger_id.to_string(),
14693                    strategy: match self.strategy.as_ref() {
14694                        ::core::option::Option::Some(v) => {
14695                            ::core::option::Option::Some(
14696                                match v {
14697                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14698                                        v,
14699                                    ) => {
14700                                        super::super::__buffa::oneof::trigger_intent::Strategy::StopLoss(
14701                                            ::buffa::alloc::boxed::Box::new(
14702                                                v.to_owned_from_source(__buffa_src)?,
14703                                            ),
14704                                        )
14705                                    }
14706                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14707                                        v,
14708                                    ) => {
14709                                        super::super::__buffa::oneof::trigger_intent::Strategy::TakeProfit(
14710                                            ::buffa::alloc::boxed::Box::new(
14711                                                v.to_owned_from_source(__buffa_src)?,
14712                                            ),
14713                                        )
14714                                    }
14715                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14716                                        v,
14717                                    ) => {
14718                                        super::super::__buffa::oneof::trigger_intent::Strategy::TrailingStop(
14719                                            ::buffa::alloc::boxed::Box::new(
14720                                                v.to_owned_from_source(__buffa_src)?,
14721                                            ),
14722                                        )
14723                                    }
14724                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14725                                        v,
14726                                    ) => {
14727                                        super::super::__buffa::oneof::trigger_intent::Strategy::Twap(
14728                                            ::buffa::alloc::boxed::Box::new(
14729                                                v.to_owned_from_source(__buffa_src)?,
14730                                            ),
14731                                        )
14732                                    }
14733                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14734                                        v,
14735                                    ) => {
14736                                        super::super::__buffa::oneof::trigger_intent::Strategy::Ladder(
14737                                            ::buffa::alloc::boxed::Box::new(
14738                                                v.to_owned_from_source(__buffa_src)?,
14739                                            ),
14740                                        )
14741                                    }
14742                                },
14743                            )
14744                        }
14745                        ::core::option::Option::None => ::core::option::Option::None,
14746                    },
14747                    __buffa_unknown_fields: self
14748                        .__buffa_unknown_fields
14749                        .to_owned()?
14750                        .into(),
14751                    ..::core::default::Default::default()
14752                })
14753            }
14754        }
14755        impl<'a> ::buffa::ViewEncode<'a> for TriggerIntentView<'a> {
14756            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14757            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14758                #[allow(unused_imports)]
14759                use ::buffa::Enumeration as _;
14760                let mut size = 0u32;
14761                if !self.symbol.is_empty() {
14762                    size
14763                        += 1u32
14764                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
14765                }
14766                if self.qty_scaled != 0i64 {
14767                    size
14768                        += 1u32
14769                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
14770                }
14771                {
14772                    let val = self.fee_asset.to_i32();
14773                    if val != 0 {
14774                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14775                    }
14776                }
14777                {
14778                    let val = self.self_trade_prevention_mode.to_i32();
14779                    if val != 0 {
14780                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14781                    }
14782                }
14783                if !self.client_trigger_id.is_empty() {
14784                    size
14785                        += 1u32
14786                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
14787                                as u32;
14788                }
14789                if let ::core::option::Option::Some(ref v) = self.strategy {
14790                    match v {
14791                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14792                            x,
14793                        ) => {
14794                            let __slot = __cache.reserve();
14795                            let inner = x.compute_size(__cache);
14796                            __cache.set(__slot, inner);
14797                            size
14798                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14799                                    + inner;
14800                        }
14801                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14802                            x,
14803                        ) => {
14804                            let __slot = __cache.reserve();
14805                            let inner = x.compute_size(__cache);
14806                            __cache.set(__slot, inner);
14807                            size
14808                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14809                                    + inner;
14810                        }
14811                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14812                            x,
14813                        ) => {
14814                            let __slot = __cache.reserve();
14815                            let inner = x.compute_size(__cache);
14816                            __cache.set(__slot, inner);
14817                            size
14818                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14819                                    + inner;
14820                        }
14821                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14822                            x,
14823                        ) => {
14824                            let __slot = __cache.reserve();
14825                            let inner = x.compute_size(__cache);
14826                            __cache.set(__slot, inner);
14827                            size
14828                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14829                                    + inner;
14830                        }
14831                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14832                            x,
14833                        ) => {
14834                            let __slot = __cache.reserve();
14835                            let inner = x.compute_size(__cache);
14836                            __cache.set(__slot, inner);
14837                            size
14838                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14839                                    + inner;
14840                        }
14841                    }
14842                }
14843                size += self.__buffa_unknown_fields.encoded_len() as u32;
14844                size
14845            }
14846            #[allow(clippy::needless_borrow)]
14847            fn write_to(
14848                &self,
14849                __cache: &mut ::buffa::SizeCache,
14850                buf: &mut impl ::buffa::bytes::BufMut,
14851            ) {
14852                #[allow(unused_imports)]
14853                use ::buffa::Enumeration as _;
14854                if !self.symbol.is_empty() {
14855                    ::buffa::types::put_string_field(1u32, &self.symbol, buf);
14856                }
14857                if self.qty_scaled != 0i64 {
14858                    ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
14859                }
14860                {
14861                    let val = self.fee_asset.to_i32();
14862                    if val != 0 {
14863                        ::buffa::types::put_int32_field(3u32, val, buf);
14864                    }
14865                }
14866                {
14867                    let val = self.self_trade_prevention_mode.to_i32();
14868                    if val != 0 {
14869                        ::buffa::types::put_int32_field(4u32, val, buf);
14870                    }
14871                }
14872                if !self.client_trigger_id.is_empty() {
14873                    ::buffa::types::put_string_field(5u32, &self.client_trigger_id, buf);
14874                }
14875                if let ::core::option::Option::Some(ref v) = self.strategy {
14876                    match v {
14877                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14878                            x,
14879                        ) => {
14880                            ::buffa::types::put_len_delimited_header(
14881                                10u32,
14882                                __cache.consume_next(),
14883                                buf,
14884                            );
14885                            x.write_to(__cache, buf);
14886                        }
14887                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14888                            x,
14889                        ) => {
14890                            ::buffa::types::put_len_delimited_header(
14891                                11u32,
14892                                __cache.consume_next(),
14893                                buf,
14894                            );
14895                            x.write_to(__cache, buf);
14896                        }
14897                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14898                            x,
14899                        ) => {
14900                            ::buffa::types::put_len_delimited_header(
14901                                12u32,
14902                                __cache.consume_next(),
14903                                buf,
14904                            );
14905                            x.write_to(__cache, buf);
14906                        }
14907                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14908                            x,
14909                        ) => {
14910                            ::buffa::types::put_len_delimited_header(
14911                                13u32,
14912                                __cache.consume_next(),
14913                                buf,
14914                            );
14915                            x.write_to(__cache, buf);
14916                        }
14917                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14918                            x,
14919                        ) => {
14920                            ::buffa::types::put_len_delimited_header(
14921                                14u32,
14922                                __cache.consume_next(),
14923                                buf,
14924                            );
14925                            x.write_to(__cache, buf);
14926                        }
14927                    }
14928                }
14929                self.__buffa_unknown_fields.write_to(buf);
14930            }
14931        }
14932        /// Serializes this view as protobuf JSON.
14933        ///
14934        /// Implicit-presence fields with default values are omitted, `required`
14935        /// fields are always emitted, explicit-presence (`optional`) fields are
14936        /// emitted only when set, bytes fields are base64-encoded, and enum
14937        /// values are their proto name strings.
14938        ///
14939        /// This impl uses `serialize_map(None)` because the number of emitted
14940        /// fields depends on default-omission rules; serializers that require
14941        /// known map lengths (e.g. `bincode`) will return a runtime error.
14942        /// Use the owned message type for those formats.
14943        impl<'__a> ::serde::Serialize for TriggerIntentView<'__a> {
14944            fn serialize<__S: ::serde::Serializer>(
14945                &self,
14946                __s: __S,
14947            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14948                use ::serde::ser::SerializeMap as _;
14949                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14950                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
14951                    __map.serialize_entry("symbol", self.symbol)?;
14952                }
14953                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
14954                    __map
14955                        .serialize_entry(
14956                            "qtyScaled",
14957                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
14958                        )?;
14959                }
14960                if !::buffa::json_helpers::skip_if::is_default_enum_value(
14961                    &self.fee_asset,
14962                ) {
14963                    __map.serialize_entry("feeAsset", &self.fee_asset)?;
14964                }
14965                if !::buffa::json_helpers::skip_if::is_default_enum_value(
14966                    &self.self_trade_prevention_mode,
14967                ) {
14968                    __map
14969                        .serialize_entry(
14970                            "selfTradePreventionMode",
14971                            &self.self_trade_prevention_mode,
14972                        )?;
14973                }
14974                if !::buffa::json_helpers::skip_if::is_empty_str(
14975                    self.client_trigger_id,
14976                ) {
14977                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
14978                }
14979                if let ::core::option::Option::Some(ref __ov) = self.strategy {
14980                    match __ov {
14981                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14982                            v,
14983                        ) => {
14984                            __map.serialize_entry("stopLoss", v)?;
14985                        }
14986                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14987                            v,
14988                        ) => {
14989                            __map.serialize_entry("takeProfit", v)?;
14990                        }
14991                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14992                            v,
14993                        ) => {
14994                            __map.serialize_entry("trailingStop", v)?;
14995                        }
14996                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14997                            v,
14998                        ) => {
14999                            __map.serialize_entry("twap", v)?;
15000                        }
15001                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
15002                            v,
15003                        ) => {
15004                            __map.serialize_entry("ladder", v)?;
15005                        }
15006                    }
15007                }
15008                __map.end()
15009            }
15010        }
15011        impl<'a> ::buffa::MessageName for TriggerIntentView<'a> {
15012            const PACKAGE: &'static str = "triggers.v1";
15013            const NAME: &'static str = "TriggerIntent";
15014            const FULL_NAME: &'static str = "triggers.v1.TriggerIntent";
15015            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
15016        }
15017        ::buffa::impl_default_view_instance!(TriggerIntentView);
15018        ::buffa::impl_view_reborrow!(TriggerIntentView);
15019        /** Self-contained, `'static` owned view of a `TriggerIntent` message.
15020
15021 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.
15022
15023 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.*/
15024        #[derive(Clone, Debug)]
15025        pub struct TriggerIntentOwnedView(
15026            ::buffa::OwnedView<TriggerIntentView<'static>>,
15027        );
15028        impl TriggerIntentOwnedView {
15029            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15030            ///
15031            /// The view borrows directly from the buffer's data; the buffer is
15032            /// retained inside the returned handle.
15033            ///
15034            /// # Errors
15035            ///
15036            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15037            /// protobuf data.
15038            pub fn decode(
15039                bytes: ::buffa::bytes::Bytes,
15040            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15041                ::core::result::Result::Ok(
15042                    TriggerIntentOwnedView(::buffa::OwnedView::decode(bytes)?),
15043                )
15044            }
15045            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15046            /// max message size).
15047            ///
15048            /// # Errors
15049            ///
15050            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15051            /// exceeds the configured limits.
15052            pub fn decode_with_options(
15053                bytes: ::buffa::bytes::Bytes,
15054                opts: &::buffa::DecodeOptions,
15055            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15056                ::core::result::Result::Ok(
15057                    TriggerIntentOwnedView(
15058                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15059                    ),
15060                )
15061            }
15062            /// Build from an owned message via an encode → decode round-trip.
15063            ///
15064            /// # Errors
15065            ///
15066            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15067            /// somehow invalid (should not happen for well-formed messages).
15068            pub fn from_owned(
15069                msg: &super::super::TriggerIntent,
15070            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15071                ::core::result::Result::Ok(
15072                    TriggerIntentOwnedView(::buffa::OwnedView::from_owned(msg)?),
15073                )
15074            }
15075            /// Borrow the full [`TriggerIntentView`] with its lifetime tied to `&self`.
15076            #[must_use]
15077            pub fn view(&self) -> &TriggerIntentView<'_> {
15078                self.0.reborrow()
15079            }
15080            /// Convert to the owned message type.
15081            ///
15082            /// # Errors
15083            ///
15084            /// Returns an error if re-materializing preserved unknown fields
15085            /// fails (e.g. the unknown-field limit is exceeded).
15086            pub fn to_owned_message(
15087                &self,
15088            ) -> ::core::result::Result<
15089                super::super::TriggerIntent,
15090                ::buffa::DecodeError,
15091            > {
15092                self.0.to_owned_message()
15093            }
15094            /// The underlying bytes buffer.
15095            #[must_use]
15096            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15097                self.0.bytes()
15098            }
15099            /// Consume the handle, returning the underlying bytes buffer.
15100            #[must_use]
15101            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15102                self.0.into_bytes()
15103            }
15104            /// Symbol, for example "BTC-USDT".
15105            ///
15106            /// Field 1: `symbol`
15107            #[must_use]
15108            pub fn symbol(&self) -> &'_ str {
15109                self.0.reborrow().symbol
15110            }
15111            /// Total quantity scaled by the pair's base_quantity_scale.
15112            ///
15113            /// Field 2: `qty_scaled`
15114            #[must_use]
15115            pub fn qty_scaled(&self) -> i64 {
15116                self.0.reborrow().qty_scaled
15117            }
15118            /// Fee asset for BUY children. SELL children must use QUOTE.
15119            ///
15120            /// Field 3: `fee_asset`
15121            #[must_use]
15122            pub fn fee_asset(
15123                &self,
15124            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::FeeAsset> {
15125                self.0.reborrow().fee_asset
15126            }
15127            /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
15128            ///
15129            /// Field 4: `self_trade_prevention_mode`
15130            #[must_use]
15131            pub fn self_trade_prevention_mode(
15132                &self,
15133            ) -> ::buffa::EnumValue<
15134                super::super::super::super::orders::v1::SelfTradePreventionMode,
15135            > {
15136                self.0.reborrow().self_trade_prevention_mode
15137            }
15138            /// Client-provided trigger ID for idempotency.
15139            ///
15140            /// Field 5: `client_trigger_id`
15141            #[must_use]
15142            pub fn client_trigger_id(&self) -> &'_ str {
15143                self.0.reborrow().client_trigger_id
15144            }
15145            /// Oneof `strategy`.
15146            #[must_use]
15147            pub fn strategy(
15148                &self,
15149            ) -> ::core::option::Option<
15150                &super::super::__buffa::view::oneof::trigger_intent::Strategy<'_>,
15151            > {
15152                self.0.reborrow().strategy.as_ref()
15153            }
15154        }
15155        impl ::core::convert::From<::buffa::OwnedView<TriggerIntentView<'static>>>
15156        for TriggerIntentOwnedView {
15157            fn from(inner: ::buffa::OwnedView<TriggerIntentView<'static>>) -> Self {
15158                TriggerIntentOwnedView(inner)
15159            }
15160        }
15161        impl ::core::convert::From<TriggerIntentOwnedView>
15162        for ::buffa::OwnedView<TriggerIntentView<'static>> {
15163            fn from(wrapper: TriggerIntentOwnedView) -> Self {
15164                wrapper.0
15165            }
15166        }
15167        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerIntentView<'static>>>
15168        for TriggerIntentOwnedView {
15169            fn as_ref(&self) -> &::buffa::OwnedView<TriggerIntentView<'static>> {
15170                &self.0
15171            }
15172        }
15173        impl ::buffa::HasMessageView for super::super::TriggerIntent {
15174            type View<'a> = TriggerIntentView<'a>;
15175            type ViewHandle = TriggerIntentOwnedView;
15176        }
15177        impl ::serde::Serialize for TriggerIntentOwnedView {
15178            fn serialize<__S: ::serde::Serializer>(
15179                &self,
15180                __s: __S,
15181            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15182                ::serde::Serialize::serialize(&self.0, __s)
15183            }
15184        }
15185        /// CreateTriggerRequest submits one standalone trigger intent for admission.
15186        #[derive(Clone, Debug, Default)]
15187        pub struct CreateTriggerRequestView<'a> {
15188            /// Target sub-account. When omitted, uses the caller's root account.
15189            ///
15190            /// Field 1: `subaccount_id`
15191            pub subaccount_id: ::core::option::Option<u64>,
15192            /// Trigger to admit.
15193            ///
15194            /// Field 2: `trigger`
15195            pub trigger: ::buffa::MessageFieldView<
15196                super::super::__buffa::view::TriggerIntentView<'a>,
15197            >,
15198            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15199        }
15200        impl<'a> ::buffa::MessageView<'a> for CreateTriggerRequestView<'a> {
15201            type Owned = super::super::CreateTriggerRequest;
15202            fn decode_view(
15203                buf: &'a [u8],
15204            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15205                let __limit = ::core::cell::Cell::new(
15206                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15207                );
15208                <Self as ::buffa::MessageView>::decode_view_ctx(
15209                    buf,
15210                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15211                )
15212            }
15213            fn decode_view_with_ctx(
15214                buf: &'a [u8],
15215                ctx: ::buffa::DecodeContext<'_>,
15216            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15217                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15218            }
15219            fn merge_view_field(
15220                &mut self,
15221                tag: ::buffa::encoding::Tag,
15222                cur: &'a [u8],
15223                before_tag: &'a [u8],
15224                ctx: ::buffa::DecodeContext<'_>,
15225            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15226                let _ = ctx;
15227                #[allow(unused_variables)]
15228                let view = self;
15229                let mut cur = cur;
15230                match tag.field_number() {
15231                    1u32 => {
15232                        ::buffa::encoding::check_wire_type(
15233                            tag,
15234                            ::buffa::encoding::WireType::Fixed64,
15235                        )?;
15236                        view.subaccount_id = Some(
15237                            ::buffa::types::decode_fixed64(&mut cur)?,
15238                        );
15239                    }
15240                    2u32 => {
15241                        ::buffa::encoding::check_wire_type(
15242                            tag,
15243                            ::buffa::encoding::WireType::LengthDelimited,
15244                        )?;
15245                        let __sub_ctx = ctx.descend()?;
15246                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15247                        match view.trigger.as_mut() {
15248                            Some(existing) => {
15249                                ::buffa::MessageView::merge_into_view(
15250                                    existing,
15251                                    sub,
15252                                    __sub_ctx,
15253                                )?
15254                            }
15255                            None => {
15256                                view.trigger = ::buffa::MessageFieldView::set(
15257                                    <super::super::__buffa::view::TriggerIntentView as ::buffa::MessageView>::decode_view_ctx(
15258                                        sub,
15259                                        __sub_ctx,
15260                                    )?,
15261                                );
15262                            }
15263                        }
15264                    }
15265                    _ => {
15266                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15267                        let span_len = before_tag.len() - cur.len();
15268                        view.__buffa_unknown_fields
15269                            .push_record(before_tag, span_len, ctx)?;
15270                    }
15271                }
15272                ::core::result::Result::Ok(cur)
15273            }
15274            fn to_owned_message(
15275                &self,
15276            ) -> ::core::result::Result<
15277                super::super::CreateTriggerRequest,
15278                ::buffa::DecodeError,
15279            > {
15280                self.to_owned_from_source(None)
15281            }
15282            #[allow(clippy::useless_conversion, clippy::needless_update)]
15283            fn to_owned_from_source(
15284                &self,
15285                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15286            ) -> ::core::result::Result<
15287                super::super::CreateTriggerRequest,
15288                ::buffa::DecodeError,
15289            > {
15290                #[allow(unused_imports)]
15291                use ::buffa::alloc::string::ToString as _;
15292                let _ = __buffa_src;
15293                ::core::result::Result::Ok(super::super::CreateTriggerRequest {
15294                    subaccount_id: self.subaccount_id,
15295                    trigger: match self.trigger.as_option() {
15296                        Some(v) => {
15297                            ::buffa::MessageField::<
15298                                super::super::TriggerIntent,
15299                            >::some(v.to_owned_from_source(__buffa_src)?)
15300                        }
15301                        None => ::buffa::MessageField::none(),
15302                    },
15303                    __buffa_unknown_fields: self
15304                        .__buffa_unknown_fields
15305                        .to_owned()?
15306                        .into(),
15307                    ..::core::default::Default::default()
15308                })
15309            }
15310        }
15311        impl<'a> ::buffa::ViewEncode<'a> for CreateTriggerRequestView<'a> {
15312            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15313            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15314                #[allow(unused_imports)]
15315                use ::buffa::Enumeration as _;
15316                let mut size = 0u32;
15317                if self.subaccount_id.is_some() {
15318                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15319                }
15320                if self.trigger.is_set() {
15321                    let __slot = __cache.reserve();
15322                    let inner_size = self.trigger.compute_size(__cache);
15323                    __cache.set(__slot, inner_size);
15324                    size
15325                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15326                            + inner_size;
15327                }
15328                size += self.__buffa_unknown_fields.encoded_len() as u32;
15329                size
15330            }
15331            #[allow(clippy::needless_borrow)]
15332            fn write_to(
15333                &self,
15334                __cache: &mut ::buffa::SizeCache,
15335                buf: &mut impl ::buffa::bytes::BufMut,
15336            ) {
15337                #[allow(unused_imports)]
15338                use ::buffa::Enumeration as _;
15339                if let Some(v) = self.subaccount_id {
15340                    ::buffa::types::put_fixed64_field(1u32, v, buf);
15341                }
15342                if self.trigger.is_set() {
15343                    ::buffa::types::put_len_delimited_header(
15344                        2u32,
15345                        __cache.consume_next(),
15346                        buf,
15347                    );
15348                    self.trigger.write_to(__cache, buf);
15349                }
15350                self.__buffa_unknown_fields.write_to(buf);
15351            }
15352        }
15353        /// Serializes this view as protobuf JSON.
15354        ///
15355        /// Implicit-presence fields with default values are omitted, `required`
15356        /// fields are always emitted, explicit-presence (`optional`) fields are
15357        /// emitted only when set, bytes fields are base64-encoded, and enum
15358        /// values are their proto name strings.
15359        ///
15360        /// This impl uses `serialize_map(None)` because the number of emitted
15361        /// fields depends on default-omission rules; serializers that require
15362        /// known map lengths (e.g. `bincode`) will return a runtime error.
15363        /// Use the owned message type for those formats.
15364        impl<'__a> ::serde::Serialize for CreateTriggerRequestView<'__a> {
15365            fn serialize<__S: ::serde::Serializer>(
15366                &self,
15367                __s: __S,
15368            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15369                use ::serde::ser::SerializeMap as _;
15370                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15371                if let ::core::option::Option::Some(__v) = self.subaccount_id {
15372                    __map
15373                        .serialize_entry(
15374                            "subaccountId",
15375                            &::buffa::json_helpers::ProtoJson(&__v),
15376                        )?;
15377                }
15378                {
15379                    if let ::core::option::Option::Some(__v) = self.trigger.as_option() {
15380                        __map.serialize_entry("trigger", __v)?;
15381                    }
15382                }
15383                __map.end()
15384            }
15385        }
15386        impl<'a> ::buffa::MessageName for CreateTriggerRequestView<'a> {
15387            const PACKAGE: &'static str = "triggers.v1";
15388            const NAME: &'static str = "CreateTriggerRequest";
15389            const FULL_NAME: &'static str = "triggers.v1.CreateTriggerRequest";
15390            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
15391        }
15392        ::buffa::impl_default_view_instance!(CreateTriggerRequestView);
15393        ::buffa::impl_view_reborrow!(CreateTriggerRequestView);
15394        /** Self-contained, `'static` owned view of a `CreateTriggerRequest` message.
15395
15396 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.
15397
15398 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.*/
15399        #[derive(Clone, Debug)]
15400        pub struct CreateTriggerRequestOwnedView(
15401            ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15402        );
15403        impl CreateTriggerRequestOwnedView {
15404            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15405            ///
15406            /// The view borrows directly from the buffer's data; the buffer is
15407            /// retained inside the returned handle.
15408            ///
15409            /// # Errors
15410            ///
15411            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15412            /// protobuf data.
15413            pub fn decode(
15414                bytes: ::buffa::bytes::Bytes,
15415            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15416                ::core::result::Result::Ok(
15417                    CreateTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
15418                )
15419            }
15420            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15421            /// max message size).
15422            ///
15423            /// # Errors
15424            ///
15425            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15426            /// exceeds the configured limits.
15427            pub fn decode_with_options(
15428                bytes: ::buffa::bytes::Bytes,
15429                opts: &::buffa::DecodeOptions,
15430            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15431                ::core::result::Result::Ok(
15432                    CreateTriggerRequestOwnedView(
15433                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15434                    ),
15435                )
15436            }
15437            /// Build from an owned message via an encode → decode round-trip.
15438            ///
15439            /// # Errors
15440            ///
15441            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15442            /// somehow invalid (should not happen for well-formed messages).
15443            pub fn from_owned(
15444                msg: &super::super::CreateTriggerRequest,
15445            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15446                ::core::result::Result::Ok(
15447                    CreateTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
15448                )
15449            }
15450            /// Borrow the full [`CreateTriggerRequestView`] with its lifetime tied to `&self`.
15451            #[must_use]
15452            pub fn view(&self) -> &CreateTriggerRequestView<'_> {
15453                self.0.reborrow()
15454            }
15455            /// Convert to the owned message type.
15456            ///
15457            /// # Errors
15458            ///
15459            /// Returns an error if re-materializing preserved unknown fields
15460            /// fails (e.g. the unknown-field limit is exceeded).
15461            pub fn to_owned_message(
15462                &self,
15463            ) -> ::core::result::Result<
15464                super::super::CreateTriggerRequest,
15465                ::buffa::DecodeError,
15466            > {
15467                self.0.to_owned_message()
15468            }
15469            /// The underlying bytes buffer.
15470            #[must_use]
15471            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15472                self.0.bytes()
15473            }
15474            /// Consume the handle, returning the underlying bytes buffer.
15475            #[must_use]
15476            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15477                self.0.into_bytes()
15478            }
15479            /// Target sub-account. When omitted, uses the caller's root account.
15480            ///
15481            /// Field 1: `subaccount_id`
15482            #[must_use]
15483            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
15484                self.0.reborrow().subaccount_id
15485            }
15486            /// Trigger to admit.
15487            ///
15488            /// Field 2: `trigger`
15489            #[must_use]
15490            pub fn trigger(
15491                &self,
15492            ) -> &::buffa::MessageFieldView<
15493                super::super::__buffa::view::TriggerIntentView<'_>,
15494            > {
15495                &self.0.reborrow().trigger
15496            }
15497        }
15498        impl ::core::convert::From<::buffa::OwnedView<CreateTriggerRequestView<'static>>>
15499        for CreateTriggerRequestOwnedView {
15500            fn from(
15501                inner: ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15502            ) -> Self {
15503                CreateTriggerRequestOwnedView(inner)
15504            }
15505        }
15506        impl ::core::convert::From<CreateTriggerRequestOwnedView>
15507        for ::buffa::OwnedView<CreateTriggerRequestView<'static>> {
15508            fn from(wrapper: CreateTriggerRequestOwnedView) -> Self {
15509                wrapper.0
15510            }
15511        }
15512        impl ::core::convert::AsRef<
15513            ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15514        > for CreateTriggerRequestOwnedView {
15515            fn as_ref(&self) -> &::buffa::OwnedView<CreateTriggerRequestView<'static>> {
15516                &self.0
15517            }
15518        }
15519        impl ::buffa::HasMessageView for super::super::CreateTriggerRequest {
15520            type View<'a> = CreateTriggerRequestView<'a>;
15521            type ViewHandle = CreateTriggerRequestOwnedView;
15522        }
15523        impl ::serde::Serialize for CreateTriggerRequestOwnedView {
15524            fn serialize<__S: ::serde::Serializer>(
15525                &self,
15526                __s: __S,
15527            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15528                ::serde::Serialize::serialize(&self.0, __s)
15529            }
15530        }
15531        /// CreateTriggerResponse acknowledges trigger creation only. Arming and child
15532        /// execution happen asynchronously and are visible through trigger reads/events.
15533        #[derive(Clone, Debug, Default)]
15534        pub struct CreateTriggerResponseView<'a> {
15535            /// Assigned trigger ID.
15536            ///
15537            /// Field 1: `trigger_id`
15538            pub trigger_id: u64,
15539            /// Echoed client trigger ID.
15540            ///
15541            /// Field 2: `client_trigger_id`
15542            pub client_trigger_id: &'a str,
15543            /// Time creation admission completed.
15544            ///
15545            /// Field 3: `accepted_at`
15546            pub accepted_at: ::buffa::MessageFieldView<
15547                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
15548            >,
15549            /// Admission completion time in nanoseconds since epoch (UTC).
15550            ///
15551            /// Field 4: `accepted_at_ts_ns`
15552            pub accepted_at_ts_ns: u64,
15553            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15554        }
15555        impl<'a> ::buffa::MessageView<'a> for CreateTriggerResponseView<'a> {
15556            type Owned = super::super::CreateTriggerResponse;
15557            fn decode_view(
15558                buf: &'a [u8],
15559            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15560                let __limit = ::core::cell::Cell::new(
15561                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15562                );
15563                <Self as ::buffa::MessageView>::decode_view_ctx(
15564                    buf,
15565                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15566                )
15567            }
15568            fn decode_view_with_ctx(
15569                buf: &'a [u8],
15570                ctx: ::buffa::DecodeContext<'_>,
15571            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15572                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15573            }
15574            fn merge_view_field(
15575                &mut self,
15576                tag: ::buffa::encoding::Tag,
15577                cur: &'a [u8],
15578                before_tag: &'a [u8],
15579                ctx: ::buffa::DecodeContext<'_>,
15580            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15581                let _ = ctx;
15582                #[allow(unused_variables)]
15583                let view = self;
15584                let mut cur = cur;
15585                match tag.field_number() {
15586                    1u32 => {
15587                        ::buffa::encoding::check_wire_type(
15588                            tag,
15589                            ::buffa::encoding::WireType::Fixed64,
15590                        )?;
15591                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
15592                    }
15593                    2u32 => {
15594                        ::buffa::encoding::check_wire_type(
15595                            tag,
15596                            ::buffa::encoding::WireType::LengthDelimited,
15597                        )?;
15598                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
15599                    }
15600                    3u32 => {
15601                        ::buffa::encoding::check_wire_type(
15602                            tag,
15603                            ::buffa::encoding::WireType::LengthDelimited,
15604                        )?;
15605                        let __sub_ctx = ctx.descend()?;
15606                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15607                        match view.accepted_at.as_mut() {
15608                            Some(existing) => {
15609                                ::buffa::MessageView::merge_into_view(
15610                                    existing,
15611                                    sub,
15612                                    __sub_ctx,
15613                                )?
15614                            }
15615                            None => {
15616                                view.accepted_at = ::buffa::MessageFieldView::set(
15617                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
15618                                        sub,
15619                                        __sub_ctx,
15620                                    )?,
15621                                );
15622                            }
15623                        }
15624                    }
15625                    4u32 => {
15626                        ::buffa::encoding::check_wire_type(
15627                            tag,
15628                            ::buffa::encoding::WireType::Varint,
15629                        )?;
15630                        view.accepted_at_ts_ns = ::buffa::types::decode_uint64(
15631                            &mut cur,
15632                        )?;
15633                    }
15634                    _ => {
15635                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15636                        let span_len = before_tag.len() - cur.len();
15637                        view.__buffa_unknown_fields
15638                            .push_record(before_tag, span_len, ctx)?;
15639                    }
15640                }
15641                ::core::result::Result::Ok(cur)
15642            }
15643            fn to_owned_message(
15644                &self,
15645            ) -> ::core::result::Result<
15646                super::super::CreateTriggerResponse,
15647                ::buffa::DecodeError,
15648            > {
15649                self.to_owned_from_source(None)
15650            }
15651            #[allow(clippy::useless_conversion, clippy::needless_update)]
15652            fn to_owned_from_source(
15653                &self,
15654                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15655            ) -> ::core::result::Result<
15656                super::super::CreateTriggerResponse,
15657                ::buffa::DecodeError,
15658            > {
15659                #[allow(unused_imports)]
15660                use ::buffa::alloc::string::ToString as _;
15661                let _ = __buffa_src;
15662                ::core::result::Result::Ok(super::super::CreateTriggerResponse {
15663                    trigger_id: self.trigger_id,
15664                    client_trigger_id: self.client_trigger_id.to_string(),
15665                    accepted_at: match self.accepted_at.as_option() {
15666                        Some(v) => {
15667                            ::buffa::MessageField::<
15668                                ::buffa_types::google::protobuf::Timestamp,
15669                            >::some(v.to_owned_from_source(__buffa_src)?)
15670                        }
15671                        None => ::buffa::MessageField::none(),
15672                    },
15673                    accepted_at_ts_ns: self.accepted_at_ts_ns,
15674                    __buffa_unknown_fields: self
15675                        .__buffa_unknown_fields
15676                        .to_owned()?
15677                        .into(),
15678                    ..::core::default::Default::default()
15679                })
15680            }
15681        }
15682        impl<'a> ::buffa::ViewEncode<'a> for CreateTriggerResponseView<'a> {
15683            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15684            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15685                #[allow(unused_imports)]
15686                use ::buffa::Enumeration as _;
15687                let mut size = 0u32;
15688                if self.trigger_id != 0u64 {
15689                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15690                }
15691                if !self.client_trigger_id.is_empty() {
15692                    size
15693                        += 1u32
15694                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
15695                                as u32;
15696                }
15697                if self.accepted_at.is_set() {
15698                    let __slot = __cache.reserve();
15699                    let inner_size = self.accepted_at.compute_size(__cache);
15700                    __cache.set(__slot, inner_size);
15701                    size
15702                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15703                            + inner_size;
15704                }
15705                if self.accepted_at_ts_ns != 0u64 {
15706                    size
15707                        += 1u32
15708                            + ::buffa::types::uint64_encoded_len(self.accepted_at_ts_ns)
15709                                as u32;
15710                }
15711                size += self.__buffa_unknown_fields.encoded_len() as u32;
15712                size
15713            }
15714            #[allow(clippy::needless_borrow)]
15715            fn write_to(
15716                &self,
15717                __cache: &mut ::buffa::SizeCache,
15718                buf: &mut impl ::buffa::bytes::BufMut,
15719            ) {
15720                #[allow(unused_imports)]
15721                use ::buffa::Enumeration as _;
15722                if self.trigger_id != 0u64 {
15723                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
15724                }
15725                if !self.client_trigger_id.is_empty() {
15726                    ::buffa::types::put_string_field(2u32, &self.client_trigger_id, buf);
15727                }
15728                if self.accepted_at.is_set() {
15729                    ::buffa::types::put_len_delimited_header(
15730                        3u32,
15731                        __cache.consume_next(),
15732                        buf,
15733                    );
15734                    self.accepted_at.write_to(__cache, buf);
15735                }
15736                if self.accepted_at_ts_ns != 0u64 {
15737                    ::buffa::types::put_uint64_field(4u32, self.accepted_at_ts_ns, buf);
15738                }
15739                self.__buffa_unknown_fields.write_to(buf);
15740            }
15741        }
15742        /// Serializes this view as protobuf JSON.
15743        ///
15744        /// Implicit-presence fields with default values are omitted, `required`
15745        /// fields are always emitted, explicit-presence (`optional`) fields are
15746        /// emitted only when set, bytes fields are base64-encoded, and enum
15747        /// values are their proto name strings.
15748        ///
15749        /// This impl uses `serialize_map(None)` because the number of emitted
15750        /// fields depends on default-omission rules; serializers that require
15751        /// known map lengths (e.g. `bincode`) will return a runtime error.
15752        /// Use the owned message type for those formats.
15753        impl<'__a> ::serde::Serialize for CreateTriggerResponseView<'__a> {
15754            fn serialize<__S: ::serde::Serializer>(
15755                &self,
15756                __s: __S,
15757            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15758                use ::serde::ser::SerializeMap as _;
15759                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15760                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
15761                    __map
15762                        .serialize_entry(
15763                            "triggerId",
15764                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
15765                        )?;
15766                }
15767                if !::buffa::json_helpers::skip_if::is_empty_str(
15768                    self.client_trigger_id,
15769                ) {
15770                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
15771                }
15772                {
15773                    if let ::core::option::Option::Some(__v) = self
15774                        .accepted_at
15775                        .as_option()
15776                    {
15777                        __map.serialize_entry("acceptedAt", __v)?;
15778                    }
15779                }
15780                if !::buffa::json_helpers::skip_if::is_zero_u64(
15781                    &self.accepted_at_ts_ns,
15782                ) {
15783                    __map
15784                        .serialize_entry(
15785                            "acceptedAtTsNs",
15786                            &::buffa::json_helpers::ProtoJson(&self.accepted_at_ts_ns),
15787                        )?;
15788                }
15789                __map.end()
15790            }
15791        }
15792        impl<'a> ::buffa::MessageName for CreateTriggerResponseView<'a> {
15793            const PACKAGE: &'static str = "triggers.v1";
15794            const NAME: &'static str = "CreateTriggerResponse";
15795            const FULL_NAME: &'static str = "triggers.v1.CreateTriggerResponse";
15796            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
15797        }
15798        ::buffa::impl_default_view_instance!(CreateTriggerResponseView);
15799        ::buffa::impl_view_reborrow!(CreateTriggerResponseView);
15800        /** Self-contained, `'static` owned view of a `CreateTriggerResponse` message.
15801
15802 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.
15803
15804 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.*/
15805        #[derive(Clone, Debug)]
15806        pub struct CreateTriggerResponseOwnedView(
15807            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15808        );
15809        impl CreateTriggerResponseOwnedView {
15810            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15811            ///
15812            /// The view borrows directly from the buffer's data; the buffer is
15813            /// retained inside the returned handle.
15814            ///
15815            /// # Errors
15816            ///
15817            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15818            /// protobuf data.
15819            pub fn decode(
15820                bytes: ::buffa::bytes::Bytes,
15821            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15822                ::core::result::Result::Ok(
15823                    CreateTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
15824                )
15825            }
15826            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15827            /// max message size).
15828            ///
15829            /// # Errors
15830            ///
15831            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15832            /// exceeds the configured limits.
15833            pub fn decode_with_options(
15834                bytes: ::buffa::bytes::Bytes,
15835                opts: &::buffa::DecodeOptions,
15836            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15837                ::core::result::Result::Ok(
15838                    CreateTriggerResponseOwnedView(
15839                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15840                    ),
15841                )
15842            }
15843            /// Build from an owned message via an encode → decode round-trip.
15844            ///
15845            /// # Errors
15846            ///
15847            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15848            /// somehow invalid (should not happen for well-formed messages).
15849            pub fn from_owned(
15850                msg: &super::super::CreateTriggerResponse,
15851            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15852                ::core::result::Result::Ok(
15853                    CreateTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
15854                )
15855            }
15856            /// Borrow the full [`CreateTriggerResponseView`] with its lifetime tied to `&self`.
15857            #[must_use]
15858            pub fn view(&self) -> &CreateTriggerResponseView<'_> {
15859                self.0.reborrow()
15860            }
15861            /// Convert to the owned message type.
15862            ///
15863            /// # Errors
15864            ///
15865            /// Returns an error if re-materializing preserved unknown fields
15866            /// fails (e.g. the unknown-field limit is exceeded).
15867            pub fn to_owned_message(
15868                &self,
15869            ) -> ::core::result::Result<
15870                super::super::CreateTriggerResponse,
15871                ::buffa::DecodeError,
15872            > {
15873                self.0.to_owned_message()
15874            }
15875            /// The underlying bytes buffer.
15876            #[must_use]
15877            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15878                self.0.bytes()
15879            }
15880            /// Consume the handle, returning the underlying bytes buffer.
15881            #[must_use]
15882            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15883                self.0.into_bytes()
15884            }
15885            /// Assigned trigger ID.
15886            ///
15887            /// Field 1: `trigger_id`
15888            #[must_use]
15889            pub fn trigger_id(&self) -> u64 {
15890                self.0.reborrow().trigger_id
15891            }
15892            /// Echoed client trigger ID.
15893            ///
15894            /// Field 2: `client_trigger_id`
15895            #[must_use]
15896            pub fn client_trigger_id(&self) -> &'_ str {
15897                self.0.reborrow().client_trigger_id
15898            }
15899            /// Time creation admission completed.
15900            ///
15901            /// Field 3: `accepted_at`
15902            #[must_use]
15903            pub fn accepted_at(
15904                &self,
15905            ) -> &::buffa::MessageFieldView<
15906                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
15907            > {
15908                &self.0.reborrow().accepted_at
15909            }
15910            /// Admission completion time in nanoseconds since epoch (UTC).
15911            ///
15912            /// Field 4: `accepted_at_ts_ns`
15913            #[must_use]
15914            pub fn accepted_at_ts_ns(&self) -> u64 {
15915                self.0.reborrow().accepted_at_ts_ns
15916            }
15917        }
15918        impl ::core::convert::From<
15919            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15920        > for CreateTriggerResponseOwnedView {
15921            fn from(
15922                inner: ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15923            ) -> Self {
15924                CreateTriggerResponseOwnedView(inner)
15925            }
15926        }
15927        impl ::core::convert::From<CreateTriggerResponseOwnedView>
15928        for ::buffa::OwnedView<CreateTriggerResponseView<'static>> {
15929            fn from(wrapper: CreateTriggerResponseOwnedView) -> Self {
15930                wrapper.0
15931            }
15932        }
15933        impl ::core::convert::AsRef<
15934            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15935        > for CreateTriggerResponseOwnedView {
15936            fn as_ref(&self) -> &::buffa::OwnedView<CreateTriggerResponseView<'static>> {
15937                &self.0
15938            }
15939        }
15940        impl ::buffa::HasMessageView for super::super::CreateTriggerResponse {
15941            type View<'a> = CreateTriggerResponseView<'a>;
15942            type ViewHandle = CreateTriggerResponseOwnedView;
15943        }
15944        impl ::serde::Serialize for CreateTriggerResponseOwnedView {
15945            fn serialize<__S: ::serde::Serializer>(
15946                &self,
15947                __s: __S,
15948            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15949                ::serde::Serialize::serialize(&self.0, __s)
15950            }
15951        }
15952        /// =============================================================================
15953        /// Get Trigger
15954        /// =============================================================================
15955        ///
15956        /// GetTriggerRequest retrieves one trigger by ID.
15957        #[derive(Clone, Debug, Default)]
15958        pub struct GetTriggerRequestView<'a> {
15959            /// Trigger ID to retrieve.
15960            ///
15961            /// Field 1: `trigger_id`
15962            pub trigger_id: u64,
15963            /// Optional sub-account for authorization.
15964            ///
15965            /// Field 2: `subaccount_id`
15966            pub subaccount_id: ::core::option::Option<u64>,
15967            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15968        }
15969        impl<'a> ::buffa::MessageView<'a> for GetTriggerRequestView<'a> {
15970            type Owned = super::super::GetTriggerRequest;
15971            fn decode_view(
15972                buf: &'a [u8],
15973            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15974                let __limit = ::core::cell::Cell::new(
15975                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15976                );
15977                <Self as ::buffa::MessageView>::decode_view_ctx(
15978                    buf,
15979                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15980                )
15981            }
15982            fn decode_view_with_ctx(
15983                buf: &'a [u8],
15984                ctx: ::buffa::DecodeContext<'_>,
15985            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15986                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15987            }
15988            fn merge_view_field(
15989                &mut self,
15990                tag: ::buffa::encoding::Tag,
15991                cur: &'a [u8],
15992                before_tag: &'a [u8],
15993                ctx: ::buffa::DecodeContext<'_>,
15994            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15995                let _ = ctx;
15996                #[allow(unused_variables)]
15997                let view = self;
15998                let mut cur = cur;
15999                match tag.field_number() {
16000                    1u32 => {
16001                        ::buffa::encoding::check_wire_type(
16002                            tag,
16003                            ::buffa::encoding::WireType::Fixed64,
16004                        )?;
16005                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
16006                    }
16007                    2u32 => {
16008                        ::buffa::encoding::check_wire_type(
16009                            tag,
16010                            ::buffa::encoding::WireType::Fixed64,
16011                        )?;
16012                        view.subaccount_id = Some(
16013                            ::buffa::types::decode_fixed64(&mut cur)?,
16014                        );
16015                    }
16016                    _ => {
16017                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16018                        let span_len = before_tag.len() - cur.len();
16019                        view.__buffa_unknown_fields
16020                            .push_record(before_tag, span_len, ctx)?;
16021                    }
16022                }
16023                ::core::result::Result::Ok(cur)
16024            }
16025            fn to_owned_message(
16026                &self,
16027            ) -> ::core::result::Result<
16028                super::super::GetTriggerRequest,
16029                ::buffa::DecodeError,
16030            > {
16031                self.to_owned_from_source(None)
16032            }
16033            #[allow(clippy::useless_conversion, clippy::needless_update)]
16034            fn to_owned_from_source(
16035                &self,
16036                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16037            ) -> ::core::result::Result<
16038                super::super::GetTriggerRequest,
16039                ::buffa::DecodeError,
16040            > {
16041                #[allow(unused_imports)]
16042                use ::buffa::alloc::string::ToString as _;
16043                let _ = __buffa_src;
16044                ::core::result::Result::Ok(super::super::GetTriggerRequest {
16045                    trigger_id: self.trigger_id,
16046                    subaccount_id: self.subaccount_id,
16047                    __buffa_unknown_fields: self
16048                        .__buffa_unknown_fields
16049                        .to_owned()?
16050                        .into(),
16051                    ..::core::default::Default::default()
16052                })
16053            }
16054        }
16055        impl<'a> ::buffa::ViewEncode<'a> for GetTriggerRequestView<'a> {
16056            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16057            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16058                #[allow(unused_imports)]
16059                use ::buffa::Enumeration as _;
16060                let mut size = 0u32;
16061                if self.trigger_id != 0u64 {
16062                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16063                }
16064                if self.subaccount_id.is_some() {
16065                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16066                }
16067                size += self.__buffa_unknown_fields.encoded_len() as u32;
16068                size
16069            }
16070            #[allow(clippy::needless_borrow)]
16071            fn write_to(
16072                &self,
16073                _cache: &mut ::buffa::SizeCache,
16074                buf: &mut impl ::buffa::bytes::BufMut,
16075            ) {
16076                #[allow(unused_imports)]
16077                use ::buffa::Enumeration as _;
16078                if self.trigger_id != 0u64 {
16079                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
16080                }
16081                if let Some(v) = self.subaccount_id {
16082                    ::buffa::types::put_fixed64_field(2u32, v, buf);
16083                }
16084                self.__buffa_unknown_fields.write_to(buf);
16085            }
16086        }
16087        /// Serializes this view as protobuf JSON.
16088        ///
16089        /// Implicit-presence fields with default values are omitted, `required`
16090        /// fields are always emitted, explicit-presence (`optional`) fields are
16091        /// emitted only when set, bytes fields are base64-encoded, and enum
16092        /// values are their proto name strings.
16093        ///
16094        /// This impl uses `serialize_map(None)` because the number of emitted
16095        /// fields depends on default-omission rules; serializers that require
16096        /// known map lengths (e.g. `bincode`) will return a runtime error.
16097        /// Use the owned message type for those formats.
16098        impl<'__a> ::serde::Serialize for GetTriggerRequestView<'__a> {
16099            fn serialize<__S: ::serde::Serializer>(
16100                &self,
16101                __s: __S,
16102            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16103                use ::serde::ser::SerializeMap as _;
16104                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16105                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
16106                    __map
16107                        .serialize_entry(
16108                            "triggerId",
16109                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
16110                        )?;
16111                }
16112                if let ::core::option::Option::Some(__v) = self.subaccount_id {
16113                    __map
16114                        .serialize_entry(
16115                            "subaccountId",
16116                            &::buffa::json_helpers::ProtoJson(&__v),
16117                        )?;
16118                }
16119                __map.end()
16120            }
16121        }
16122        impl<'a> ::buffa::MessageName for GetTriggerRequestView<'a> {
16123            const PACKAGE: &'static str = "triggers.v1";
16124            const NAME: &'static str = "GetTriggerRequest";
16125            const FULL_NAME: &'static str = "triggers.v1.GetTriggerRequest";
16126            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
16127        }
16128        ::buffa::impl_default_view_instance!(GetTriggerRequestView);
16129        ::buffa::impl_view_reborrow!(GetTriggerRequestView);
16130        /** Self-contained, `'static` owned view of a `GetTriggerRequest` message.
16131
16132 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.
16133
16134 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.*/
16135        #[derive(Clone, Debug)]
16136        pub struct GetTriggerRequestOwnedView(
16137            ::buffa::OwnedView<GetTriggerRequestView<'static>>,
16138        );
16139        impl GetTriggerRequestOwnedView {
16140            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16141            ///
16142            /// The view borrows directly from the buffer's data; the buffer is
16143            /// retained inside the returned handle.
16144            ///
16145            /// # Errors
16146            ///
16147            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16148            /// protobuf data.
16149            pub fn decode(
16150                bytes: ::buffa::bytes::Bytes,
16151            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16152                ::core::result::Result::Ok(
16153                    GetTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
16154                )
16155            }
16156            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16157            /// max message size).
16158            ///
16159            /// # Errors
16160            ///
16161            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16162            /// exceeds the configured limits.
16163            pub fn decode_with_options(
16164                bytes: ::buffa::bytes::Bytes,
16165                opts: &::buffa::DecodeOptions,
16166            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16167                ::core::result::Result::Ok(
16168                    GetTriggerRequestOwnedView(
16169                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16170                    ),
16171                )
16172            }
16173            /// Build from an owned message via an encode → decode round-trip.
16174            ///
16175            /// # Errors
16176            ///
16177            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16178            /// somehow invalid (should not happen for well-formed messages).
16179            pub fn from_owned(
16180                msg: &super::super::GetTriggerRequest,
16181            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16182                ::core::result::Result::Ok(
16183                    GetTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
16184                )
16185            }
16186            /// Borrow the full [`GetTriggerRequestView`] with its lifetime tied to `&self`.
16187            #[must_use]
16188            pub fn view(&self) -> &GetTriggerRequestView<'_> {
16189                self.0.reborrow()
16190            }
16191            /// Convert to the owned message type.
16192            ///
16193            /// # Errors
16194            ///
16195            /// Returns an error if re-materializing preserved unknown fields
16196            /// fails (e.g. the unknown-field limit is exceeded).
16197            pub fn to_owned_message(
16198                &self,
16199            ) -> ::core::result::Result<
16200                super::super::GetTriggerRequest,
16201                ::buffa::DecodeError,
16202            > {
16203                self.0.to_owned_message()
16204            }
16205            /// The underlying bytes buffer.
16206            #[must_use]
16207            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16208                self.0.bytes()
16209            }
16210            /// Consume the handle, returning the underlying bytes buffer.
16211            #[must_use]
16212            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16213                self.0.into_bytes()
16214            }
16215            /// Trigger ID to retrieve.
16216            ///
16217            /// Field 1: `trigger_id`
16218            #[must_use]
16219            pub fn trigger_id(&self) -> u64 {
16220                self.0.reborrow().trigger_id
16221            }
16222            /// Optional sub-account for authorization.
16223            ///
16224            /// Field 2: `subaccount_id`
16225            #[must_use]
16226            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
16227                self.0.reborrow().subaccount_id
16228            }
16229        }
16230        impl ::core::convert::From<::buffa::OwnedView<GetTriggerRequestView<'static>>>
16231        for GetTriggerRequestOwnedView {
16232            fn from(inner: ::buffa::OwnedView<GetTriggerRequestView<'static>>) -> Self {
16233                GetTriggerRequestOwnedView(inner)
16234            }
16235        }
16236        impl ::core::convert::From<GetTriggerRequestOwnedView>
16237        for ::buffa::OwnedView<GetTriggerRequestView<'static>> {
16238            fn from(wrapper: GetTriggerRequestOwnedView) -> Self {
16239                wrapper.0
16240            }
16241        }
16242        impl ::core::convert::AsRef<::buffa::OwnedView<GetTriggerRequestView<'static>>>
16243        for GetTriggerRequestOwnedView {
16244            fn as_ref(&self) -> &::buffa::OwnedView<GetTriggerRequestView<'static>> {
16245                &self.0
16246            }
16247        }
16248        impl ::buffa::HasMessageView for super::super::GetTriggerRequest {
16249            type View<'a> = GetTriggerRequestView<'a>;
16250            type ViewHandle = GetTriggerRequestOwnedView;
16251        }
16252        impl ::serde::Serialize for GetTriggerRequestOwnedView {
16253            fn serialize<__S: ::serde::Serializer>(
16254                &self,
16255                __s: __S,
16256            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16257                ::serde::Serialize::serialize(&self.0, __s)
16258            }
16259        }
16260        /// GetTriggerResponse returns the requested trigger.
16261        #[derive(Clone, Debug, Default)]
16262        pub struct GetTriggerResponseView<'a> {
16263            /// Trigger state and configuration.
16264            ///
16265            /// Field 1: `trigger`
16266            pub trigger: ::buffa::MessageFieldView<
16267                super::super::__buffa::view::TriggerView<'a>,
16268            >,
16269            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16270        }
16271        impl<'a> ::buffa::MessageView<'a> for GetTriggerResponseView<'a> {
16272            type Owned = super::super::GetTriggerResponse;
16273            fn decode_view(
16274                buf: &'a [u8],
16275            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16276                let __limit = ::core::cell::Cell::new(
16277                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16278                );
16279                <Self as ::buffa::MessageView>::decode_view_ctx(
16280                    buf,
16281                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16282                )
16283            }
16284            fn decode_view_with_ctx(
16285                buf: &'a [u8],
16286                ctx: ::buffa::DecodeContext<'_>,
16287            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16288                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16289            }
16290            fn merge_view_field(
16291                &mut self,
16292                tag: ::buffa::encoding::Tag,
16293                cur: &'a [u8],
16294                before_tag: &'a [u8],
16295                ctx: ::buffa::DecodeContext<'_>,
16296            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16297                let _ = ctx;
16298                #[allow(unused_variables)]
16299                let view = self;
16300                let mut cur = cur;
16301                match tag.field_number() {
16302                    1u32 => {
16303                        ::buffa::encoding::check_wire_type(
16304                            tag,
16305                            ::buffa::encoding::WireType::LengthDelimited,
16306                        )?;
16307                        let __sub_ctx = ctx.descend()?;
16308                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
16309                        match view.trigger.as_mut() {
16310                            Some(existing) => {
16311                                ::buffa::MessageView::merge_into_view(
16312                                    existing,
16313                                    sub,
16314                                    __sub_ctx,
16315                                )?
16316                            }
16317                            None => {
16318                                view.trigger = ::buffa::MessageFieldView::set(
16319                                    <super::super::__buffa::view::TriggerView as ::buffa::MessageView>::decode_view_ctx(
16320                                        sub,
16321                                        __sub_ctx,
16322                                    )?,
16323                                );
16324                            }
16325                        }
16326                    }
16327                    _ => {
16328                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16329                        let span_len = before_tag.len() - cur.len();
16330                        view.__buffa_unknown_fields
16331                            .push_record(before_tag, span_len, ctx)?;
16332                    }
16333                }
16334                ::core::result::Result::Ok(cur)
16335            }
16336            fn to_owned_message(
16337                &self,
16338            ) -> ::core::result::Result<
16339                super::super::GetTriggerResponse,
16340                ::buffa::DecodeError,
16341            > {
16342                self.to_owned_from_source(None)
16343            }
16344            #[allow(clippy::useless_conversion, clippy::needless_update)]
16345            fn to_owned_from_source(
16346                &self,
16347                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16348            ) -> ::core::result::Result<
16349                super::super::GetTriggerResponse,
16350                ::buffa::DecodeError,
16351            > {
16352                #[allow(unused_imports)]
16353                use ::buffa::alloc::string::ToString as _;
16354                let _ = __buffa_src;
16355                ::core::result::Result::Ok(super::super::GetTriggerResponse {
16356                    trigger: match self.trigger.as_option() {
16357                        Some(v) => {
16358                            ::buffa::MessageField::<
16359                                super::super::Trigger,
16360                            >::some(v.to_owned_from_source(__buffa_src)?)
16361                        }
16362                        None => ::buffa::MessageField::none(),
16363                    },
16364                    __buffa_unknown_fields: self
16365                        .__buffa_unknown_fields
16366                        .to_owned()?
16367                        .into(),
16368                    ..::core::default::Default::default()
16369                })
16370            }
16371        }
16372        impl<'a> ::buffa::ViewEncode<'a> for GetTriggerResponseView<'a> {
16373            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16374            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
16375                #[allow(unused_imports)]
16376                use ::buffa::Enumeration as _;
16377                let mut size = 0u32;
16378                if self.trigger.is_set() {
16379                    let __slot = __cache.reserve();
16380                    let inner_size = self.trigger.compute_size(__cache);
16381                    __cache.set(__slot, inner_size);
16382                    size
16383                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
16384                            + inner_size;
16385                }
16386                size += self.__buffa_unknown_fields.encoded_len() as u32;
16387                size
16388            }
16389            #[allow(clippy::needless_borrow)]
16390            fn write_to(
16391                &self,
16392                __cache: &mut ::buffa::SizeCache,
16393                buf: &mut impl ::buffa::bytes::BufMut,
16394            ) {
16395                #[allow(unused_imports)]
16396                use ::buffa::Enumeration as _;
16397                if self.trigger.is_set() {
16398                    ::buffa::types::put_len_delimited_header(
16399                        1u32,
16400                        __cache.consume_next(),
16401                        buf,
16402                    );
16403                    self.trigger.write_to(__cache, buf);
16404                }
16405                self.__buffa_unknown_fields.write_to(buf);
16406            }
16407        }
16408        /// Serializes this view as protobuf JSON.
16409        ///
16410        /// Implicit-presence fields with default values are omitted, `required`
16411        /// fields are always emitted, explicit-presence (`optional`) fields are
16412        /// emitted only when set, bytes fields are base64-encoded, and enum
16413        /// values are their proto name strings.
16414        ///
16415        /// This impl uses `serialize_map(None)` because the number of emitted
16416        /// fields depends on default-omission rules; serializers that require
16417        /// known map lengths (e.g. `bincode`) will return a runtime error.
16418        /// Use the owned message type for those formats.
16419        impl<'__a> ::serde::Serialize for GetTriggerResponseView<'__a> {
16420            fn serialize<__S: ::serde::Serializer>(
16421                &self,
16422                __s: __S,
16423            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16424                use ::serde::ser::SerializeMap as _;
16425                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16426                {
16427                    if let ::core::option::Option::Some(__v) = self.trigger.as_option() {
16428                        __map.serialize_entry("trigger", __v)?;
16429                    }
16430                }
16431                __map.end()
16432            }
16433        }
16434        impl<'a> ::buffa::MessageName for GetTriggerResponseView<'a> {
16435            const PACKAGE: &'static str = "triggers.v1";
16436            const NAME: &'static str = "GetTriggerResponse";
16437            const FULL_NAME: &'static str = "triggers.v1.GetTriggerResponse";
16438            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
16439        }
16440        ::buffa::impl_default_view_instance!(GetTriggerResponseView);
16441        ::buffa::impl_view_reborrow!(GetTriggerResponseView);
16442        /** Self-contained, `'static` owned view of a `GetTriggerResponse` message.
16443
16444 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.
16445
16446 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.*/
16447        #[derive(Clone, Debug)]
16448        pub struct GetTriggerResponseOwnedView(
16449            ::buffa::OwnedView<GetTriggerResponseView<'static>>,
16450        );
16451        impl GetTriggerResponseOwnedView {
16452            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16453            ///
16454            /// The view borrows directly from the buffer's data; the buffer is
16455            /// retained inside the returned handle.
16456            ///
16457            /// # Errors
16458            ///
16459            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16460            /// protobuf data.
16461            pub fn decode(
16462                bytes: ::buffa::bytes::Bytes,
16463            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16464                ::core::result::Result::Ok(
16465                    GetTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
16466                )
16467            }
16468            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16469            /// max message size).
16470            ///
16471            /// # Errors
16472            ///
16473            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16474            /// exceeds the configured limits.
16475            pub fn decode_with_options(
16476                bytes: ::buffa::bytes::Bytes,
16477                opts: &::buffa::DecodeOptions,
16478            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16479                ::core::result::Result::Ok(
16480                    GetTriggerResponseOwnedView(
16481                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16482                    ),
16483                )
16484            }
16485            /// Build from an owned message via an encode → decode round-trip.
16486            ///
16487            /// # Errors
16488            ///
16489            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16490            /// somehow invalid (should not happen for well-formed messages).
16491            pub fn from_owned(
16492                msg: &super::super::GetTriggerResponse,
16493            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16494                ::core::result::Result::Ok(
16495                    GetTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
16496                )
16497            }
16498            /// Borrow the full [`GetTriggerResponseView`] with its lifetime tied to `&self`.
16499            #[must_use]
16500            pub fn view(&self) -> &GetTriggerResponseView<'_> {
16501                self.0.reborrow()
16502            }
16503            /// Convert to the owned message type.
16504            ///
16505            /// # Errors
16506            ///
16507            /// Returns an error if re-materializing preserved unknown fields
16508            /// fails (e.g. the unknown-field limit is exceeded).
16509            pub fn to_owned_message(
16510                &self,
16511            ) -> ::core::result::Result<
16512                super::super::GetTriggerResponse,
16513                ::buffa::DecodeError,
16514            > {
16515                self.0.to_owned_message()
16516            }
16517            /// The underlying bytes buffer.
16518            #[must_use]
16519            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16520                self.0.bytes()
16521            }
16522            /// Consume the handle, returning the underlying bytes buffer.
16523            #[must_use]
16524            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16525                self.0.into_bytes()
16526            }
16527            /// Trigger state and configuration.
16528            ///
16529            /// Field 1: `trigger`
16530            #[must_use]
16531            pub fn trigger(
16532                &self,
16533            ) -> &::buffa::MessageFieldView<
16534                super::super::__buffa::view::TriggerView<'_>,
16535            > {
16536                &self.0.reborrow().trigger
16537            }
16538        }
16539        impl ::core::convert::From<::buffa::OwnedView<GetTriggerResponseView<'static>>>
16540        for GetTriggerResponseOwnedView {
16541            fn from(inner: ::buffa::OwnedView<GetTriggerResponseView<'static>>) -> Self {
16542                GetTriggerResponseOwnedView(inner)
16543            }
16544        }
16545        impl ::core::convert::From<GetTriggerResponseOwnedView>
16546        for ::buffa::OwnedView<GetTriggerResponseView<'static>> {
16547            fn from(wrapper: GetTriggerResponseOwnedView) -> Self {
16548                wrapper.0
16549            }
16550        }
16551        impl ::core::convert::AsRef<::buffa::OwnedView<GetTriggerResponseView<'static>>>
16552        for GetTriggerResponseOwnedView {
16553            fn as_ref(&self) -> &::buffa::OwnedView<GetTriggerResponseView<'static>> {
16554                &self.0
16555            }
16556        }
16557        impl ::buffa::HasMessageView for super::super::GetTriggerResponse {
16558            type View<'a> = GetTriggerResponseView<'a>;
16559            type ViewHandle = GetTriggerResponseOwnedView;
16560        }
16561        impl ::serde::Serialize for GetTriggerResponseOwnedView {
16562            fn serialize<__S: ::serde::Serializer>(
16563                &self,
16564                __s: __S,
16565            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16566                ::serde::Serialize::serialize(&self.0, __s)
16567            }
16568        }
16569        /// =============================================================================
16570        /// List Triggers
16571        /// =============================================================================
16572        ///
16573        /// ListTriggersRequest lists triggers for an account.
16574        #[derive(Clone, Debug, Default)]
16575        pub struct ListTriggersRequestView<'a> {
16576            /// Optional sub-account to list triggers for. When empty or omitted, uses the
16577            /// caller's root account.
16578            ///
16579            /// Field 1: `subaccount_id`
16580            pub subaccount_id: ::core::option::Option<u64>,
16581            /// Optional filter by symbol.
16582            ///
16583            /// Field 2: `symbol`
16584            pub symbol: &'a str,
16585            /// Optional filter by status (can specify multiple).
16586            ///
16587            /// Field 3: `status`
16588            pub status: ::buffa::RepeatedView<
16589                'a,
16590                ::buffa::EnumValue<super::super::TriggerStatus>,
16591            >,
16592            /// Optional filter by type.
16593            ///
16594            /// Field 4: `trigger_type`
16595            pub trigger_type: ::buffa::EnumValue<super::super::TriggerType>,
16596            /// Optional filter by attached parent order ID.
16597            ///
16598            /// Field 5: `parent_order_id`
16599            pub parent_order_id: ::core::option::Option<u64>,
16600            /// Maximum number of triggers to return. Defaults to 100 when omitted;
16601            /// maximum is 1000.
16602            ///
16603            /// Field 10: `limit`
16604            pub limit: u32,
16605            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
16606            /// bound to the authenticated account, sub-account scope, filters, and newest
16607            /// first sort order.
16608            ///
16609            /// Field 12: `page_token`
16610            pub page_token: &'a str,
16611            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16612        }
16613        impl<'a> ::buffa::MessageView<'a> for ListTriggersRequestView<'a> {
16614            type Owned = super::super::ListTriggersRequest;
16615            fn decode_view(
16616                buf: &'a [u8],
16617            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16618                let __limit = ::core::cell::Cell::new(
16619                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16620                );
16621                <Self as ::buffa::MessageView>::decode_view_ctx(
16622                    buf,
16623                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16624                )
16625            }
16626            fn decode_view_with_ctx(
16627                buf: &'a [u8],
16628                ctx: ::buffa::DecodeContext<'_>,
16629            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16630                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16631            }
16632            fn merge_view_field(
16633                &mut self,
16634                tag: ::buffa::encoding::Tag,
16635                cur: &'a [u8],
16636                before_tag: &'a [u8],
16637                ctx: ::buffa::DecodeContext<'_>,
16638            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16639                let _ = ctx;
16640                #[allow(unused_variables)]
16641                let view = self;
16642                let mut cur = cur;
16643                match tag.field_number() {
16644                    1u32 => {
16645                        ::buffa::encoding::check_wire_type(
16646                            tag,
16647                            ::buffa::encoding::WireType::Fixed64,
16648                        )?;
16649                        view.subaccount_id = Some(
16650                            ::buffa::types::decode_fixed64(&mut cur)?,
16651                        );
16652                    }
16653                    2u32 => {
16654                        ::buffa::encoding::check_wire_type(
16655                            tag,
16656                            ::buffa::encoding::WireType::LengthDelimited,
16657                        )?;
16658                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
16659                    }
16660                    4u32 => {
16661                        ::buffa::encoding::check_wire_type(
16662                            tag,
16663                            ::buffa::encoding::WireType::Varint,
16664                        )?;
16665                        view.trigger_type = ::buffa::EnumValue::from(
16666                            ::buffa::types::decode_int32(&mut cur)?,
16667                        );
16668                    }
16669                    5u32 => {
16670                        ::buffa::encoding::check_wire_type(
16671                            tag,
16672                            ::buffa::encoding::WireType::Fixed64,
16673                        )?;
16674                        view.parent_order_id = Some(
16675                            ::buffa::types::decode_fixed64(&mut cur)?,
16676                        );
16677                    }
16678                    10u32 => {
16679                        ::buffa::encoding::check_wire_type(
16680                            tag,
16681                            ::buffa::encoding::WireType::Varint,
16682                        )?;
16683                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
16684                    }
16685                    12u32 => {
16686                        ::buffa::encoding::check_wire_type(
16687                            tag,
16688                            ::buffa::encoding::WireType::LengthDelimited,
16689                        )?;
16690                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
16691                    }
16692                    3u32 => {
16693                        if tag.wire_type()
16694                            == ::buffa::encoding::WireType::LengthDelimited
16695                        {
16696                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16697                            view.status
16698                                .reserve(::buffa::encoding::count_varints(payload));
16699                            let mut pcur: &[u8] = payload;
16700                            while !pcur.is_empty() {
16701                                view.status
16702                                    .push(
16703                                        ::buffa::EnumValue::from(
16704                                            ::buffa::types::decode_int32(&mut pcur)?,
16705                                        ),
16706                                    );
16707                            }
16708                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16709                        {
16710                            view.status
16711                                .push(
16712                                    ::buffa::EnumValue::from(
16713                                        ::buffa::types::decode_int32(&mut cur)?,
16714                                    ),
16715                                );
16716                        } else {
16717                            return Err(
16718                                ::buffa::encoding::wire_type_mismatch(
16719                                    tag,
16720                                    ::buffa::encoding::WireType::LengthDelimited,
16721                                ),
16722                            );
16723                        }
16724                    }
16725                    _ => {
16726                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16727                        let span_len = before_tag.len() - cur.len();
16728                        view.__buffa_unknown_fields
16729                            .push_record(before_tag, span_len, ctx)?;
16730                    }
16731                }
16732                ::core::result::Result::Ok(cur)
16733            }
16734            fn to_owned_message(
16735                &self,
16736            ) -> ::core::result::Result<
16737                super::super::ListTriggersRequest,
16738                ::buffa::DecodeError,
16739            > {
16740                self.to_owned_from_source(None)
16741            }
16742            #[allow(clippy::useless_conversion, clippy::needless_update)]
16743            fn to_owned_from_source(
16744                &self,
16745                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16746            ) -> ::core::result::Result<
16747                super::super::ListTriggersRequest,
16748                ::buffa::DecodeError,
16749            > {
16750                #[allow(unused_imports)]
16751                use ::buffa::alloc::string::ToString as _;
16752                let _ = __buffa_src;
16753                ::core::result::Result::Ok(super::super::ListTriggersRequest {
16754                    subaccount_id: self.subaccount_id,
16755                    symbol: self.symbol.to_string(),
16756                    status: self.status.to_vec(),
16757                    trigger_type: self.trigger_type,
16758                    parent_order_id: self.parent_order_id,
16759                    limit: self.limit,
16760                    page_token: self.page_token.to_string(),
16761                    __buffa_unknown_fields: self
16762                        .__buffa_unknown_fields
16763                        .to_owned()?
16764                        .into(),
16765                    ..::core::default::Default::default()
16766                })
16767            }
16768        }
16769        impl<'a> ::buffa::ViewEncode<'a> for ListTriggersRequestView<'a> {
16770            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16771            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16772                #[allow(unused_imports)]
16773                use ::buffa::Enumeration as _;
16774                let mut size = 0u32;
16775                if self.subaccount_id.is_some() {
16776                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16777                }
16778                if !self.symbol.is_empty() {
16779                    size
16780                        += 1u32
16781                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
16782                }
16783                if !self.status.is_empty() {
16784                    let payload: u32 = self
16785                        .status
16786                        .iter()
16787                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
16788                        .sum::<u32>();
16789                    size
16790                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16791                            + payload;
16792                }
16793                {
16794                    let val = self.trigger_type.to_i32();
16795                    if val != 0 {
16796                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
16797                    }
16798                }
16799                if self.parent_order_id.is_some() {
16800                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16801                }
16802                if self.limit != 0u32 {
16803                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
16804                }
16805                if !self.page_token.is_empty() {
16806                    size
16807                        += 1u32
16808                            + ::buffa::types::string_encoded_len(&self.page_token)
16809                                as u32;
16810                }
16811                size += self.__buffa_unknown_fields.encoded_len() as u32;
16812                size
16813            }
16814            #[allow(clippy::needless_borrow)]
16815            fn write_to(
16816                &self,
16817                _cache: &mut ::buffa::SizeCache,
16818                buf: &mut impl ::buffa::bytes::BufMut,
16819            ) {
16820                #[allow(unused_imports)]
16821                use ::buffa::Enumeration as _;
16822                if let Some(v) = self.subaccount_id {
16823                    ::buffa::types::put_fixed64_field(1u32, v, buf);
16824                }
16825                if !self.symbol.is_empty() {
16826                    ::buffa::types::put_string_field(2u32, &self.symbol, buf);
16827                }
16828                if !self.status.is_empty() {
16829                    let payload: u32 = self
16830                        .status
16831                        .iter()
16832                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
16833                        .sum::<u32>();
16834                    ::buffa::types::put_len_delimited_header(3u32, payload, buf);
16835                    for v in &self.status {
16836                        ::buffa::types::encode_int32(v.to_i32(), buf);
16837                    }
16838                }
16839                {
16840                    let val = self.trigger_type.to_i32();
16841                    if val != 0 {
16842                        ::buffa::types::put_int32_field(4u32, val, buf);
16843                    }
16844                }
16845                if let Some(v) = self.parent_order_id {
16846                    ::buffa::types::put_fixed64_field(5u32, v, buf);
16847                }
16848                if self.limit != 0u32 {
16849                    ::buffa::types::put_uint32_field(10u32, self.limit, buf);
16850                }
16851                if !self.page_token.is_empty() {
16852                    ::buffa::types::put_string_field(12u32, &self.page_token, buf);
16853                }
16854                self.__buffa_unknown_fields.write_to(buf);
16855            }
16856        }
16857        /// Serializes this view as protobuf JSON.
16858        ///
16859        /// Implicit-presence fields with default values are omitted, `required`
16860        /// fields are always emitted, explicit-presence (`optional`) fields are
16861        /// emitted only when set, bytes fields are base64-encoded, and enum
16862        /// values are their proto name strings.
16863        ///
16864        /// This impl uses `serialize_map(None)` because the number of emitted
16865        /// fields depends on default-omission rules; serializers that require
16866        /// known map lengths (e.g. `bincode`) will return a runtime error.
16867        /// Use the owned message type for those formats.
16868        impl<'__a> ::serde::Serialize for ListTriggersRequestView<'__a> {
16869            fn serialize<__S: ::serde::Serializer>(
16870                &self,
16871                __s: __S,
16872            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16873                use ::serde::ser::SerializeMap as _;
16874                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16875                if let ::core::option::Option::Some(__v) = self.subaccount_id {
16876                    __map
16877                        .serialize_entry(
16878                            "subaccountId",
16879                            &::buffa::json_helpers::ProtoJson(&__v),
16880                        )?;
16881                }
16882                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
16883                    __map.serialize_entry("symbol", self.symbol)?;
16884                }
16885                if !self.status.is_empty() {
16886                    __map
16887                        .serialize_entry(
16888                            "status",
16889                            &::buffa::json_helpers::EnumSeqJson(&self.status),
16890                        )?;
16891                }
16892                if !::buffa::json_helpers::skip_if::is_default_enum_value(
16893                    &self.trigger_type,
16894                ) {
16895                    __map.serialize_entry("triggerType", &self.trigger_type)?;
16896                }
16897                if let ::core::option::Option::Some(__v) = self.parent_order_id {
16898                    __map
16899                        .serialize_entry(
16900                            "parentOrderId",
16901                            &::buffa::json_helpers::ProtoJson(&__v),
16902                        )?;
16903                }
16904                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
16905                    __map
16906                        .serialize_entry(
16907                            "limit",
16908                            &::buffa::json_helpers::ProtoJson(&self.limit),
16909                        )?;
16910                }
16911                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
16912                    __map.serialize_entry("pageToken", self.page_token)?;
16913                }
16914                __map.end()
16915            }
16916        }
16917        impl<'a> ::buffa::MessageName for ListTriggersRequestView<'a> {
16918            const PACKAGE: &'static str = "triggers.v1";
16919            const NAME: &'static str = "ListTriggersRequest";
16920            const FULL_NAME: &'static str = "triggers.v1.ListTriggersRequest";
16921            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
16922        }
16923        ::buffa::impl_default_view_instance!(ListTriggersRequestView);
16924        ::buffa::impl_view_reborrow!(ListTriggersRequestView);
16925        /** Self-contained, `'static` owned view of a `ListTriggersRequest` message.
16926
16927 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.
16928
16929 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.*/
16930        #[derive(Clone, Debug)]
16931        pub struct ListTriggersRequestOwnedView(
16932            ::buffa::OwnedView<ListTriggersRequestView<'static>>,
16933        );
16934        impl ListTriggersRequestOwnedView {
16935            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16936            ///
16937            /// The view borrows directly from the buffer's data; the buffer is
16938            /// retained inside the returned handle.
16939            ///
16940            /// # Errors
16941            ///
16942            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16943            /// protobuf data.
16944            pub fn decode(
16945                bytes: ::buffa::bytes::Bytes,
16946            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16947                ::core::result::Result::Ok(
16948                    ListTriggersRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
16949                )
16950            }
16951            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16952            /// max message size).
16953            ///
16954            /// # Errors
16955            ///
16956            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16957            /// exceeds the configured limits.
16958            pub fn decode_with_options(
16959                bytes: ::buffa::bytes::Bytes,
16960                opts: &::buffa::DecodeOptions,
16961            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16962                ::core::result::Result::Ok(
16963                    ListTriggersRequestOwnedView(
16964                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16965                    ),
16966                )
16967            }
16968            /// Build from an owned message via an encode → decode round-trip.
16969            ///
16970            /// # Errors
16971            ///
16972            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16973            /// somehow invalid (should not happen for well-formed messages).
16974            pub fn from_owned(
16975                msg: &super::super::ListTriggersRequest,
16976            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16977                ::core::result::Result::Ok(
16978                    ListTriggersRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
16979                )
16980            }
16981            /// Borrow the full [`ListTriggersRequestView`] with its lifetime tied to `&self`.
16982            #[must_use]
16983            pub fn view(&self) -> &ListTriggersRequestView<'_> {
16984                self.0.reborrow()
16985            }
16986            /// Convert to the owned message type.
16987            ///
16988            /// # Errors
16989            ///
16990            /// Returns an error if re-materializing preserved unknown fields
16991            /// fails (e.g. the unknown-field limit is exceeded).
16992            pub fn to_owned_message(
16993                &self,
16994            ) -> ::core::result::Result<
16995                super::super::ListTriggersRequest,
16996                ::buffa::DecodeError,
16997            > {
16998                self.0.to_owned_message()
16999            }
17000            /// The underlying bytes buffer.
17001            #[must_use]
17002            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17003                self.0.bytes()
17004            }
17005            /// Consume the handle, returning the underlying bytes buffer.
17006            #[must_use]
17007            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17008                self.0.into_bytes()
17009            }
17010            /// Optional sub-account to list triggers for. When empty or omitted, uses the
17011            /// caller's root account.
17012            ///
17013            /// Field 1: `subaccount_id`
17014            #[must_use]
17015            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
17016                self.0.reborrow().subaccount_id
17017            }
17018            /// Optional filter by symbol.
17019            ///
17020            /// Field 2: `symbol`
17021            #[must_use]
17022            pub fn symbol(&self) -> &'_ str {
17023                self.0.reborrow().symbol
17024            }
17025            /// Optional filter by status (can specify multiple).
17026            ///
17027            /// Field 3: `status`
17028            #[must_use]
17029            pub fn status(
17030                &self,
17031            ) -> &::buffa::RepeatedView<
17032                '_,
17033                ::buffa::EnumValue<super::super::TriggerStatus>,
17034            > {
17035                &self.0.reborrow().status
17036            }
17037            /// Optional filter by type.
17038            ///
17039            /// Field 4: `trigger_type`
17040            #[must_use]
17041            pub fn trigger_type(&self) -> ::buffa::EnumValue<super::super::TriggerType> {
17042                self.0.reborrow().trigger_type
17043            }
17044            /// Optional filter by attached parent order ID.
17045            ///
17046            /// Field 5: `parent_order_id`
17047            #[must_use]
17048            pub fn parent_order_id(&self) -> ::core::option::Option<u64> {
17049                self.0.reborrow().parent_order_id
17050            }
17051            /// Maximum number of triggers to return. Defaults to 100 when omitted;
17052            /// maximum is 1000.
17053            ///
17054            /// Field 10: `limit`
17055            #[must_use]
17056            pub fn limit(&self) -> u32 {
17057                self.0.reborrow().limit
17058            }
17059            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17060            /// bound to the authenticated account, sub-account scope, filters, and newest
17061            /// first sort order.
17062            ///
17063            /// Field 12: `page_token`
17064            #[must_use]
17065            pub fn page_token(&self) -> &'_ str {
17066                self.0.reborrow().page_token
17067            }
17068        }
17069        impl ::core::convert::From<::buffa::OwnedView<ListTriggersRequestView<'static>>>
17070        for ListTriggersRequestOwnedView {
17071            fn from(
17072                inner: ::buffa::OwnedView<ListTriggersRequestView<'static>>,
17073            ) -> Self {
17074                ListTriggersRequestOwnedView(inner)
17075            }
17076        }
17077        impl ::core::convert::From<ListTriggersRequestOwnedView>
17078        for ::buffa::OwnedView<ListTriggersRequestView<'static>> {
17079            fn from(wrapper: ListTriggersRequestOwnedView) -> Self {
17080                wrapper.0
17081            }
17082        }
17083        impl ::core::convert::AsRef<::buffa::OwnedView<ListTriggersRequestView<'static>>>
17084        for ListTriggersRequestOwnedView {
17085            fn as_ref(&self) -> &::buffa::OwnedView<ListTriggersRequestView<'static>> {
17086                &self.0
17087            }
17088        }
17089        impl ::buffa::HasMessageView for super::super::ListTriggersRequest {
17090            type View<'a> = ListTriggersRequestView<'a>;
17091            type ViewHandle = ListTriggersRequestOwnedView;
17092        }
17093        impl ::serde::Serialize for ListTriggersRequestOwnedView {
17094            fn serialize<__S: ::serde::Serializer>(
17095                &self,
17096                __s: __S,
17097            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17098                ::serde::Serialize::serialize(&self.0, __s)
17099            }
17100        }
17101        /// ListTriggersResponse returns triggers ordered newest-first.
17102        #[derive(Clone, Debug, Default)]
17103        pub struct ListTriggersResponseView<'a> {
17104            /// Triggers ordered by creation time descending, then trigger ID descending.
17105            ///
17106            /// Field 1: `triggers`
17107            pub triggers: ::buffa::RepeatedView<
17108                'a,
17109                super::super::__buffa::view::TriggerView<'a>,
17110            >,
17111            /// Opaque cursor for the next page. Empty when no more results exist.
17112            ///
17113            /// Field 3: `next_page_token`
17114            pub next_page_token: &'a str,
17115            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17116        }
17117        impl<'a> ::buffa::MessageView<'a> for ListTriggersResponseView<'a> {
17118            type Owned = super::super::ListTriggersResponse;
17119            fn decode_view(
17120                buf: &'a [u8],
17121            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17122                let __limit = ::core::cell::Cell::new(
17123                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17124                );
17125                <Self as ::buffa::MessageView>::decode_view_ctx(
17126                    buf,
17127                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17128                )
17129            }
17130            fn decode_view_with_ctx(
17131                buf: &'a [u8],
17132                ctx: ::buffa::DecodeContext<'_>,
17133            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17134                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17135            }
17136            fn merge_view_field(
17137                &mut self,
17138                tag: ::buffa::encoding::Tag,
17139                cur: &'a [u8],
17140                before_tag: &'a [u8],
17141                ctx: ::buffa::DecodeContext<'_>,
17142            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17143                let _ = ctx;
17144                #[allow(unused_variables)]
17145                let view = self;
17146                let mut cur = cur;
17147                match tag.field_number() {
17148                    3u32 => {
17149                        ::buffa::encoding::check_wire_type(
17150                            tag,
17151                            ::buffa::encoding::WireType::LengthDelimited,
17152                        )?;
17153                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
17154                    }
17155                    1u32 => {
17156                        ::buffa::encoding::check_wire_type(
17157                            tag,
17158                            ::buffa::encoding::WireType::LengthDelimited,
17159                        )?;
17160                        let __sub_ctx = ctx.descend()?;
17161                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
17162                        view.triggers
17163                            .push(
17164                                <super::super::__buffa::view::TriggerView as ::buffa::MessageView>::decode_view_ctx(
17165                                    sub,
17166                                    __sub_ctx,
17167                                )?,
17168                            );
17169                    }
17170                    _ => {
17171                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17172                        let span_len = before_tag.len() - cur.len();
17173                        view.__buffa_unknown_fields
17174                            .push_record(before_tag, span_len, ctx)?;
17175                    }
17176                }
17177                ::core::result::Result::Ok(cur)
17178            }
17179            fn to_owned_message(
17180                &self,
17181            ) -> ::core::result::Result<
17182                super::super::ListTriggersResponse,
17183                ::buffa::DecodeError,
17184            > {
17185                self.to_owned_from_source(None)
17186            }
17187            #[allow(clippy::useless_conversion, clippy::needless_update)]
17188            fn to_owned_from_source(
17189                &self,
17190                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17191            ) -> ::core::result::Result<
17192                super::super::ListTriggersResponse,
17193                ::buffa::DecodeError,
17194            > {
17195                #[allow(unused_imports)]
17196                use ::buffa::alloc::string::ToString as _;
17197                let _ = __buffa_src;
17198                ::core::result::Result::Ok(super::super::ListTriggersResponse {
17199                    triggers: self
17200                        .triggers
17201                        .iter()
17202                        .map(|v| v.to_owned_from_source(__buffa_src))
17203                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
17204                    next_page_token: self.next_page_token.to_string(),
17205                    __buffa_unknown_fields: self
17206                        .__buffa_unknown_fields
17207                        .to_owned()?
17208                        .into(),
17209                    ..::core::default::Default::default()
17210                })
17211            }
17212        }
17213        impl<'a> ::buffa::ViewEncode<'a> for ListTriggersResponseView<'a> {
17214            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17215            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
17216                #[allow(unused_imports)]
17217                use ::buffa::Enumeration as _;
17218                let mut size = 0u32;
17219                for v in &self.triggers {
17220                    let __slot = __cache.reserve();
17221                    let inner_size = v.compute_size(__cache);
17222                    __cache.set(__slot, inner_size);
17223                    size
17224                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
17225                            + inner_size;
17226                }
17227                if !self.next_page_token.is_empty() {
17228                    size
17229                        += 1u32
17230                            + ::buffa::types::string_encoded_len(&self.next_page_token)
17231                                as u32;
17232                }
17233                size += self.__buffa_unknown_fields.encoded_len() as u32;
17234                size
17235            }
17236            #[allow(clippy::needless_borrow)]
17237            fn write_to(
17238                &self,
17239                __cache: &mut ::buffa::SizeCache,
17240                buf: &mut impl ::buffa::bytes::BufMut,
17241            ) {
17242                #[allow(unused_imports)]
17243                use ::buffa::Enumeration as _;
17244                for v in &self.triggers {
17245                    ::buffa::types::put_len_delimited_header(
17246                        1u32,
17247                        __cache.consume_next(),
17248                        buf,
17249                    );
17250                    v.write_to(__cache, buf);
17251                }
17252                if !self.next_page_token.is_empty() {
17253                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
17254                }
17255                self.__buffa_unknown_fields.write_to(buf);
17256            }
17257        }
17258        /// Serializes this view as protobuf JSON.
17259        ///
17260        /// Implicit-presence fields with default values are omitted, `required`
17261        /// fields are always emitted, explicit-presence (`optional`) fields are
17262        /// emitted only when set, bytes fields are base64-encoded, and enum
17263        /// values are their proto name strings.
17264        ///
17265        /// This impl uses `serialize_map(None)` because the number of emitted
17266        /// fields depends on default-omission rules; serializers that require
17267        /// known map lengths (e.g. `bincode`) will return a runtime error.
17268        /// Use the owned message type for those formats.
17269        impl<'__a> ::serde::Serialize for ListTriggersResponseView<'__a> {
17270            fn serialize<__S: ::serde::Serializer>(
17271                &self,
17272                __s: __S,
17273            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17274                use ::serde::ser::SerializeMap as _;
17275                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17276                if !self.triggers.is_empty() {
17277                    __map.serialize_entry("triggers", &*self.triggers)?;
17278                }
17279                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
17280                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
17281                }
17282                __map.end()
17283            }
17284        }
17285        impl<'a> ::buffa::MessageName for ListTriggersResponseView<'a> {
17286            const PACKAGE: &'static str = "triggers.v1";
17287            const NAME: &'static str = "ListTriggersResponse";
17288            const FULL_NAME: &'static str = "triggers.v1.ListTriggersResponse";
17289            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
17290        }
17291        ::buffa::impl_default_view_instance!(ListTriggersResponseView);
17292        ::buffa::impl_view_reborrow!(ListTriggersResponseView);
17293        /** Self-contained, `'static` owned view of a `ListTriggersResponse` message.
17294
17295 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.
17296
17297 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.*/
17298        #[derive(Clone, Debug)]
17299        pub struct ListTriggersResponseOwnedView(
17300            ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17301        );
17302        impl ListTriggersResponseOwnedView {
17303            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17304            ///
17305            /// The view borrows directly from the buffer's data; the buffer is
17306            /// retained inside the returned handle.
17307            ///
17308            /// # Errors
17309            ///
17310            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17311            /// protobuf data.
17312            pub fn decode(
17313                bytes: ::buffa::bytes::Bytes,
17314            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17315                ::core::result::Result::Ok(
17316                    ListTriggersResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
17317                )
17318            }
17319            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17320            /// max message size).
17321            ///
17322            /// # Errors
17323            ///
17324            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17325            /// exceeds the configured limits.
17326            pub fn decode_with_options(
17327                bytes: ::buffa::bytes::Bytes,
17328                opts: &::buffa::DecodeOptions,
17329            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17330                ::core::result::Result::Ok(
17331                    ListTriggersResponseOwnedView(
17332                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17333                    ),
17334                )
17335            }
17336            /// Build from an owned message via an encode → decode round-trip.
17337            ///
17338            /// # Errors
17339            ///
17340            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17341            /// somehow invalid (should not happen for well-formed messages).
17342            pub fn from_owned(
17343                msg: &super::super::ListTriggersResponse,
17344            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17345                ::core::result::Result::Ok(
17346                    ListTriggersResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
17347                )
17348            }
17349            /// Borrow the full [`ListTriggersResponseView`] with its lifetime tied to `&self`.
17350            #[must_use]
17351            pub fn view(&self) -> &ListTriggersResponseView<'_> {
17352                self.0.reborrow()
17353            }
17354            /// Convert to the owned message type.
17355            ///
17356            /// # Errors
17357            ///
17358            /// Returns an error if re-materializing preserved unknown fields
17359            /// fails (e.g. the unknown-field limit is exceeded).
17360            pub fn to_owned_message(
17361                &self,
17362            ) -> ::core::result::Result<
17363                super::super::ListTriggersResponse,
17364                ::buffa::DecodeError,
17365            > {
17366                self.0.to_owned_message()
17367            }
17368            /// The underlying bytes buffer.
17369            #[must_use]
17370            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17371                self.0.bytes()
17372            }
17373            /// Consume the handle, returning the underlying bytes buffer.
17374            #[must_use]
17375            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17376                self.0.into_bytes()
17377            }
17378            /// Triggers ordered by creation time descending, then trigger ID descending.
17379            ///
17380            /// Field 1: `triggers`
17381            #[must_use]
17382            pub fn triggers(
17383                &self,
17384            ) -> &::buffa::RepeatedView<
17385                '_,
17386                super::super::__buffa::view::TriggerView<'_>,
17387            > {
17388                &self.0.reborrow().triggers
17389            }
17390            /// Opaque cursor for the next page. Empty when no more results exist.
17391            ///
17392            /// Field 3: `next_page_token`
17393            #[must_use]
17394            pub fn next_page_token(&self) -> &'_ str {
17395                self.0.reborrow().next_page_token
17396            }
17397        }
17398        impl ::core::convert::From<::buffa::OwnedView<ListTriggersResponseView<'static>>>
17399        for ListTriggersResponseOwnedView {
17400            fn from(
17401                inner: ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17402            ) -> Self {
17403                ListTriggersResponseOwnedView(inner)
17404            }
17405        }
17406        impl ::core::convert::From<ListTriggersResponseOwnedView>
17407        for ::buffa::OwnedView<ListTriggersResponseView<'static>> {
17408            fn from(wrapper: ListTriggersResponseOwnedView) -> Self {
17409                wrapper.0
17410            }
17411        }
17412        impl ::core::convert::AsRef<
17413            ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17414        > for ListTriggersResponseOwnedView {
17415            fn as_ref(&self) -> &::buffa::OwnedView<ListTriggersResponseView<'static>> {
17416                &self.0
17417            }
17418        }
17419        impl ::buffa::HasMessageView for super::super::ListTriggersResponse {
17420            type View<'a> = ListTriggersResponseView<'a>;
17421            type ViewHandle = ListTriggersResponseOwnedView;
17422        }
17423        impl ::serde::Serialize for ListTriggersResponseOwnedView {
17424            fn serialize<__S: ::serde::Serializer>(
17425                &self,
17426                __s: __S,
17427            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17428                ::serde::Serialize::serialize(&self.0, __s)
17429            }
17430        }
17431        /// =============================================================================
17432        /// Trigger Events (History / Audit)
17433        /// =============================================================================
17434        ///
17435        /// ListTriggerEventsRequest lists historical events for one trigger.
17436        #[derive(Clone, Debug, Default)]
17437        pub struct ListTriggerEventsRequestView<'a> {
17438            /// Trigger ID to list events for.
17439            ///
17440            /// Field 1: `trigger_id`
17441            pub trigger_id: u64,
17442            /// Optional sub-account (authorization). When empty or omitted, uses the
17443            /// caller's root account.
17444            ///
17445            /// Field 2: `subaccount_id`
17446            pub subaccount_id: ::core::option::Option<u64>,
17447            /// Maximum number of events to return. Defaults to 100 when omitted; maximum
17448            /// is 1000.
17449            ///
17450            /// Field 3: `limit`
17451            pub limit: u32,
17452            /// Optional event category filter. When unspecified, returns all event
17453            /// categories. Use EVENT_FIRED to enumerate child-order actions.
17454            ///
17455            /// Field 4: `event_type`
17456            pub event_type: ::buffa::EnumValue<super::super::TriggerEventType>,
17457            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17458            /// bound to the authenticated account, trigger, sub-account scope, event
17459            /// filter, and newest-first sort order.
17460            ///
17461            /// Field 5: `page_token`
17462            pub page_token: &'a str,
17463            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17464        }
17465        impl<'a> ::buffa::MessageView<'a> for ListTriggerEventsRequestView<'a> {
17466            type Owned = super::super::ListTriggerEventsRequest;
17467            fn decode_view(
17468                buf: &'a [u8],
17469            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17470                let __limit = ::core::cell::Cell::new(
17471                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17472                );
17473                <Self as ::buffa::MessageView>::decode_view_ctx(
17474                    buf,
17475                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17476                )
17477            }
17478            fn decode_view_with_ctx(
17479                buf: &'a [u8],
17480                ctx: ::buffa::DecodeContext<'_>,
17481            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17482                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17483            }
17484            fn merge_view_field(
17485                &mut self,
17486                tag: ::buffa::encoding::Tag,
17487                cur: &'a [u8],
17488                before_tag: &'a [u8],
17489                ctx: ::buffa::DecodeContext<'_>,
17490            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17491                let _ = ctx;
17492                #[allow(unused_variables)]
17493                let view = self;
17494                let mut cur = cur;
17495                match tag.field_number() {
17496                    1u32 => {
17497                        ::buffa::encoding::check_wire_type(
17498                            tag,
17499                            ::buffa::encoding::WireType::Fixed64,
17500                        )?;
17501                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
17502                    }
17503                    2u32 => {
17504                        ::buffa::encoding::check_wire_type(
17505                            tag,
17506                            ::buffa::encoding::WireType::Fixed64,
17507                        )?;
17508                        view.subaccount_id = Some(
17509                            ::buffa::types::decode_fixed64(&mut cur)?,
17510                        );
17511                    }
17512                    3u32 => {
17513                        ::buffa::encoding::check_wire_type(
17514                            tag,
17515                            ::buffa::encoding::WireType::Varint,
17516                        )?;
17517                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
17518                    }
17519                    4u32 => {
17520                        ::buffa::encoding::check_wire_type(
17521                            tag,
17522                            ::buffa::encoding::WireType::Varint,
17523                        )?;
17524                        view.event_type = ::buffa::EnumValue::from(
17525                            ::buffa::types::decode_int32(&mut cur)?,
17526                        );
17527                    }
17528                    5u32 => {
17529                        ::buffa::encoding::check_wire_type(
17530                            tag,
17531                            ::buffa::encoding::WireType::LengthDelimited,
17532                        )?;
17533                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
17534                    }
17535                    _ => {
17536                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17537                        let span_len = before_tag.len() - cur.len();
17538                        view.__buffa_unknown_fields
17539                            .push_record(before_tag, span_len, ctx)?;
17540                    }
17541                }
17542                ::core::result::Result::Ok(cur)
17543            }
17544            fn to_owned_message(
17545                &self,
17546            ) -> ::core::result::Result<
17547                super::super::ListTriggerEventsRequest,
17548                ::buffa::DecodeError,
17549            > {
17550                self.to_owned_from_source(None)
17551            }
17552            #[allow(clippy::useless_conversion, clippy::needless_update)]
17553            fn to_owned_from_source(
17554                &self,
17555                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17556            ) -> ::core::result::Result<
17557                super::super::ListTriggerEventsRequest,
17558                ::buffa::DecodeError,
17559            > {
17560                #[allow(unused_imports)]
17561                use ::buffa::alloc::string::ToString as _;
17562                let _ = __buffa_src;
17563                ::core::result::Result::Ok(super::super::ListTriggerEventsRequest {
17564                    trigger_id: self.trigger_id,
17565                    subaccount_id: self.subaccount_id,
17566                    limit: self.limit,
17567                    event_type: self.event_type,
17568                    page_token: self.page_token.to_string(),
17569                    __buffa_unknown_fields: self
17570                        .__buffa_unknown_fields
17571                        .to_owned()?
17572                        .into(),
17573                    ..::core::default::Default::default()
17574                })
17575            }
17576        }
17577        impl<'a> ::buffa::ViewEncode<'a> for ListTriggerEventsRequestView<'a> {
17578            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17579            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17580                #[allow(unused_imports)]
17581                use ::buffa::Enumeration as _;
17582                let mut size = 0u32;
17583                if self.trigger_id != 0u64 {
17584                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17585                }
17586                if self.subaccount_id.is_some() {
17587                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17588                }
17589                if self.limit != 0u32 {
17590                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
17591                }
17592                {
17593                    let val = self.event_type.to_i32();
17594                    if val != 0 {
17595                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
17596                    }
17597                }
17598                if !self.page_token.is_empty() {
17599                    size
17600                        += 1u32
17601                            + ::buffa::types::string_encoded_len(&self.page_token)
17602                                as u32;
17603                }
17604                size += self.__buffa_unknown_fields.encoded_len() as u32;
17605                size
17606            }
17607            #[allow(clippy::needless_borrow)]
17608            fn write_to(
17609                &self,
17610                _cache: &mut ::buffa::SizeCache,
17611                buf: &mut impl ::buffa::bytes::BufMut,
17612            ) {
17613                #[allow(unused_imports)]
17614                use ::buffa::Enumeration as _;
17615                if self.trigger_id != 0u64 {
17616                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
17617                }
17618                if let Some(v) = self.subaccount_id {
17619                    ::buffa::types::put_fixed64_field(2u32, v, buf);
17620                }
17621                if self.limit != 0u32 {
17622                    ::buffa::types::put_uint32_field(3u32, self.limit, buf);
17623                }
17624                {
17625                    let val = self.event_type.to_i32();
17626                    if val != 0 {
17627                        ::buffa::types::put_int32_field(4u32, val, buf);
17628                    }
17629                }
17630                if !self.page_token.is_empty() {
17631                    ::buffa::types::put_string_field(5u32, &self.page_token, buf);
17632                }
17633                self.__buffa_unknown_fields.write_to(buf);
17634            }
17635        }
17636        /// Serializes this view as protobuf JSON.
17637        ///
17638        /// Implicit-presence fields with default values are omitted, `required`
17639        /// fields are always emitted, explicit-presence (`optional`) fields are
17640        /// emitted only when set, bytes fields are base64-encoded, and enum
17641        /// values are their proto name strings.
17642        ///
17643        /// This impl uses `serialize_map(None)` because the number of emitted
17644        /// fields depends on default-omission rules; serializers that require
17645        /// known map lengths (e.g. `bincode`) will return a runtime error.
17646        /// Use the owned message type for those formats.
17647        impl<'__a> ::serde::Serialize for ListTriggerEventsRequestView<'__a> {
17648            fn serialize<__S: ::serde::Serializer>(
17649                &self,
17650                __s: __S,
17651            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17652                use ::serde::ser::SerializeMap as _;
17653                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17654                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
17655                    __map
17656                        .serialize_entry(
17657                            "triggerId",
17658                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
17659                        )?;
17660                }
17661                if let ::core::option::Option::Some(__v) = self.subaccount_id {
17662                    __map
17663                        .serialize_entry(
17664                            "subaccountId",
17665                            &::buffa::json_helpers::ProtoJson(&__v),
17666                        )?;
17667                }
17668                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
17669                    __map
17670                        .serialize_entry(
17671                            "limit",
17672                            &::buffa::json_helpers::ProtoJson(&self.limit),
17673                        )?;
17674                }
17675                if !::buffa::json_helpers::skip_if::is_default_enum_value(
17676                    &self.event_type,
17677                ) {
17678                    __map.serialize_entry("eventType", &self.event_type)?;
17679                }
17680                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
17681                    __map.serialize_entry("pageToken", self.page_token)?;
17682                }
17683                __map.end()
17684            }
17685        }
17686        impl<'a> ::buffa::MessageName for ListTriggerEventsRequestView<'a> {
17687            const PACKAGE: &'static str = "triggers.v1";
17688            const NAME: &'static str = "ListTriggerEventsRequest";
17689            const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsRequest";
17690            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
17691        }
17692        ::buffa::impl_default_view_instance!(ListTriggerEventsRequestView);
17693        ::buffa::impl_view_reborrow!(ListTriggerEventsRequestView);
17694        /** Self-contained, `'static` owned view of a `ListTriggerEventsRequest` message.
17695
17696 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.
17697
17698 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.*/
17699        #[derive(Clone, Debug)]
17700        pub struct ListTriggerEventsRequestOwnedView(
17701            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17702        );
17703        impl ListTriggerEventsRequestOwnedView {
17704            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17705            ///
17706            /// The view borrows directly from the buffer's data; the buffer is
17707            /// retained inside the returned handle.
17708            ///
17709            /// # Errors
17710            ///
17711            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17712            /// protobuf data.
17713            pub fn decode(
17714                bytes: ::buffa::bytes::Bytes,
17715            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17716                ::core::result::Result::Ok(
17717                    ListTriggerEventsRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
17718                )
17719            }
17720            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17721            /// max message size).
17722            ///
17723            /// # Errors
17724            ///
17725            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17726            /// exceeds the configured limits.
17727            pub fn decode_with_options(
17728                bytes: ::buffa::bytes::Bytes,
17729                opts: &::buffa::DecodeOptions,
17730            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17731                ::core::result::Result::Ok(
17732                    ListTriggerEventsRequestOwnedView(
17733                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17734                    ),
17735                )
17736            }
17737            /// Build from an owned message via an encode → decode round-trip.
17738            ///
17739            /// # Errors
17740            ///
17741            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17742            /// somehow invalid (should not happen for well-formed messages).
17743            pub fn from_owned(
17744                msg: &super::super::ListTriggerEventsRequest,
17745            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17746                ::core::result::Result::Ok(
17747                    ListTriggerEventsRequestOwnedView(
17748                        ::buffa::OwnedView::from_owned(msg)?,
17749                    ),
17750                )
17751            }
17752            /// Borrow the full [`ListTriggerEventsRequestView`] with its lifetime tied to `&self`.
17753            #[must_use]
17754            pub fn view(&self) -> &ListTriggerEventsRequestView<'_> {
17755                self.0.reborrow()
17756            }
17757            /// Convert to the owned message type.
17758            ///
17759            /// # Errors
17760            ///
17761            /// Returns an error if re-materializing preserved unknown fields
17762            /// fails (e.g. the unknown-field limit is exceeded).
17763            pub fn to_owned_message(
17764                &self,
17765            ) -> ::core::result::Result<
17766                super::super::ListTriggerEventsRequest,
17767                ::buffa::DecodeError,
17768            > {
17769                self.0.to_owned_message()
17770            }
17771            /// The underlying bytes buffer.
17772            #[must_use]
17773            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17774                self.0.bytes()
17775            }
17776            /// Consume the handle, returning the underlying bytes buffer.
17777            #[must_use]
17778            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17779                self.0.into_bytes()
17780            }
17781            /// Trigger ID to list events for.
17782            ///
17783            /// Field 1: `trigger_id`
17784            #[must_use]
17785            pub fn trigger_id(&self) -> u64 {
17786                self.0.reborrow().trigger_id
17787            }
17788            /// Optional sub-account (authorization). When empty or omitted, uses the
17789            /// caller's root account.
17790            ///
17791            /// Field 2: `subaccount_id`
17792            #[must_use]
17793            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
17794                self.0.reborrow().subaccount_id
17795            }
17796            /// Maximum number of events to return. Defaults to 100 when omitted; maximum
17797            /// is 1000.
17798            ///
17799            /// Field 3: `limit`
17800            #[must_use]
17801            pub fn limit(&self) -> u32 {
17802                self.0.reborrow().limit
17803            }
17804            /// Optional event category filter. When unspecified, returns all event
17805            /// categories. Use EVENT_FIRED to enumerate child-order actions.
17806            ///
17807            /// Field 4: `event_type`
17808            #[must_use]
17809            pub fn event_type(
17810                &self,
17811            ) -> ::buffa::EnumValue<super::super::TriggerEventType> {
17812                self.0.reborrow().event_type
17813            }
17814            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17815            /// bound to the authenticated account, trigger, sub-account scope, event
17816            /// filter, and newest-first sort order.
17817            ///
17818            /// Field 5: `page_token`
17819            #[must_use]
17820            pub fn page_token(&self) -> &'_ str {
17821                self.0.reborrow().page_token
17822            }
17823        }
17824        impl ::core::convert::From<
17825            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17826        > for ListTriggerEventsRequestOwnedView {
17827            fn from(
17828                inner: ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17829            ) -> Self {
17830                ListTriggerEventsRequestOwnedView(inner)
17831            }
17832        }
17833        impl ::core::convert::From<ListTriggerEventsRequestOwnedView>
17834        for ::buffa::OwnedView<ListTriggerEventsRequestView<'static>> {
17835            fn from(wrapper: ListTriggerEventsRequestOwnedView) -> Self {
17836                wrapper.0
17837            }
17838        }
17839        impl ::core::convert::AsRef<
17840            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17841        > for ListTriggerEventsRequestOwnedView {
17842            fn as_ref(
17843                &self,
17844            ) -> &::buffa::OwnedView<ListTriggerEventsRequestView<'static>> {
17845                &self.0
17846            }
17847        }
17848        impl ::buffa::HasMessageView for super::super::ListTriggerEventsRequest {
17849            type View<'a> = ListTriggerEventsRequestView<'a>;
17850            type ViewHandle = ListTriggerEventsRequestOwnedView;
17851        }
17852        impl ::serde::Serialize for ListTriggerEventsRequestOwnedView {
17853            fn serialize<__S: ::serde::Serializer>(
17854                &self,
17855                __s: __S,
17856            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17857                ::serde::Serialize::serialize(&self.0, __s)
17858            }
17859        }
17860        /// TriggerEvent describes one historical trigger lifecycle event.
17861        #[derive(Clone, Debug, Default)]
17862        pub struct TriggerEventView<'a> {
17863            /// Trigger ID associated with the event.
17864            ///
17865            /// Field 1: `trigger_id`
17866            pub trigger_id: u64,
17867            /// Public account or sub-account ID associated with the trigger.
17868            ///
17869            /// Field 2: `subaccount_id`
17870            pub subaccount_id: u64,
17871            /// Trading symbol numeric identifier.
17872            ///
17873            /// Field 3: `symbol_id`
17874            pub symbol_id: u32,
17875            /// Trigger type at the time of the event.
17876            ///
17877            /// Field 4: `trigger_type`
17878            pub trigger_type: ::buffa::EnumValue<super::super::TriggerType>,
17879            /// Event category.
17880            ///
17881            /// Field 5: `event_type`
17882            pub event_type: ::buffa::EnumValue<super::super::TriggerEventType>,
17883            /// Event timestamp in nanoseconds since epoch (UTC).
17884            ///
17885            /// Field 10: `ts_ns`
17886            pub ts_ns: u64,
17887            /// Child sequence number for multi-child trigger strategies.
17888            ///
17889            /// Field 11: `child_seq`
17890            pub child_seq: i32,
17891            /// Child order ID created by this event, if any.
17892            ///
17893            /// Field 12: `child_order_id`
17894            pub child_order_id: u64,
17895            /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
17896            /// when not applicable.
17897            ///
17898            /// Field 13: `fire_price_ticks`
17899            pub fire_price_ticks: i64,
17900            /// Optional cancel reason.
17901            ///
17902            /// Field 20: `reason`
17903            pub reason: &'a str,
17904            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17905        }
17906        impl<'a> ::buffa::MessageView<'a> for TriggerEventView<'a> {
17907            type Owned = super::super::TriggerEvent;
17908            fn decode_view(
17909                buf: &'a [u8],
17910            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17911                let __limit = ::core::cell::Cell::new(
17912                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17913                );
17914                <Self as ::buffa::MessageView>::decode_view_ctx(
17915                    buf,
17916                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17917                )
17918            }
17919            fn decode_view_with_ctx(
17920                buf: &'a [u8],
17921                ctx: ::buffa::DecodeContext<'_>,
17922            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17923                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17924            }
17925            fn merge_view_field(
17926                &mut self,
17927                tag: ::buffa::encoding::Tag,
17928                cur: &'a [u8],
17929                before_tag: &'a [u8],
17930                ctx: ::buffa::DecodeContext<'_>,
17931            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17932                let _ = ctx;
17933                #[allow(unused_variables)]
17934                let view = self;
17935                let mut cur = cur;
17936                match tag.field_number() {
17937                    1u32 => {
17938                        ::buffa::encoding::check_wire_type(
17939                            tag,
17940                            ::buffa::encoding::WireType::Fixed64,
17941                        )?;
17942                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
17943                    }
17944                    2u32 => {
17945                        ::buffa::encoding::check_wire_type(
17946                            tag,
17947                            ::buffa::encoding::WireType::Fixed64,
17948                        )?;
17949                        view.subaccount_id = ::buffa::types::decode_fixed64(&mut cur)?;
17950                    }
17951                    3u32 => {
17952                        ::buffa::encoding::check_wire_type(
17953                            tag,
17954                            ::buffa::encoding::WireType::Varint,
17955                        )?;
17956                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
17957                    }
17958                    4u32 => {
17959                        ::buffa::encoding::check_wire_type(
17960                            tag,
17961                            ::buffa::encoding::WireType::Varint,
17962                        )?;
17963                        view.trigger_type = ::buffa::EnumValue::from(
17964                            ::buffa::types::decode_int32(&mut cur)?,
17965                        );
17966                    }
17967                    5u32 => {
17968                        ::buffa::encoding::check_wire_type(
17969                            tag,
17970                            ::buffa::encoding::WireType::Varint,
17971                        )?;
17972                        view.event_type = ::buffa::EnumValue::from(
17973                            ::buffa::types::decode_int32(&mut cur)?,
17974                        );
17975                    }
17976                    10u32 => {
17977                        ::buffa::encoding::check_wire_type(
17978                            tag,
17979                            ::buffa::encoding::WireType::Varint,
17980                        )?;
17981                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
17982                    }
17983                    11u32 => {
17984                        ::buffa::encoding::check_wire_type(
17985                            tag,
17986                            ::buffa::encoding::WireType::Varint,
17987                        )?;
17988                        view.child_seq = ::buffa::types::decode_int32(&mut cur)?;
17989                    }
17990                    12u32 => {
17991                        ::buffa::encoding::check_wire_type(
17992                            tag,
17993                            ::buffa::encoding::WireType::Fixed64,
17994                        )?;
17995                        view.child_order_id = ::buffa::types::decode_fixed64(&mut cur)?;
17996                    }
17997                    13u32 => {
17998                        ::buffa::encoding::check_wire_type(
17999                            tag,
18000                            ::buffa::encoding::WireType::Varint,
18001                        )?;
18002                        view.fire_price_ticks = ::buffa::types::decode_int64(&mut cur)?;
18003                    }
18004                    20u32 => {
18005                        ::buffa::encoding::check_wire_type(
18006                            tag,
18007                            ::buffa::encoding::WireType::LengthDelimited,
18008                        )?;
18009                        view.reason = ::buffa::types::borrow_str(&mut cur)?;
18010                    }
18011                    _ => {
18012                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18013                        let span_len = before_tag.len() - cur.len();
18014                        view.__buffa_unknown_fields
18015                            .push_record(before_tag, span_len, ctx)?;
18016                    }
18017                }
18018                ::core::result::Result::Ok(cur)
18019            }
18020            fn to_owned_message(
18021                &self,
18022            ) -> ::core::result::Result<
18023                super::super::TriggerEvent,
18024                ::buffa::DecodeError,
18025            > {
18026                self.to_owned_from_source(None)
18027            }
18028            #[allow(clippy::useless_conversion, clippy::needless_update)]
18029            fn to_owned_from_source(
18030                &self,
18031                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18032            ) -> ::core::result::Result<
18033                super::super::TriggerEvent,
18034                ::buffa::DecodeError,
18035            > {
18036                #[allow(unused_imports)]
18037                use ::buffa::alloc::string::ToString as _;
18038                let _ = __buffa_src;
18039                ::core::result::Result::Ok(super::super::TriggerEvent {
18040                    trigger_id: self.trigger_id,
18041                    subaccount_id: self.subaccount_id,
18042                    symbol_id: self.symbol_id,
18043                    trigger_type: self.trigger_type,
18044                    event_type: self.event_type,
18045                    ts_ns: self.ts_ns,
18046                    child_seq: self.child_seq,
18047                    child_order_id: self.child_order_id,
18048                    fire_price_ticks: self.fire_price_ticks,
18049                    reason: self.reason.to_string(),
18050                    __buffa_unknown_fields: self
18051                        .__buffa_unknown_fields
18052                        .to_owned()?
18053                        .into(),
18054                    ..::core::default::Default::default()
18055                })
18056            }
18057        }
18058        impl<'a> ::buffa::ViewEncode<'a> for TriggerEventView<'a> {
18059            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18060            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
18061                #[allow(unused_imports)]
18062                use ::buffa::Enumeration as _;
18063                let mut size = 0u32;
18064                if self.trigger_id != 0u64 {
18065                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18066                }
18067                if self.subaccount_id != 0u64 {
18068                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18069                }
18070                if self.symbol_id != 0u32 {
18071                    size
18072                        += 1u32
18073                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
18074                }
18075                {
18076                    let val = self.trigger_type.to_i32();
18077                    if val != 0 {
18078                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
18079                    }
18080                }
18081                {
18082                    let val = self.event_type.to_i32();
18083                    if val != 0 {
18084                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
18085                    }
18086                }
18087                if self.ts_ns != 0u64 {
18088                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
18089                }
18090                if self.child_seq != 0i32 {
18091                    size
18092                        += 1u32
18093                            + ::buffa::types::int32_encoded_len(self.child_seq) as u32;
18094                }
18095                if self.child_order_id != 0u64 {
18096                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18097                }
18098                if self.fire_price_ticks != 0i64 {
18099                    size
18100                        += 1u32
18101                            + ::buffa::types::int64_encoded_len(self.fire_price_ticks)
18102                                as u32;
18103                }
18104                if !self.reason.is_empty() {
18105                    size
18106                        += 2u32
18107                            + ::buffa::types::string_encoded_len(&self.reason) as u32;
18108                }
18109                size += self.__buffa_unknown_fields.encoded_len() as u32;
18110                size
18111            }
18112            #[allow(clippy::needless_borrow)]
18113            fn write_to(
18114                &self,
18115                _cache: &mut ::buffa::SizeCache,
18116                buf: &mut impl ::buffa::bytes::BufMut,
18117            ) {
18118                #[allow(unused_imports)]
18119                use ::buffa::Enumeration as _;
18120                if self.trigger_id != 0u64 {
18121                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
18122                }
18123                if self.subaccount_id != 0u64 {
18124                    ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
18125                }
18126                if self.symbol_id != 0u32 {
18127                    ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
18128                }
18129                {
18130                    let val = self.trigger_type.to_i32();
18131                    if val != 0 {
18132                        ::buffa::types::put_int32_field(4u32, val, buf);
18133                    }
18134                }
18135                {
18136                    let val = self.event_type.to_i32();
18137                    if val != 0 {
18138                        ::buffa::types::put_int32_field(5u32, val, buf);
18139                    }
18140                }
18141                if self.ts_ns != 0u64 {
18142                    ::buffa::types::put_uint64_field(10u32, self.ts_ns, buf);
18143                }
18144                if self.child_seq != 0i32 {
18145                    ::buffa::types::put_int32_field(11u32, self.child_seq, buf);
18146                }
18147                if self.child_order_id != 0u64 {
18148                    ::buffa::types::put_fixed64_field(12u32, self.child_order_id, buf);
18149                }
18150                if self.fire_price_ticks != 0i64 {
18151                    ::buffa::types::put_int64_field(13u32, self.fire_price_ticks, buf);
18152                }
18153                if !self.reason.is_empty() {
18154                    ::buffa::types::put_string_field(20u32, &self.reason, buf);
18155                }
18156                self.__buffa_unknown_fields.write_to(buf);
18157            }
18158        }
18159        /// Serializes this view as protobuf JSON.
18160        ///
18161        /// Implicit-presence fields with default values are omitted, `required`
18162        /// fields are always emitted, explicit-presence (`optional`) fields are
18163        /// emitted only when set, bytes fields are base64-encoded, and enum
18164        /// values are their proto name strings.
18165        ///
18166        /// This impl uses `serialize_map(None)` because the number of emitted
18167        /// fields depends on default-omission rules; serializers that require
18168        /// known map lengths (e.g. `bincode`) will return a runtime error.
18169        /// Use the owned message type for those formats.
18170        impl<'__a> ::serde::Serialize for TriggerEventView<'__a> {
18171            fn serialize<__S: ::serde::Serializer>(
18172                &self,
18173                __s: __S,
18174            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18175                use ::serde::ser::SerializeMap as _;
18176                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18177                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
18178                    __map
18179                        .serialize_entry(
18180                            "triggerId",
18181                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
18182                        )?;
18183                }
18184                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
18185                    __map
18186                        .serialize_entry(
18187                            "subaccountId",
18188                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
18189                        )?;
18190                }
18191                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
18192                    __map
18193                        .serialize_entry(
18194                            "symbolId",
18195                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
18196                        )?;
18197                }
18198                if !::buffa::json_helpers::skip_if::is_default_enum_value(
18199                    &self.trigger_type,
18200                ) {
18201                    __map.serialize_entry("triggerType", &self.trigger_type)?;
18202                }
18203                if !::buffa::json_helpers::skip_if::is_default_enum_value(
18204                    &self.event_type,
18205                ) {
18206                    __map.serialize_entry("eventType", &self.event_type)?;
18207                }
18208                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
18209                    __map
18210                        .serialize_entry(
18211                            "tsNs",
18212                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
18213                        )?;
18214                }
18215                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.child_seq) {
18216                    __map
18217                        .serialize_entry(
18218                            "childSeq",
18219                            &::buffa::json_helpers::ProtoJson(&self.child_seq),
18220                        )?;
18221                }
18222                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.child_order_id) {
18223                    __map
18224                        .serialize_entry(
18225                            "childOrderId",
18226                            &::buffa::json_helpers::ProtoJson(&self.child_order_id),
18227                        )?;
18228                }
18229                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.fire_price_ticks) {
18230                    __map
18231                        .serialize_entry(
18232                            "firePriceTicks",
18233                            &::buffa::json_helpers::ProtoJson(&self.fire_price_ticks),
18234                        )?;
18235                }
18236                if !::buffa::json_helpers::skip_if::is_empty_str(self.reason) {
18237                    __map.serialize_entry("reason", self.reason)?;
18238                }
18239                __map.end()
18240            }
18241        }
18242        impl<'a> ::buffa::MessageName for TriggerEventView<'a> {
18243            const PACKAGE: &'static str = "triggers.v1";
18244            const NAME: &'static str = "TriggerEvent";
18245            const FULL_NAME: &'static str = "triggers.v1.TriggerEvent";
18246            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
18247        }
18248        ::buffa::impl_default_view_instance!(TriggerEventView);
18249        ::buffa::impl_view_reborrow!(TriggerEventView);
18250        /** Self-contained, `'static` owned view of a `TriggerEvent` message.
18251
18252 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.
18253
18254 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.*/
18255        #[derive(Clone, Debug)]
18256        pub struct TriggerEventOwnedView(::buffa::OwnedView<TriggerEventView<'static>>);
18257        impl TriggerEventOwnedView {
18258            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18259            ///
18260            /// The view borrows directly from the buffer's data; the buffer is
18261            /// retained inside the returned handle.
18262            ///
18263            /// # Errors
18264            ///
18265            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18266            /// protobuf data.
18267            pub fn decode(
18268                bytes: ::buffa::bytes::Bytes,
18269            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18270                ::core::result::Result::Ok(
18271                    TriggerEventOwnedView(::buffa::OwnedView::decode(bytes)?),
18272                )
18273            }
18274            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18275            /// max message size).
18276            ///
18277            /// # Errors
18278            ///
18279            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18280            /// exceeds the configured limits.
18281            pub fn decode_with_options(
18282                bytes: ::buffa::bytes::Bytes,
18283                opts: &::buffa::DecodeOptions,
18284            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18285                ::core::result::Result::Ok(
18286                    TriggerEventOwnedView(
18287                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18288                    ),
18289                )
18290            }
18291            /// Build from an owned message via an encode → decode round-trip.
18292            ///
18293            /// # Errors
18294            ///
18295            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18296            /// somehow invalid (should not happen for well-formed messages).
18297            pub fn from_owned(
18298                msg: &super::super::TriggerEvent,
18299            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18300                ::core::result::Result::Ok(
18301                    TriggerEventOwnedView(::buffa::OwnedView::from_owned(msg)?),
18302                )
18303            }
18304            /// Borrow the full [`TriggerEventView`] with its lifetime tied to `&self`.
18305            #[must_use]
18306            pub fn view(&self) -> &TriggerEventView<'_> {
18307                self.0.reborrow()
18308            }
18309            /// Convert to the owned message type.
18310            ///
18311            /// # Errors
18312            ///
18313            /// Returns an error if re-materializing preserved unknown fields
18314            /// fails (e.g. the unknown-field limit is exceeded).
18315            pub fn to_owned_message(
18316                &self,
18317            ) -> ::core::result::Result<
18318                super::super::TriggerEvent,
18319                ::buffa::DecodeError,
18320            > {
18321                self.0.to_owned_message()
18322            }
18323            /// The underlying bytes buffer.
18324            #[must_use]
18325            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18326                self.0.bytes()
18327            }
18328            /// Consume the handle, returning the underlying bytes buffer.
18329            #[must_use]
18330            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18331                self.0.into_bytes()
18332            }
18333            /// Trigger ID associated with the event.
18334            ///
18335            /// Field 1: `trigger_id`
18336            #[must_use]
18337            pub fn trigger_id(&self) -> u64 {
18338                self.0.reborrow().trigger_id
18339            }
18340            /// Public account or sub-account ID associated with the trigger.
18341            ///
18342            /// Field 2: `subaccount_id`
18343            #[must_use]
18344            pub fn subaccount_id(&self) -> u64 {
18345                self.0.reborrow().subaccount_id
18346            }
18347            /// Trading symbol numeric identifier.
18348            ///
18349            /// Field 3: `symbol_id`
18350            #[must_use]
18351            pub fn symbol_id(&self) -> u32 {
18352                self.0.reborrow().symbol_id
18353            }
18354            /// Trigger type at the time of the event.
18355            ///
18356            /// Field 4: `trigger_type`
18357            #[must_use]
18358            pub fn trigger_type(&self) -> ::buffa::EnumValue<super::super::TriggerType> {
18359                self.0.reborrow().trigger_type
18360            }
18361            /// Event category.
18362            ///
18363            /// Field 5: `event_type`
18364            #[must_use]
18365            pub fn event_type(
18366                &self,
18367            ) -> ::buffa::EnumValue<super::super::TriggerEventType> {
18368                self.0.reborrow().event_type
18369            }
18370            /// Event timestamp in nanoseconds since epoch (UTC).
18371            ///
18372            /// Field 10: `ts_ns`
18373            #[must_use]
18374            pub fn ts_ns(&self) -> u64 {
18375                self.0.reborrow().ts_ns
18376            }
18377            /// Child sequence number for multi-child trigger strategies.
18378            ///
18379            /// Field 11: `child_seq`
18380            #[must_use]
18381            pub fn child_seq(&self) -> i32 {
18382                self.0.reborrow().child_seq
18383            }
18384            /// Child order ID created by this event, if any.
18385            ///
18386            /// Field 12: `child_order_id`
18387            #[must_use]
18388            pub fn child_order_id(&self) -> u64 {
18389                self.0.reborrow().child_order_id
18390            }
18391            /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
18392            /// when not applicable.
18393            ///
18394            /// Field 13: `fire_price_ticks`
18395            #[must_use]
18396            pub fn fire_price_ticks(&self) -> i64 {
18397                self.0.reborrow().fire_price_ticks
18398            }
18399            /// Optional cancel reason.
18400            ///
18401            /// Field 20: `reason`
18402            #[must_use]
18403            pub fn reason(&self) -> &'_ str {
18404                self.0.reborrow().reason
18405            }
18406        }
18407        impl ::core::convert::From<::buffa::OwnedView<TriggerEventView<'static>>>
18408        for TriggerEventOwnedView {
18409            fn from(inner: ::buffa::OwnedView<TriggerEventView<'static>>) -> Self {
18410                TriggerEventOwnedView(inner)
18411            }
18412        }
18413        impl ::core::convert::From<TriggerEventOwnedView>
18414        for ::buffa::OwnedView<TriggerEventView<'static>> {
18415            fn from(wrapper: TriggerEventOwnedView) -> Self {
18416                wrapper.0
18417            }
18418        }
18419        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerEventView<'static>>>
18420        for TriggerEventOwnedView {
18421            fn as_ref(&self) -> &::buffa::OwnedView<TriggerEventView<'static>> {
18422                &self.0
18423            }
18424        }
18425        impl ::buffa::HasMessageView for super::super::TriggerEvent {
18426            type View<'a> = TriggerEventView<'a>;
18427            type ViewHandle = TriggerEventOwnedView;
18428        }
18429        impl ::serde::Serialize for TriggerEventOwnedView {
18430            fn serialize<__S: ::serde::Serializer>(
18431                &self,
18432                __s: __S,
18433            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18434                ::serde::Serialize::serialize(&self.0, __s)
18435            }
18436        }
18437        /// ListTriggerEventsResponse returns historical events ordered newest-first.
18438        #[derive(Clone, Debug, Default)]
18439        pub struct ListTriggerEventsResponseView<'a> {
18440            /// Events ordered by event time descending, child sequence descending, and
18441            /// stable event tie-breakers descending.
18442            ///
18443            /// Field 1: `events`
18444            pub events: ::buffa::RepeatedView<
18445                'a,
18446                super::super::__buffa::view::TriggerEventView<'a>,
18447            >,
18448            /// Opaque cursor for the next page. Empty when no more results exist.
18449            ///
18450            /// Field 3: `next_page_token`
18451            pub next_page_token: &'a str,
18452            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18453        }
18454        impl<'a> ::buffa::MessageView<'a> for ListTriggerEventsResponseView<'a> {
18455            type Owned = super::super::ListTriggerEventsResponse;
18456            fn decode_view(
18457                buf: &'a [u8],
18458            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18459                let __limit = ::core::cell::Cell::new(
18460                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18461                );
18462                <Self as ::buffa::MessageView>::decode_view_ctx(
18463                    buf,
18464                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18465                )
18466            }
18467            fn decode_view_with_ctx(
18468                buf: &'a [u8],
18469                ctx: ::buffa::DecodeContext<'_>,
18470            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18471                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18472            }
18473            fn merge_view_field(
18474                &mut self,
18475                tag: ::buffa::encoding::Tag,
18476                cur: &'a [u8],
18477                before_tag: &'a [u8],
18478                ctx: ::buffa::DecodeContext<'_>,
18479            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18480                let _ = ctx;
18481                #[allow(unused_variables)]
18482                let view = self;
18483                let mut cur = cur;
18484                match tag.field_number() {
18485                    3u32 => {
18486                        ::buffa::encoding::check_wire_type(
18487                            tag,
18488                            ::buffa::encoding::WireType::LengthDelimited,
18489                        )?;
18490                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
18491                    }
18492                    1u32 => {
18493                        ::buffa::encoding::check_wire_type(
18494                            tag,
18495                            ::buffa::encoding::WireType::LengthDelimited,
18496                        )?;
18497                        let __sub_ctx = ctx.descend()?;
18498                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
18499                        view.events
18500                            .push(
18501                                <super::super::__buffa::view::TriggerEventView as ::buffa::MessageView>::decode_view_ctx(
18502                                    sub,
18503                                    __sub_ctx,
18504                                )?,
18505                            );
18506                    }
18507                    _ => {
18508                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18509                        let span_len = before_tag.len() - cur.len();
18510                        view.__buffa_unknown_fields
18511                            .push_record(before_tag, span_len, ctx)?;
18512                    }
18513                }
18514                ::core::result::Result::Ok(cur)
18515            }
18516            fn to_owned_message(
18517                &self,
18518            ) -> ::core::result::Result<
18519                super::super::ListTriggerEventsResponse,
18520                ::buffa::DecodeError,
18521            > {
18522                self.to_owned_from_source(None)
18523            }
18524            #[allow(clippy::useless_conversion, clippy::needless_update)]
18525            fn to_owned_from_source(
18526                &self,
18527                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18528            ) -> ::core::result::Result<
18529                super::super::ListTriggerEventsResponse,
18530                ::buffa::DecodeError,
18531            > {
18532                #[allow(unused_imports)]
18533                use ::buffa::alloc::string::ToString as _;
18534                let _ = __buffa_src;
18535                ::core::result::Result::Ok(super::super::ListTriggerEventsResponse {
18536                    events: self
18537                        .events
18538                        .iter()
18539                        .map(|v| v.to_owned_from_source(__buffa_src))
18540                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
18541                    next_page_token: self.next_page_token.to_string(),
18542                    __buffa_unknown_fields: self
18543                        .__buffa_unknown_fields
18544                        .to_owned()?
18545                        .into(),
18546                    ..::core::default::Default::default()
18547                })
18548            }
18549        }
18550        impl<'a> ::buffa::ViewEncode<'a> for ListTriggerEventsResponseView<'a> {
18551            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18552            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
18553                #[allow(unused_imports)]
18554                use ::buffa::Enumeration as _;
18555                let mut size = 0u32;
18556                for v in &self.events {
18557                    let __slot = __cache.reserve();
18558                    let inner_size = v.compute_size(__cache);
18559                    __cache.set(__slot, inner_size);
18560                    size
18561                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18562                            + inner_size;
18563                }
18564                if !self.next_page_token.is_empty() {
18565                    size
18566                        += 1u32
18567                            + ::buffa::types::string_encoded_len(&self.next_page_token)
18568                                as u32;
18569                }
18570                size += self.__buffa_unknown_fields.encoded_len() as u32;
18571                size
18572            }
18573            #[allow(clippy::needless_borrow)]
18574            fn write_to(
18575                &self,
18576                __cache: &mut ::buffa::SizeCache,
18577                buf: &mut impl ::buffa::bytes::BufMut,
18578            ) {
18579                #[allow(unused_imports)]
18580                use ::buffa::Enumeration as _;
18581                for v in &self.events {
18582                    ::buffa::types::put_len_delimited_header(
18583                        1u32,
18584                        __cache.consume_next(),
18585                        buf,
18586                    );
18587                    v.write_to(__cache, buf);
18588                }
18589                if !self.next_page_token.is_empty() {
18590                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
18591                }
18592                self.__buffa_unknown_fields.write_to(buf);
18593            }
18594        }
18595        /// Serializes this view as protobuf JSON.
18596        ///
18597        /// Implicit-presence fields with default values are omitted, `required`
18598        /// fields are always emitted, explicit-presence (`optional`) fields are
18599        /// emitted only when set, bytes fields are base64-encoded, and enum
18600        /// values are their proto name strings.
18601        ///
18602        /// This impl uses `serialize_map(None)` because the number of emitted
18603        /// fields depends on default-omission rules; serializers that require
18604        /// known map lengths (e.g. `bincode`) will return a runtime error.
18605        /// Use the owned message type for those formats.
18606        impl<'__a> ::serde::Serialize for ListTriggerEventsResponseView<'__a> {
18607            fn serialize<__S: ::serde::Serializer>(
18608                &self,
18609                __s: __S,
18610            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18611                use ::serde::ser::SerializeMap as _;
18612                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18613                if !self.events.is_empty() {
18614                    __map.serialize_entry("events", &*self.events)?;
18615                }
18616                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
18617                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
18618                }
18619                __map.end()
18620            }
18621        }
18622        impl<'a> ::buffa::MessageName for ListTriggerEventsResponseView<'a> {
18623            const PACKAGE: &'static str = "triggers.v1";
18624            const NAME: &'static str = "ListTriggerEventsResponse";
18625            const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsResponse";
18626            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
18627        }
18628        ::buffa::impl_default_view_instance!(ListTriggerEventsResponseView);
18629        ::buffa::impl_view_reborrow!(ListTriggerEventsResponseView);
18630        /** Self-contained, `'static` owned view of a `ListTriggerEventsResponse` message.
18631
18632 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.
18633
18634 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.*/
18635        #[derive(Clone, Debug)]
18636        pub struct ListTriggerEventsResponseOwnedView(
18637            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18638        );
18639        impl ListTriggerEventsResponseOwnedView {
18640            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18641            ///
18642            /// The view borrows directly from the buffer's data; the buffer is
18643            /// retained inside the returned handle.
18644            ///
18645            /// # Errors
18646            ///
18647            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18648            /// protobuf data.
18649            pub fn decode(
18650                bytes: ::buffa::bytes::Bytes,
18651            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18652                ::core::result::Result::Ok(
18653                    ListTriggerEventsResponseOwnedView(
18654                        ::buffa::OwnedView::decode(bytes)?,
18655                    ),
18656                )
18657            }
18658            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18659            /// max message size).
18660            ///
18661            /// # Errors
18662            ///
18663            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18664            /// exceeds the configured limits.
18665            pub fn decode_with_options(
18666                bytes: ::buffa::bytes::Bytes,
18667                opts: &::buffa::DecodeOptions,
18668            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18669                ::core::result::Result::Ok(
18670                    ListTriggerEventsResponseOwnedView(
18671                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18672                    ),
18673                )
18674            }
18675            /// Build from an owned message via an encode → decode round-trip.
18676            ///
18677            /// # Errors
18678            ///
18679            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18680            /// somehow invalid (should not happen for well-formed messages).
18681            pub fn from_owned(
18682                msg: &super::super::ListTriggerEventsResponse,
18683            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18684                ::core::result::Result::Ok(
18685                    ListTriggerEventsResponseOwnedView(
18686                        ::buffa::OwnedView::from_owned(msg)?,
18687                    ),
18688                )
18689            }
18690            /// Borrow the full [`ListTriggerEventsResponseView`] with its lifetime tied to `&self`.
18691            #[must_use]
18692            pub fn view(&self) -> &ListTriggerEventsResponseView<'_> {
18693                self.0.reborrow()
18694            }
18695            /// Convert to the owned message type.
18696            ///
18697            /// # Errors
18698            ///
18699            /// Returns an error if re-materializing preserved unknown fields
18700            /// fails (e.g. the unknown-field limit is exceeded).
18701            pub fn to_owned_message(
18702                &self,
18703            ) -> ::core::result::Result<
18704                super::super::ListTriggerEventsResponse,
18705                ::buffa::DecodeError,
18706            > {
18707                self.0.to_owned_message()
18708            }
18709            /// The underlying bytes buffer.
18710            #[must_use]
18711            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18712                self.0.bytes()
18713            }
18714            /// Consume the handle, returning the underlying bytes buffer.
18715            #[must_use]
18716            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18717                self.0.into_bytes()
18718            }
18719            /// Events ordered by event time descending, child sequence descending, and
18720            /// stable event tie-breakers descending.
18721            ///
18722            /// Field 1: `events`
18723            #[must_use]
18724            pub fn events(
18725                &self,
18726            ) -> &::buffa::RepeatedView<
18727                '_,
18728                super::super::__buffa::view::TriggerEventView<'_>,
18729            > {
18730                &self.0.reborrow().events
18731            }
18732            /// Opaque cursor for the next page. Empty when no more results exist.
18733            ///
18734            /// Field 3: `next_page_token`
18735            #[must_use]
18736            pub fn next_page_token(&self) -> &'_ str {
18737                self.0.reborrow().next_page_token
18738            }
18739        }
18740        impl ::core::convert::From<
18741            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18742        > for ListTriggerEventsResponseOwnedView {
18743            fn from(
18744                inner: ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18745            ) -> Self {
18746                ListTriggerEventsResponseOwnedView(inner)
18747            }
18748        }
18749        impl ::core::convert::From<ListTriggerEventsResponseOwnedView>
18750        for ::buffa::OwnedView<ListTriggerEventsResponseView<'static>> {
18751            fn from(wrapper: ListTriggerEventsResponseOwnedView) -> Self {
18752                wrapper.0
18753            }
18754        }
18755        impl ::core::convert::AsRef<
18756            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18757        > for ListTriggerEventsResponseOwnedView {
18758            fn as_ref(
18759                &self,
18760            ) -> &::buffa::OwnedView<ListTriggerEventsResponseView<'static>> {
18761                &self.0
18762            }
18763        }
18764        impl ::buffa::HasMessageView for super::super::ListTriggerEventsResponse {
18765            type View<'a> = ListTriggerEventsResponseView<'a>;
18766            type ViewHandle = ListTriggerEventsResponseOwnedView;
18767        }
18768        impl ::serde::Serialize for ListTriggerEventsResponseOwnedView {
18769            fn serialize<__S: ::serde::Serializer>(
18770                &self,
18771                __s: __S,
18772            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18773                ::serde::Serialize::serialize(&self.0, __s)
18774            }
18775        }
18776        /// =============================================================================
18777        /// Cancel Trigger
18778        /// =============================================================================
18779        ///
18780        /// CancelTriggerRequest cancels an active trigger by ID.
18781        #[derive(Clone, Debug, Default)]
18782        pub struct CancelTriggerRequestView<'a> {
18783            /// Trigger ID to cancel.
18784            ///
18785            /// Field 1: `trigger_id`
18786            pub trigger_id: u64,
18787            /// Optional sub-account for authorization.
18788            ///
18789            /// Field 2: `subaccount_id`
18790            pub subaccount_id: ::core::option::Option<u64>,
18791            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18792        }
18793        impl<'a> ::buffa::MessageView<'a> for CancelTriggerRequestView<'a> {
18794            type Owned = super::super::CancelTriggerRequest;
18795            fn decode_view(
18796                buf: &'a [u8],
18797            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18798                let __limit = ::core::cell::Cell::new(
18799                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18800                );
18801                <Self as ::buffa::MessageView>::decode_view_ctx(
18802                    buf,
18803                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18804                )
18805            }
18806            fn decode_view_with_ctx(
18807                buf: &'a [u8],
18808                ctx: ::buffa::DecodeContext<'_>,
18809            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18810                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18811            }
18812            fn merge_view_field(
18813                &mut self,
18814                tag: ::buffa::encoding::Tag,
18815                cur: &'a [u8],
18816                before_tag: &'a [u8],
18817                ctx: ::buffa::DecodeContext<'_>,
18818            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18819                let _ = ctx;
18820                #[allow(unused_variables)]
18821                let view = self;
18822                let mut cur = cur;
18823                match tag.field_number() {
18824                    1u32 => {
18825                        ::buffa::encoding::check_wire_type(
18826                            tag,
18827                            ::buffa::encoding::WireType::Fixed64,
18828                        )?;
18829                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
18830                    }
18831                    2u32 => {
18832                        ::buffa::encoding::check_wire_type(
18833                            tag,
18834                            ::buffa::encoding::WireType::Fixed64,
18835                        )?;
18836                        view.subaccount_id = Some(
18837                            ::buffa::types::decode_fixed64(&mut cur)?,
18838                        );
18839                    }
18840                    _ => {
18841                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18842                        let span_len = before_tag.len() - cur.len();
18843                        view.__buffa_unknown_fields
18844                            .push_record(before_tag, span_len, ctx)?;
18845                    }
18846                }
18847                ::core::result::Result::Ok(cur)
18848            }
18849            fn to_owned_message(
18850                &self,
18851            ) -> ::core::result::Result<
18852                super::super::CancelTriggerRequest,
18853                ::buffa::DecodeError,
18854            > {
18855                self.to_owned_from_source(None)
18856            }
18857            #[allow(clippy::useless_conversion, clippy::needless_update)]
18858            fn to_owned_from_source(
18859                &self,
18860                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18861            ) -> ::core::result::Result<
18862                super::super::CancelTriggerRequest,
18863                ::buffa::DecodeError,
18864            > {
18865                #[allow(unused_imports)]
18866                use ::buffa::alloc::string::ToString as _;
18867                let _ = __buffa_src;
18868                ::core::result::Result::Ok(super::super::CancelTriggerRequest {
18869                    trigger_id: self.trigger_id,
18870                    subaccount_id: self.subaccount_id,
18871                    __buffa_unknown_fields: self
18872                        .__buffa_unknown_fields
18873                        .to_owned()?
18874                        .into(),
18875                    ..::core::default::Default::default()
18876                })
18877            }
18878        }
18879        impl<'a> ::buffa::ViewEncode<'a> for CancelTriggerRequestView<'a> {
18880            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18881            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
18882                #[allow(unused_imports)]
18883                use ::buffa::Enumeration as _;
18884                let mut size = 0u32;
18885                if self.trigger_id != 0u64 {
18886                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18887                }
18888                if self.subaccount_id.is_some() {
18889                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18890                }
18891                size += self.__buffa_unknown_fields.encoded_len() as u32;
18892                size
18893            }
18894            #[allow(clippy::needless_borrow)]
18895            fn write_to(
18896                &self,
18897                _cache: &mut ::buffa::SizeCache,
18898                buf: &mut impl ::buffa::bytes::BufMut,
18899            ) {
18900                #[allow(unused_imports)]
18901                use ::buffa::Enumeration as _;
18902                if self.trigger_id != 0u64 {
18903                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
18904                }
18905                if let Some(v) = self.subaccount_id {
18906                    ::buffa::types::put_fixed64_field(2u32, v, buf);
18907                }
18908                self.__buffa_unknown_fields.write_to(buf);
18909            }
18910        }
18911        /// Serializes this view as protobuf JSON.
18912        ///
18913        /// Implicit-presence fields with default values are omitted, `required`
18914        /// fields are always emitted, explicit-presence (`optional`) fields are
18915        /// emitted only when set, bytes fields are base64-encoded, and enum
18916        /// values are their proto name strings.
18917        ///
18918        /// This impl uses `serialize_map(None)` because the number of emitted
18919        /// fields depends on default-omission rules; serializers that require
18920        /// known map lengths (e.g. `bincode`) will return a runtime error.
18921        /// Use the owned message type for those formats.
18922        impl<'__a> ::serde::Serialize for CancelTriggerRequestView<'__a> {
18923            fn serialize<__S: ::serde::Serializer>(
18924                &self,
18925                __s: __S,
18926            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18927                use ::serde::ser::SerializeMap as _;
18928                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18929                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
18930                    __map
18931                        .serialize_entry(
18932                            "triggerId",
18933                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
18934                        )?;
18935                }
18936                if let ::core::option::Option::Some(__v) = self.subaccount_id {
18937                    __map
18938                        .serialize_entry(
18939                            "subaccountId",
18940                            &::buffa::json_helpers::ProtoJson(&__v),
18941                        )?;
18942                }
18943                __map.end()
18944            }
18945        }
18946        impl<'a> ::buffa::MessageName for CancelTriggerRequestView<'a> {
18947            const PACKAGE: &'static str = "triggers.v1";
18948            const NAME: &'static str = "CancelTriggerRequest";
18949            const FULL_NAME: &'static str = "triggers.v1.CancelTriggerRequest";
18950            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
18951        }
18952        ::buffa::impl_default_view_instance!(CancelTriggerRequestView);
18953        ::buffa::impl_view_reborrow!(CancelTriggerRequestView);
18954        /** Self-contained, `'static` owned view of a `CancelTriggerRequest` message.
18955
18956 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.
18957
18958 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.*/
18959        #[derive(Clone, Debug)]
18960        pub struct CancelTriggerRequestOwnedView(
18961            ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
18962        );
18963        impl CancelTriggerRequestOwnedView {
18964            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18965            ///
18966            /// The view borrows directly from the buffer's data; the buffer is
18967            /// retained inside the returned handle.
18968            ///
18969            /// # Errors
18970            ///
18971            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18972            /// protobuf data.
18973            pub fn decode(
18974                bytes: ::buffa::bytes::Bytes,
18975            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18976                ::core::result::Result::Ok(
18977                    CancelTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
18978                )
18979            }
18980            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18981            /// max message size).
18982            ///
18983            /// # Errors
18984            ///
18985            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18986            /// exceeds the configured limits.
18987            pub fn decode_with_options(
18988                bytes: ::buffa::bytes::Bytes,
18989                opts: &::buffa::DecodeOptions,
18990            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18991                ::core::result::Result::Ok(
18992                    CancelTriggerRequestOwnedView(
18993                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18994                    ),
18995                )
18996            }
18997            /// Build from an owned message via an encode → decode round-trip.
18998            ///
18999            /// # Errors
19000            ///
19001            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19002            /// somehow invalid (should not happen for well-formed messages).
19003            pub fn from_owned(
19004                msg: &super::super::CancelTriggerRequest,
19005            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19006                ::core::result::Result::Ok(
19007                    CancelTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
19008                )
19009            }
19010            /// Borrow the full [`CancelTriggerRequestView`] with its lifetime tied to `&self`.
19011            #[must_use]
19012            pub fn view(&self) -> &CancelTriggerRequestView<'_> {
19013                self.0.reborrow()
19014            }
19015            /// Convert to the owned message type.
19016            ///
19017            /// # Errors
19018            ///
19019            /// Returns an error if re-materializing preserved unknown fields
19020            /// fails (e.g. the unknown-field limit is exceeded).
19021            pub fn to_owned_message(
19022                &self,
19023            ) -> ::core::result::Result<
19024                super::super::CancelTriggerRequest,
19025                ::buffa::DecodeError,
19026            > {
19027                self.0.to_owned_message()
19028            }
19029            /// The underlying bytes buffer.
19030            #[must_use]
19031            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19032                self.0.bytes()
19033            }
19034            /// Consume the handle, returning the underlying bytes buffer.
19035            #[must_use]
19036            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19037                self.0.into_bytes()
19038            }
19039            /// Trigger ID to cancel.
19040            ///
19041            /// Field 1: `trigger_id`
19042            #[must_use]
19043            pub fn trigger_id(&self) -> u64 {
19044                self.0.reborrow().trigger_id
19045            }
19046            /// Optional sub-account for authorization.
19047            ///
19048            /// Field 2: `subaccount_id`
19049            #[must_use]
19050            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
19051                self.0.reborrow().subaccount_id
19052            }
19053        }
19054        impl ::core::convert::From<::buffa::OwnedView<CancelTriggerRequestView<'static>>>
19055        for CancelTriggerRequestOwnedView {
19056            fn from(
19057                inner: ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
19058            ) -> Self {
19059                CancelTriggerRequestOwnedView(inner)
19060            }
19061        }
19062        impl ::core::convert::From<CancelTriggerRequestOwnedView>
19063        for ::buffa::OwnedView<CancelTriggerRequestView<'static>> {
19064            fn from(wrapper: CancelTriggerRequestOwnedView) -> Self {
19065                wrapper.0
19066            }
19067        }
19068        impl ::core::convert::AsRef<
19069            ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
19070        > for CancelTriggerRequestOwnedView {
19071            fn as_ref(&self) -> &::buffa::OwnedView<CancelTriggerRequestView<'static>> {
19072                &self.0
19073            }
19074        }
19075        impl ::buffa::HasMessageView for super::super::CancelTriggerRequest {
19076            type View<'a> = CancelTriggerRequestView<'a>;
19077            type ViewHandle = CancelTriggerRequestOwnedView;
19078        }
19079        impl ::serde::Serialize for CancelTriggerRequestOwnedView {
19080            fn serialize<__S: ::serde::Serializer>(
19081                &self,
19082                __s: __S,
19083            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19084                ::serde::Serialize::serialize(&self.0, __s)
19085            }
19086        }
19087        /// CancelTriggerResponse returns the final status after cancellation.
19088        #[derive(Clone, Debug, Default)]
19089        pub struct CancelTriggerResponseView<'a> {
19090            /// Trigger ID that was canceled.
19091            ///
19092            /// Field 1: `trigger_id`
19093            pub trigger_id: u64,
19094            /// Final status (should be STATUS_CANCELED).
19095            ///
19096            /// Field 2: `status`
19097            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
19098            /// Server timestamp.
19099            ///
19100            /// Field 3: `ts`
19101            pub ts: ::buffa::MessageFieldView<
19102                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
19103            >,
19104            /// Server timestamp in nanoseconds since epoch (UTC).
19105            ///
19106            /// Field 4: `ts_ns`
19107            pub ts_ns: u64,
19108            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19109        }
19110        impl<'a> ::buffa::MessageView<'a> for CancelTriggerResponseView<'a> {
19111            type Owned = super::super::CancelTriggerResponse;
19112            fn decode_view(
19113                buf: &'a [u8],
19114            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19115                let __limit = ::core::cell::Cell::new(
19116                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19117                );
19118                <Self as ::buffa::MessageView>::decode_view_ctx(
19119                    buf,
19120                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19121                )
19122            }
19123            fn decode_view_with_ctx(
19124                buf: &'a [u8],
19125                ctx: ::buffa::DecodeContext<'_>,
19126            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19127                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19128            }
19129            fn merge_view_field(
19130                &mut self,
19131                tag: ::buffa::encoding::Tag,
19132                cur: &'a [u8],
19133                before_tag: &'a [u8],
19134                ctx: ::buffa::DecodeContext<'_>,
19135            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19136                let _ = ctx;
19137                #[allow(unused_variables)]
19138                let view = self;
19139                let mut cur = cur;
19140                match tag.field_number() {
19141                    1u32 => {
19142                        ::buffa::encoding::check_wire_type(
19143                            tag,
19144                            ::buffa::encoding::WireType::Fixed64,
19145                        )?;
19146                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
19147                    }
19148                    2u32 => {
19149                        ::buffa::encoding::check_wire_type(
19150                            tag,
19151                            ::buffa::encoding::WireType::Varint,
19152                        )?;
19153                        view.status = ::buffa::EnumValue::from(
19154                            ::buffa::types::decode_int32(&mut cur)?,
19155                        );
19156                    }
19157                    3u32 => {
19158                        ::buffa::encoding::check_wire_type(
19159                            tag,
19160                            ::buffa::encoding::WireType::LengthDelimited,
19161                        )?;
19162                        let __sub_ctx = ctx.descend()?;
19163                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
19164                        match view.ts.as_mut() {
19165                            Some(existing) => {
19166                                ::buffa::MessageView::merge_into_view(
19167                                    existing,
19168                                    sub,
19169                                    __sub_ctx,
19170                                )?
19171                            }
19172                            None => {
19173                                view.ts = ::buffa::MessageFieldView::set(
19174                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
19175                                        sub,
19176                                        __sub_ctx,
19177                                    )?,
19178                                );
19179                            }
19180                        }
19181                    }
19182                    4u32 => {
19183                        ::buffa::encoding::check_wire_type(
19184                            tag,
19185                            ::buffa::encoding::WireType::Varint,
19186                        )?;
19187                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
19188                    }
19189                    _ => {
19190                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19191                        let span_len = before_tag.len() - cur.len();
19192                        view.__buffa_unknown_fields
19193                            .push_record(before_tag, span_len, ctx)?;
19194                    }
19195                }
19196                ::core::result::Result::Ok(cur)
19197            }
19198            fn to_owned_message(
19199                &self,
19200            ) -> ::core::result::Result<
19201                super::super::CancelTriggerResponse,
19202                ::buffa::DecodeError,
19203            > {
19204                self.to_owned_from_source(None)
19205            }
19206            #[allow(clippy::useless_conversion, clippy::needless_update)]
19207            fn to_owned_from_source(
19208                &self,
19209                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19210            ) -> ::core::result::Result<
19211                super::super::CancelTriggerResponse,
19212                ::buffa::DecodeError,
19213            > {
19214                #[allow(unused_imports)]
19215                use ::buffa::alloc::string::ToString as _;
19216                let _ = __buffa_src;
19217                ::core::result::Result::Ok(super::super::CancelTriggerResponse {
19218                    trigger_id: self.trigger_id,
19219                    status: self.status,
19220                    ts: match self.ts.as_option() {
19221                        Some(v) => {
19222                            ::buffa::MessageField::<
19223                                ::buffa_types::google::protobuf::Timestamp,
19224                            >::some(v.to_owned_from_source(__buffa_src)?)
19225                        }
19226                        None => ::buffa::MessageField::none(),
19227                    },
19228                    ts_ns: self.ts_ns,
19229                    __buffa_unknown_fields: self
19230                        .__buffa_unknown_fields
19231                        .to_owned()?
19232                        .into(),
19233                    ..::core::default::Default::default()
19234                })
19235            }
19236        }
19237        impl<'a> ::buffa::ViewEncode<'a> for CancelTriggerResponseView<'a> {
19238            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19239            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
19240                #[allow(unused_imports)]
19241                use ::buffa::Enumeration as _;
19242                let mut size = 0u32;
19243                if self.trigger_id != 0u64 {
19244                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19245                }
19246                {
19247                    let val = self.status.to_i32();
19248                    if val != 0 {
19249                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
19250                    }
19251                }
19252                if self.ts.is_set() {
19253                    let __slot = __cache.reserve();
19254                    let inner_size = self.ts.compute_size(__cache);
19255                    __cache.set(__slot, inner_size);
19256                    size
19257                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19258                            + inner_size;
19259                }
19260                if self.ts_ns != 0u64 {
19261                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
19262                }
19263                size += self.__buffa_unknown_fields.encoded_len() as u32;
19264                size
19265            }
19266            #[allow(clippy::needless_borrow)]
19267            fn write_to(
19268                &self,
19269                __cache: &mut ::buffa::SizeCache,
19270                buf: &mut impl ::buffa::bytes::BufMut,
19271            ) {
19272                #[allow(unused_imports)]
19273                use ::buffa::Enumeration as _;
19274                if self.trigger_id != 0u64 {
19275                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
19276                }
19277                {
19278                    let val = self.status.to_i32();
19279                    if val != 0 {
19280                        ::buffa::types::put_int32_field(2u32, val, buf);
19281                    }
19282                }
19283                if self.ts.is_set() {
19284                    ::buffa::types::put_len_delimited_header(
19285                        3u32,
19286                        __cache.consume_next(),
19287                        buf,
19288                    );
19289                    self.ts.write_to(__cache, buf);
19290                }
19291                if self.ts_ns != 0u64 {
19292                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
19293                }
19294                self.__buffa_unknown_fields.write_to(buf);
19295            }
19296        }
19297        /// Serializes this view as protobuf JSON.
19298        ///
19299        /// Implicit-presence fields with default values are omitted, `required`
19300        /// fields are always emitted, explicit-presence (`optional`) fields are
19301        /// emitted only when set, bytes fields are base64-encoded, and enum
19302        /// values are their proto name strings.
19303        ///
19304        /// This impl uses `serialize_map(None)` because the number of emitted
19305        /// fields depends on default-omission rules; serializers that require
19306        /// known map lengths (e.g. `bincode`) will return a runtime error.
19307        /// Use the owned message type for those formats.
19308        impl<'__a> ::serde::Serialize for CancelTriggerResponseView<'__a> {
19309            fn serialize<__S: ::serde::Serializer>(
19310                &self,
19311                __s: __S,
19312            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19313                use ::serde::ser::SerializeMap as _;
19314                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19315                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
19316                    __map
19317                        .serialize_entry(
19318                            "triggerId",
19319                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
19320                        )?;
19321                }
19322                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
19323                    __map.serialize_entry("status", &self.status)?;
19324                }
19325                {
19326                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
19327                        __map.serialize_entry("ts", __v)?;
19328                    }
19329                }
19330                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
19331                    __map
19332                        .serialize_entry(
19333                            "tsNs",
19334                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
19335                        )?;
19336                }
19337                __map.end()
19338            }
19339        }
19340        impl<'a> ::buffa::MessageName for CancelTriggerResponseView<'a> {
19341            const PACKAGE: &'static str = "triggers.v1";
19342            const NAME: &'static str = "CancelTriggerResponse";
19343            const FULL_NAME: &'static str = "triggers.v1.CancelTriggerResponse";
19344            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
19345        }
19346        ::buffa::impl_default_view_instance!(CancelTriggerResponseView);
19347        ::buffa::impl_view_reborrow!(CancelTriggerResponseView);
19348        /** Self-contained, `'static` owned view of a `CancelTriggerResponse` message.
19349
19350 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.
19351
19352 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.*/
19353        #[derive(Clone, Debug)]
19354        pub struct CancelTriggerResponseOwnedView(
19355            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19356        );
19357        impl CancelTriggerResponseOwnedView {
19358            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19359            ///
19360            /// The view borrows directly from the buffer's data; the buffer is
19361            /// retained inside the returned handle.
19362            ///
19363            /// # Errors
19364            ///
19365            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19366            /// protobuf data.
19367            pub fn decode(
19368                bytes: ::buffa::bytes::Bytes,
19369            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19370                ::core::result::Result::Ok(
19371                    CancelTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
19372                )
19373            }
19374            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19375            /// max message size).
19376            ///
19377            /// # Errors
19378            ///
19379            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19380            /// exceeds the configured limits.
19381            pub fn decode_with_options(
19382                bytes: ::buffa::bytes::Bytes,
19383                opts: &::buffa::DecodeOptions,
19384            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19385                ::core::result::Result::Ok(
19386                    CancelTriggerResponseOwnedView(
19387                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19388                    ),
19389                )
19390            }
19391            /// Build from an owned message via an encode → decode round-trip.
19392            ///
19393            /// # Errors
19394            ///
19395            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19396            /// somehow invalid (should not happen for well-formed messages).
19397            pub fn from_owned(
19398                msg: &super::super::CancelTriggerResponse,
19399            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19400                ::core::result::Result::Ok(
19401                    CancelTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
19402                )
19403            }
19404            /// Borrow the full [`CancelTriggerResponseView`] with its lifetime tied to `&self`.
19405            #[must_use]
19406            pub fn view(&self) -> &CancelTriggerResponseView<'_> {
19407                self.0.reborrow()
19408            }
19409            /// Convert to the owned message type.
19410            ///
19411            /// # Errors
19412            ///
19413            /// Returns an error if re-materializing preserved unknown fields
19414            /// fails (e.g. the unknown-field limit is exceeded).
19415            pub fn to_owned_message(
19416                &self,
19417            ) -> ::core::result::Result<
19418                super::super::CancelTriggerResponse,
19419                ::buffa::DecodeError,
19420            > {
19421                self.0.to_owned_message()
19422            }
19423            /// The underlying bytes buffer.
19424            #[must_use]
19425            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19426                self.0.bytes()
19427            }
19428            /// Consume the handle, returning the underlying bytes buffer.
19429            #[must_use]
19430            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19431                self.0.into_bytes()
19432            }
19433            /// Trigger ID that was canceled.
19434            ///
19435            /// Field 1: `trigger_id`
19436            #[must_use]
19437            pub fn trigger_id(&self) -> u64 {
19438                self.0.reborrow().trigger_id
19439            }
19440            /// Final status (should be STATUS_CANCELED).
19441            ///
19442            /// Field 2: `status`
19443            #[must_use]
19444            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
19445                self.0.reborrow().status
19446            }
19447            /// Server timestamp.
19448            ///
19449            /// Field 3: `ts`
19450            #[must_use]
19451            pub fn ts(
19452                &self,
19453            ) -> &::buffa::MessageFieldView<
19454                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
19455            > {
19456                &self.0.reborrow().ts
19457            }
19458            /// Server timestamp in nanoseconds since epoch (UTC).
19459            ///
19460            /// Field 4: `ts_ns`
19461            #[must_use]
19462            pub fn ts_ns(&self) -> u64 {
19463                self.0.reborrow().ts_ns
19464            }
19465        }
19466        impl ::core::convert::From<
19467            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19468        > for CancelTriggerResponseOwnedView {
19469            fn from(
19470                inner: ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19471            ) -> Self {
19472                CancelTriggerResponseOwnedView(inner)
19473            }
19474        }
19475        impl ::core::convert::From<CancelTriggerResponseOwnedView>
19476        for ::buffa::OwnedView<CancelTriggerResponseView<'static>> {
19477            fn from(wrapper: CancelTriggerResponseOwnedView) -> Self {
19478                wrapper.0
19479            }
19480        }
19481        impl ::core::convert::AsRef<
19482            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19483        > for CancelTriggerResponseOwnedView {
19484            fn as_ref(&self) -> &::buffa::OwnedView<CancelTriggerResponseView<'static>> {
19485                &self.0
19486            }
19487        }
19488        impl ::buffa::HasMessageView for super::super::CancelTriggerResponse {
19489            type View<'a> = CancelTriggerResponseView<'a>;
19490            type ViewHandle = CancelTriggerResponseOwnedView;
19491        }
19492        impl ::serde::Serialize for CancelTriggerResponseOwnedView {
19493            fn serialize<__S: ::serde::Serializer>(
19494                &self,
19495                __s: __S,
19496            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19497                ::serde::Serialize::serialize(&self.0, __s)
19498            }
19499        }
19500        /// =============================================================================
19501        /// Modify / Pause / Resume Trigger
19502        /// =============================================================================
19503        ///
19504        /// ModifyTriggerRequest applies a limited patch to an existing trigger.
19505        #[derive(Clone, Debug, Default)]
19506        pub struct ModifyTriggerRequestView<'a> {
19507            /// Trigger ID to modify.
19508            ///
19509            /// Field 1: `trigger_id`
19510            pub trigger_id: u64,
19511            /// Optional sub-account for authorization.
19512            ///
19513            /// Field 2: `subaccount_id`
19514            pub subaccount_id: ::core::option::Option<u64>,
19515            /// Patch fields for safe price, trailing-distance, and slippage edits.
19516            /// For stop/take-profit:
19517            /// Updated trigger price in quote units scaled by 1e6.
19518            ///
19519            /// Field 10: `trigger_price_ticks`
19520            pub trigger_price_ticks: ::core::option::Option<i64>,
19521            /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
19522            ///
19523            /// Field 11: `limit_price_ticks`
19524            pub limit_price_ticks: ::core::option::Option<i64>,
19525            /// Updated activation price in quote units scaled by 1e6.
19526            ///
19527            /// Field 14: `activation_price_ticks`
19528            pub activation_price_ticks: ::core::option::Option<i64>,
19529            pub trailing_distance: ::core::option::Option<
19530                super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance,
19531            >,
19532            pub max_slippage: ::core::option::Option<
19533                super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage,
19534            >,
19535            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19536        }
19537        impl<'a> ::buffa::MessageView<'a> for ModifyTriggerRequestView<'a> {
19538            type Owned = super::super::ModifyTriggerRequest;
19539            fn decode_view(
19540                buf: &'a [u8],
19541            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19542                let __limit = ::core::cell::Cell::new(
19543                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19544                );
19545                <Self as ::buffa::MessageView>::decode_view_ctx(
19546                    buf,
19547                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19548                )
19549            }
19550            fn decode_view_with_ctx(
19551                buf: &'a [u8],
19552                ctx: ::buffa::DecodeContext<'_>,
19553            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19554                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19555            }
19556            fn merge_view_field(
19557                &mut self,
19558                tag: ::buffa::encoding::Tag,
19559                cur: &'a [u8],
19560                before_tag: &'a [u8],
19561                ctx: ::buffa::DecodeContext<'_>,
19562            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19563                let _ = ctx;
19564                #[allow(unused_variables)]
19565                let view = self;
19566                let mut cur = cur;
19567                match tag.field_number() {
19568                    1u32 => {
19569                        ::buffa::encoding::check_wire_type(
19570                            tag,
19571                            ::buffa::encoding::WireType::Fixed64,
19572                        )?;
19573                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
19574                    }
19575                    2u32 => {
19576                        ::buffa::encoding::check_wire_type(
19577                            tag,
19578                            ::buffa::encoding::WireType::Fixed64,
19579                        )?;
19580                        view.subaccount_id = Some(
19581                            ::buffa::types::decode_fixed64(&mut cur)?,
19582                        );
19583                    }
19584                    10u32 => {
19585                        ::buffa::encoding::check_wire_type(
19586                            tag,
19587                            ::buffa::encoding::WireType::Varint,
19588                        )?;
19589                        view.trigger_price_ticks = Some(
19590                            ::buffa::types::decode_int64(&mut cur)?,
19591                        );
19592                    }
19593                    11u32 => {
19594                        ::buffa::encoding::check_wire_type(
19595                            tag,
19596                            ::buffa::encoding::WireType::Varint,
19597                        )?;
19598                        view.limit_price_ticks = Some(
19599                            ::buffa::types::decode_int64(&mut cur)?,
19600                        );
19601                    }
19602                    14u32 => {
19603                        ::buffa::encoding::check_wire_type(
19604                            tag,
19605                            ::buffa::encoding::WireType::Varint,
19606                        )?;
19607                        view.activation_price_ticks = Some(
19608                            ::buffa::types::decode_int64(&mut cur)?,
19609                        );
19610                    }
19611                    12u32 => {
19612                        ::buffa::encoding::check_wire_type(
19613                            tag,
19614                            ::buffa::encoding::WireType::Varint,
19615                        )?;
19616                        view.trailing_distance = Some(
19617                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19618                                ::buffa::types::decode_int64(&mut cur)?,
19619                            ),
19620                        );
19621                    }
19622                    13u32 => {
19623                        ::buffa::encoding::check_wire_type(
19624                            tag,
19625                            ::buffa::encoding::WireType::Varint,
19626                        )?;
19627                        view.trailing_distance = Some(
19628                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19629                                ::buffa::types::decode_int32(&mut cur)?,
19630                            ),
19631                        );
19632                    }
19633                    15u32 => {
19634                        ::buffa::encoding::check_wire_type(
19635                            tag,
19636                            ::buffa::encoding::WireType::Varint,
19637                        )?;
19638                        view.max_slippage = Some(
19639                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19640                                ::buffa::types::decode_int32(&mut cur)?,
19641                            ),
19642                        );
19643                    }
19644                    16u32 => {
19645                        ::buffa::encoding::check_wire_type(
19646                            tag,
19647                            ::buffa::encoding::WireType::Varint,
19648                        )?;
19649                        view.max_slippage = Some(
19650                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19651                                ::buffa::types::decode_int32(&mut cur)?,
19652                            ),
19653                        );
19654                    }
19655                    _ => {
19656                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19657                        let span_len = before_tag.len() - cur.len();
19658                        view.__buffa_unknown_fields
19659                            .push_record(before_tag, span_len, ctx)?;
19660                    }
19661                }
19662                ::core::result::Result::Ok(cur)
19663            }
19664            fn to_owned_message(
19665                &self,
19666            ) -> ::core::result::Result<
19667                super::super::ModifyTriggerRequest,
19668                ::buffa::DecodeError,
19669            > {
19670                self.to_owned_from_source(None)
19671            }
19672            #[allow(clippy::useless_conversion, clippy::needless_update)]
19673            fn to_owned_from_source(
19674                &self,
19675                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19676            ) -> ::core::result::Result<
19677                super::super::ModifyTriggerRequest,
19678                ::buffa::DecodeError,
19679            > {
19680                #[allow(unused_imports)]
19681                use ::buffa::alloc::string::ToString as _;
19682                let _ = __buffa_src;
19683                ::core::result::Result::Ok(super::super::ModifyTriggerRequest {
19684                    trigger_id: self.trigger_id,
19685                    subaccount_id: self.subaccount_id,
19686                    trigger_price_ticks: self.trigger_price_ticks,
19687                    limit_price_ticks: self.limit_price_ticks,
19688                    activation_price_ticks: self.activation_price_ticks,
19689                    trailing_distance: self
19690                        .trailing_distance
19691                        .as_ref()
19692                        .map(|v| match v {
19693                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19694                                v,
19695                            ) => {
19696                                super::super::__buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19697                                    *v,
19698                                )
19699                            }
19700                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19701                                v,
19702                            ) => {
19703                                super::super::__buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19704                                    *v,
19705                                )
19706                            }
19707                        }),
19708                    max_slippage: self
19709                        .max_slippage
19710                        .as_ref()
19711                        .map(|v| match v {
19712                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19713                                v,
19714                            ) => {
19715                                super::super::__buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19716                                    *v,
19717                                )
19718                            }
19719                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19720                                v,
19721                            ) => {
19722                                super::super::__buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19723                                    *v,
19724                                )
19725                            }
19726                        }),
19727                    __buffa_unknown_fields: self
19728                        .__buffa_unknown_fields
19729                        .to_owned()?
19730                        .into(),
19731                    ..::core::default::Default::default()
19732                })
19733            }
19734        }
19735        impl<'a> ::buffa::ViewEncode<'a> for ModifyTriggerRequestView<'a> {
19736            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19737            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
19738                #[allow(unused_imports)]
19739                use ::buffa::Enumeration as _;
19740                let mut size = 0u32;
19741                if self.trigger_id != 0u64 {
19742                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19743                }
19744                if self.subaccount_id.is_some() {
19745                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19746                }
19747                if let Some(v) = self.trigger_price_ticks {
19748                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19749                }
19750                if let Some(v) = self.limit_price_ticks {
19751                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19752                }
19753                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
19754                    match v {
19755                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19756                            v,
19757                        ) => {
19758                            size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
19759                        }
19760                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19761                            v,
19762                        ) => {
19763                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19764                        }
19765                    }
19766                }
19767                if let Some(v) = self.activation_price_ticks {
19768                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19769                }
19770                if let ::core::option::Option::Some(ref v) = self.max_slippage {
19771                    match v {
19772                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19773                            v,
19774                        ) => {
19775                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19776                        }
19777                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19778                            v,
19779                        ) => {
19780                            size += 2u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19781                        }
19782                    }
19783                }
19784                size += self.__buffa_unknown_fields.encoded_len() as u32;
19785                size
19786            }
19787            #[allow(clippy::needless_borrow)]
19788            fn write_to(
19789                &self,
19790                _cache: &mut ::buffa::SizeCache,
19791                buf: &mut impl ::buffa::bytes::BufMut,
19792            ) {
19793                #[allow(unused_imports)]
19794                use ::buffa::Enumeration as _;
19795                if self.trigger_id != 0u64 {
19796                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
19797                }
19798                if let Some(v) = self.subaccount_id {
19799                    ::buffa::types::put_fixed64_field(2u32, v, buf);
19800                }
19801                if let Some(v) = self.trigger_price_ticks {
19802                    ::buffa::types::put_int64_field(10u32, v, buf);
19803                }
19804                if let Some(v) = self.limit_price_ticks {
19805                    ::buffa::types::put_int64_field(11u32, v, buf);
19806                }
19807                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
19808                    match v {
19809                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19810                            x,
19811                        ) => {
19812                            ::buffa::types::put_int64_field(12u32, *x, buf);
19813                        }
19814                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19815                            x,
19816                        ) => {
19817                            ::buffa::types::put_int32_field(13u32, *x, buf);
19818                        }
19819                    }
19820                }
19821                if let Some(v) = self.activation_price_ticks {
19822                    ::buffa::types::put_int64_field(14u32, v, buf);
19823                }
19824                if let ::core::option::Option::Some(ref v) = self.max_slippage {
19825                    match v {
19826                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19827                            x,
19828                        ) => {
19829                            ::buffa::types::put_int32_field(15u32, *x, buf);
19830                        }
19831                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19832                            x,
19833                        ) => {
19834                            ::buffa::types::put_int32_field(16u32, *x, buf);
19835                        }
19836                    }
19837                }
19838                self.__buffa_unknown_fields.write_to(buf);
19839            }
19840        }
19841        /// Serializes this view as protobuf JSON.
19842        ///
19843        /// Implicit-presence fields with default values are omitted, `required`
19844        /// fields are always emitted, explicit-presence (`optional`) fields are
19845        /// emitted only when set, bytes fields are base64-encoded, and enum
19846        /// values are their proto name strings.
19847        ///
19848        /// This impl uses `serialize_map(None)` because the number of emitted
19849        /// fields depends on default-omission rules; serializers that require
19850        /// known map lengths (e.g. `bincode`) will return a runtime error.
19851        /// Use the owned message type for those formats.
19852        impl<'__a> ::serde::Serialize for ModifyTriggerRequestView<'__a> {
19853            fn serialize<__S: ::serde::Serializer>(
19854                &self,
19855                __s: __S,
19856            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19857                use ::serde::ser::SerializeMap as _;
19858                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19859                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
19860                    __map
19861                        .serialize_entry(
19862                            "triggerId",
19863                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
19864                        )?;
19865                }
19866                if let ::core::option::Option::Some(__v) = self.subaccount_id {
19867                    __map
19868                        .serialize_entry(
19869                            "subaccountId",
19870                            &::buffa::json_helpers::ProtoJson(&__v),
19871                        )?;
19872                }
19873                if let ::core::option::Option::Some(__v) = self.trigger_price_ticks {
19874                    __map
19875                        .serialize_entry(
19876                            "triggerPriceTicks",
19877                            &::buffa::json_helpers::ProtoJson(&__v),
19878                        )?;
19879                }
19880                if let ::core::option::Option::Some(__v) = self.limit_price_ticks {
19881                    __map
19882                        .serialize_entry(
19883                            "limitPriceTicks",
19884                            &::buffa::json_helpers::ProtoJson(&__v),
19885                        )?;
19886                }
19887                if let ::core::option::Option::Some(__v) = self.activation_price_ticks {
19888                    __map
19889                        .serialize_entry(
19890                            "activationPriceTicks",
19891                            &::buffa::json_helpers::ProtoJson(&__v),
19892                        )?;
19893                }
19894                if let ::core::option::Option::Some(ref __ov) = self.trailing_distance {
19895                    match __ov {
19896                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19897                            v,
19898                        ) => {
19899                            __map
19900                                .serialize_entry(
19901                                    "trailingDistanceTicks",
19902                                    &::buffa::json_helpers::ProtoJson(v),
19903                                )?;
19904                        }
19905                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19906                            v,
19907                        ) => {
19908                            __map
19909                                .serialize_entry(
19910                                    "trailingDistanceBps",
19911                                    &::buffa::json_helpers::ProtoJson(v),
19912                                )?;
19913                        }
19914                    }
19915                }
19916                if let ::core::option::Option::Some(ref __ov) = self.max_slippage {
19917                    match __ov {
19918                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19919                            v,
19920                        ) => {
19921                            __map
19922                                .serialize_entry(
19923                                    "maxSlippageTicks",
19924                                    &::buffa::json_helpers::ProtoJson(v),
19925                                )?;
19926                        }
19927                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19928                            v,
19929                        ) => {
19930                            __map
19931                                .serialize_entry(
19932                                    "maxSlippageBps",
19933                                    &::buffa::json_helpers::ProtoJson(v),
19934                                )?;
19935                        }
19936                    }
19937                }
19938                __map.end()
19939            }
19940        }
19941        impl<'a> ::buffa::MessageName for ModifyTriggerRequestView<'a> {
19942            const PACKAGE: &'static str = "triggers.v1";
19943            const NAME: &'static str = "ModifyTriggerRequest";
19944            const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerRequest";
19945            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
19946        }
19947        ::buffa::impl_default_view_instance!(ModifyTriggerRequestView);
19948        ::buffa::impl_view_reborrow!(ModifyTriggerRequestView);
19949        /** Self-contained, `'static` owned view of a `ModifyTriggerRequest` message.
19950
19951 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.
19952
19953 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.*/
19954        #[derive(Clone, Debug)]
19955        pub struct ModifyTriggerRequestOwnedView(
19956            ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
19957        );
19958        impl ModifyTriggerRequestOwnedView {
19959            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19960            ///
19961            /// The view borrows directly from the buffer's data; the buffer is
19962            /// retained inside the returned handle.
19963            ///
19964            /// # Errors
19965            ///
19966            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19967            /// protobuf data.
19968            pub fn decode(
19969                bytes: ::buffa::bytes::Bytes,
19970            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19971                ::core::result::Result::Ok(
19972                    ModifyTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
19973                )
19974            }
19975            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19976            /// max message size).
19977            ///
19978            /// # Errors
19979            ///
19980            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19981            /// exceeds the configured limits.
19982            pub fn decode_with_options(
19983                bytes: ::buffa::bytes::Bytes,
19984                opts: &::buffa::DecodeOptions,
19985            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19986                ::core::result::Result::Ok(
19987                    ModifyTriggerRequestOwnedView(
19988                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19989                    ),
19990                )
19991            }
19992            /// Build from an owned message via an encode → decode round-trip.
19993            ///
19994            /// # Errors
19995            ///
19996            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19997            /// somehow invalid (should not happen for well-formed messages).
19998            pub fn from_owned(
19999                msg: &super::super::ModifyTriggerRequest,
20000            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20001                ::core::result::Result::Ok(
20002                    ModifyTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
20003                )
20004            }
20005            /// Borrow the full [`ModifyTriggerRequestView`] with its lifetime tied to `&self`.
20006            #[must_use]
20007            pub fn view(&self) -> &ModifyTriggerRequestView<'_> {
20008                self.0.reborrow()
20009            }
20010            /// Convert to the owned message type.
20011            ///
20012            /// # Errors
20013            ///
20014            /// Returns an error if re-materializing preserved unknown fields
20015            /// fails (e.g. the unknown-field limit is exceeded).
20016            pub fn to_owned_message(
20017                &self,
20018            ) -> ::core::result::Result<
20019                super::super::ModifyTriggerRequest,
20020                ::buffa::DecodeError,
20021            > {
20022                self.0.to_owned_message()
20023            }
20024            /// The underlying bytes buffer.
20025            #[must_use]
20026            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20027                self.0.bytes()
20028            }
20029            /// Consume the handle, returning the underlying bytes buffer.
20030            #[must_use]
20031            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20032                self.0.into_bytes()
20033            }
20034            /// Trigger ID to modify.
20035            ///
20036            /// Field 1: `trigger_id`
20037            #[must_use]
20038            pub fn trigger_id(&self) -> u64 {
20039                self.0.reborrow().trigger_id
20040            }
20041            /// Optional sub-account for authorization.
20042            ///
20043            /// Field 2: `subaccount_id`
20044            #[must_use]
20045            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
20046                self.0.reborrow().subaccount_id
20047            }
20048            /// Patch fields for safe price, trailing-distance, and slippage edits.
20049            /// For stop/take-profit:
20050            /// Updated trigger price in quote units scaled by 1e6.
20051            ///
20052            /// Field 10: `trigger_price_ticks`
20053            #[must_use]
20054            pub fn trigger_price_ticks(&self) -> ::core::option::Option<i64> {
20055                self.0.reborrow().trigger_price_ticks
20056            }
20057            /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
20058            ///
20059            /// Field 11: `limit_price_ticks`
20060            #[must_use]
20061            pub fn limit_price_ticks(&self) -> ::core::option::Option<i64> {
20062                self.0.reborrow().limit_price_ticks
20063            }
20064            /// Updated activation price in quote units scaled by 1e6.
20065            ///
20066            /// Field 14: `activation_price_ticks`
20067            #[must_use]
20068            pub fn activation_price_ticks(&self) -> ::core::option::Option<i64> {
20069                self.0.reborrow().activation_price_ticks
20070            }
20071            /// Oneof `trailing_distance`.
20072            #[must_use]
20073            pub fn trailing_distance(
20074                &self,
20075            ) -> ::core::option::Option<
20076                &super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance,
20077            > {
20078                self.0.reborrow().trailing_distance.as_ref()
20079            }
20080            /// Oneof `max_slippage`.
20081            #[must_use]
20082            pub fn max_slippage(
20083                &self,
20084            ) -> ::core::option::Option<
20085                &super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage,
20086            > {
20087                self.0.reborrow().max_slippage.as_ref()
20088            }
20089        }
20090        impl ::core::convert::From<::buffa::OwnedView<ModifyTriggerRequestView<'static>>>
20091        for ModifyTriggerRequestOwnedView {
20092            fn from(
20093                inner: ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
20094            ) -> Self {
20095                ModifyTriggerRequestOwnedView(inner)
20096            }
20097        }
20098        impl ::core::convert::From<ModifyTriggerRequestOwnedView>
20099        for ::buffa::OwnedView<ModifyTriggerRequestView<'static>> {
20100            fn from(wrapper: ModifyTriggerRequestOwnedView) -> Self {
20101                wrapper.0
20102            }
20103        }
20104        impl ::core::convert::AsRef<
20105            ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
20106        > for ModifyTriggerRequestOwnedView {
20107            fn as_ref(&self) -> &::buffa::OwnedView<ModifyTriggerRequestView<'static>> {
20108                &self.0
20109            }
20110        }
20111        impl ::buffa::HasMessageView for super::super::ModifyTriggerRequest {
20112            type View<'a> = ModifyTriggerRequestView<'a>;
20113            type ViewHandle = ModifyTriggerRequestOwnedView;
20114        }
20115        impl ::serde::Serialize for ModifyTriggerRequestOwnedView {
20116            fn serialize<__S: ::serde::Serializer>(
20117                &self,
20118                __s: __S,
20119            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20120                ::serde::Serialize::serialize(&self.0, __s)
20121            }
20122        }
20123        /// ModifyTriggerResponse returns the trigger status after modification.
20124        #[derive(Clone, Debug, Default)]
20125        pub struct ModifyTriggerResponseView<'a> {
20126            /// Modified trigger ID.
20127            ///
20128            /// Field 1: `trigger_id`
20129            pub trigger_id: u64,
20130            /// Current trigger status after modification.
20131            ///
20132            /// Field 2: `status`
20133            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
20134            /// Server timestamp.
20135            ///
20136            /// Field 3: `ts`
20137            pub ts: ::buffa::MessageFieldView<
20138                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
20139            >,
20140            /// Server timestamp in nanoseconds since epoch (UTC).
20141            ///
20142            /// Field 4: `ts_ns`
20143            pub ts_ns: u64,
20144            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20145        }
20146        impl<'a> ::buffa::MessageView<'a> for ModifyTriggerResponseView<'a> {
20147            type Owned = super::super::ModifyTriggerResponse;
20148            fn decode_view(
20149                buf: &'a [u8],
20150            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20151                let __limit = ::core::cell::Cell::new(
20152                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20153                );
20154                <Self as ::buffa::MessageView>::decode_view_ctx(
20155                    buf,
20156                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20157                )
20158            }
20159            fn decode_view_with_ctx(
20160                buf: &'a [u8],
20161                ctx: ::buffa::DecodeContext<'_>,
20162            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20163                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20164            }
20165            fn merge_view_field(
20166                &mut self,
20167                tag: ::buffa::encoding::Tag,
20168                cur: &'a [u8],
20169                before_tag: &'a [u8],
20170                ctx: ::buffa::DecodeContext<'_>,
20171            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20172                let _ = ctx;
20173                #[allow(unused_variables)]
20174                let view = self;
20175                let mut cur = cur;
20176                match tag.field_number() {
20177                    1u32 => {
20178                        ::buffa::encoding::check_wire_type(
20179                            tag,
20180                            ::buffa::encoding::WireType::Fixed64,
20181                        )?;
20182                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20183                    }
20184                    2u32 => {
20185                        ::buffa::encoding::check_wire_type(
20186                            tag,
20187                            ::buffa::encoding::WireType::Varint,
20188                        )?;
20189                        view.status = ::buffa::EnumValue::from(
20190                            ::buffa::types::decode_int32(&mut cur)?,
20191                        );
20192                    }
20193                    3u32 => {
20194                        ::buffa::encoding::check_wire_type(
20195                            tag,
20196                            ::buffa::encoding::WireType::LengthDelimited,
20197                        )?;
20198                        let __sub_ctx = ctx.descend()?;
20199                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
20200                        match view.ts.as_mut() {
20201                            Some(existing) => {
20202                                ::buffa::MessageView::merge_into_view(
20203                                    existing,
20204                                    sub,
20205                                    __sub_ctx,
20206                                )?
20207                            }
20208                            None => {
20209                                view.ts = ::buffa::MessageFieldView::set(
20210                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
20211                                        sub,
20212                                        __sub_ctx,
20213                                    )?,
20214                                );
20215                            }
20216                        }
20217                    }
20218                    4u32 => {
20219                        ::buffa::encoding::check_wire_type(
20220                            tag,
20221                            ::buffa::encoding::WireType::Varint,
20222                        )?;
20223                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
20224                    }
20225                    _ => {
20226                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20227                        let span_len = before_tag.len() - cur.len();
20228                        view.__buffa_unknown_fields
20229                            .push_record(before_tag, span_len, ctx)?;
20230                    }
20231                }
20232                ::core::result::Result::Ok(cur)
20233            }
20234            fn to_owned_message(
20235                &self,
20236            ) -> ::core::result::Result<
20237                super::super::ModifyTriggerResponse,
20238                ::buffa::DecodeError,
20239            > {
20240                self.to_owned_from_source(None)
20241            }
20242            #[allow(clippy::useless_conversion, clippy::needless_update)]
20243            fn to_owned_from_source(
20244                &self,
20245                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20246            ) -> ::core::result::Result<
20247                super::super::ModifyTriggerResponse,
20248                ::buffa::DecodeError,
20249            > {
20250                #[allow(unused_imports)]
20251                use ::buffa::alloc::string::ToString as _;
20252                let _ = __buffa_src;
20253                ::core::result::Result::Ok(super::super::ModifyTriggerResponse {
20254                    trigger_id: self.trigger_id,
20255                    status: self.status,
20256                    ts: match self.ts.as_option() {
20257                        Some(v) => {
20258                            ::buffa::MessageField::<
20259                                ::buffa_types::google::protobuf::Timestamp,
20260                            >::some(v.to_owned_from_source(__buffa_src)?)
20261                        }
20262                        None => ::buffa::MessageField::none(),
20263                    },
20264                    ts_ns: self.ts_ns,
20265                    __buffa_unknown_fields: self
20266                        .__buffa_unknown_fields
20267                        .to_owned()?
20268                        .into(),
20269                    ..::core::default::Default::default()
20270                })
20271            }
20272        }
20273        impl<'a> ::buffa::ViewEncode<'a> for ModifyTriggerResponseView<'a> {
20274            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20275            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
20276                #[allow(unused_imports)]
20277                use ::buffa::Enumeration as _;
20278                let mut size = 0u32;
20279                if self.trigger_id != 0u64 {
20280                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20281                }
20282                {
20283                    let val = self.status.to_i32();
20284                    if val != 0 {
20285                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
20286                    }
20287                }
20288                if self.ts.is_set() {
20289                    let __slot = __cache.reserve();
20290                    let inner_size = self.ts.compute_size(__cache);
20291                    __cache.set(__slot, inner_size);
20292                    size
20293                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
20294                            + inner_size;
20295                }
20296                if self.ts_ns != 0u64 {
20297                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
20298                }
20299                size += self.__buffa_unknown_fields.encoded_len() as u32;
20300                size
20301            }
20302            #[allow(clippy::needless_borrow)]
20303            fn write_to(
20304                &self,
20305                __cache: &mut ::buffa::SizeCache,
20306                buf: &mut impl ::buffa::bytes::BufMut,
20307            ) {
20308                #[allow(unused_imports)]
20309                use ::buffa::Enumeration as _;
20310                if self.trigger_id != 0u64 {
20311                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20312                }
20313                {
20314                    let val = self.status.to_i32();
20315                    if val != 0 {
20316                        ::buffa::types::put_int32_field(2u32, val, buf);
20317                    }
20318                }
20319                if self.ts.is_set() {
20320                    ::buffa::types::put_len_delimited_header(
20321                        3u32,
20322                        __cache.consume_next(),
20323                        buf,
20324                    );
20325                    self.ts.write_to(__cache, buf);
20326                }
20327                if self.ts_ns != 0u64 {
20328                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
20329                }
20330                self.__buffa_unknown_fields.write_to(buf);
20331            }
20332        }
20333        /// Serializes this view as protobuf JSON.
20334        ///
20335        /// Implicit-presence fields with default values are omitted, `required`
20336        /// fields are always emitted, explicit-presence (`optional`) fields are
20337        /// emitted only when set, bytes fields are base64-encoded, and enum
20338        /// values are their proto name strings.
20339        ///
20340        /// This impl uses `serialize_map(None)` because the number of emitted
20341        /// fields depends on default-omission rules; serializers that require
20342        /// known map lengths (e.g. `bincode`) will return a runtime error.
20343        /// Use the owned message type for those formats.
20344        impl<'__a> ::serde::Serialize for ModifyTriggerResponseView<'__a> {
20345            fn serialize<__S: ::serde::Serializer>(
20346                &self,
20347                __s: __S,
20348            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20349                use ::serde::ser::SerializeMap as _;
20350                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20351                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20352                    __map
20353                        .serialize_entry(
20354                            "triggerId",
20355                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20356                        )?;
20357                }
20358                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
20359                    __map.serialize_entry("status", &self.status)?;
20360                }
20361                {
20362                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
20363                        __map.serialize_entry("ts", __v)?;
20364                    }
20365                }
20366                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
20367                    __map
20368                        .serialize_entry(
20369                            "tsNs",
20370                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
20371                        )?;
20372                }
20373                __map.end()
20374            }
20375        }
20376        impl<'a> ::buffa::MessageName for ModifyTriggerResponseView<'a> {
20377            const PACKAGE: &'static str = "triggers.v1";
20378            const NAME: &'static str = "ModifyTriggerResponse";
20379            const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerResponse";
20380            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
20381        }
20382        ::buffa::impl_default_view_instance!(ModifyTriggerResponseView);
20383        ::buffa::impl_view_reborrow!(ModifyTriggerResponseView);
20384        /** Self-contained, `'static` owned view of a `ModifyTriggerResponse` message.
20385
20386 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.
20387
20388 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.*/
20389        #[derive(Clone, Debug)]
20390        pub struct ModifyTriggerResponseOwnedView(
20391            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20392        );
20393        impl ModifyTriggerResponseOwnedView {
20394            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20395            ///
20396            /// The view borrows directly from the buffer's data; the buffer is
20397            /// retained inside the returned handle.
20398            ///
20399            /// # Errors
20400            ///
20401            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20402            /// protobuf data.
20403            pub fn decode(
20404                bytes: ::buffa::bytes::Bytes,
20405            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20406                ::core::result::Result::Ok(
20407                    ModifyTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
20408                )
20409            }
20410            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20411            /// max message size).
20412            ///
20413            /// # Errors
20414            ///
20415            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20416            /// exceeds the configured limits.
20417            pub fn decode_with_options(
20418                bytes: ::buffa::bytes::Bytes,
20419                opts: &::buffa::DecodeOptions,
20420            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20421                ::core::result::Result::Ok(
20422                    ModifyTriggerResponseOwnedView(
20423                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20424                    ),
20425                )
20426            }
20427            /// Build from an owned message via an encode → decode round-trip.
20428            ///
20429            /// # Errors
20430            ///
20431            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20432            /// somehow invalid (should not happen for well-formed messages).
20433            pub fn from_owned(
20434                msg: &super::super::ModifyTriggerResponse,
20435            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20436                ::core::result::Result::Ok(
20437                    ModifyTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
20438                )
20439            }
20440            /// Borrow the full [`ModifyTriggerResponseView`] with its lifetime tied to `&self`.
20441            #[must_use]
20442            pub fn view(&self) -> &ModifyTriggerResponseView<'_> {
20443                self.0.reborrow()
20444            }
20445            /// Convert to the owned message type.
20446            ///
20447            /// # Errors
20448            ///
20449            /// Returns an error if re-materializing preserved unknown fields
20450            /// fails (e.g. the unknown-field limit is exceeded).
20451            pub fn to_owned_message(
20452                &self,
20453            ) -> ::core::result::Result<
20454                super::super::ModifyTriggerResponse,
20455                ::buffa::DecodeError,
20456            > {
20457                self.0.to_owned_message()
20458            }
20459            /// The underlying bytes buffer.
20460            #[must_use]
20461            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20462                self.0.bytes()
20463            }
20464            /// Consume the handle, returning the underlying bytes buffer.
20465            #[must_use]
20466            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20467                self.0.into_bytes()
20468            }
20469            /// Modified trigger ID.
20470            ///
20471            /// Field 1: `trigger_id`
20472            #[must_use]
20473            pub fn trigger_id(&self) -> u64 {
20474                self.0.reborrow().trigger_id
20475            }
20476            /// Current trigger status after modification.
20477            ///
20478            /// Field 2: `status`
20479            #[must_use]
20480            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
20481                self.0.reborrow().status
20482            }
20483            /// Server timestamp.
20484            ///
20485            /// Field 3: `ts`
20486            #[must_use]
20487            pub fn ts(
20488                &self,
20489            ) -> &::buffa::MessageFieldView<
20490                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
20491            > {
20492                &self.0.reborrow().ts
20493            }
20494            /// Server timestamp in nanoseconds since epoch (UTC).
20495            ///
20496            /// Field 4: `ts_ns`
20497            #[must_use]
20498            pub fn ts_ns(&self) -> u64 {
20499                self.0.reborrow().ts_ns
20500            }
20501        }
20502        impl ::core::convert::From<
20503            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20504        > for ModifyTriggerResponseOwnedView {
20505            fn from(
20506                inner: ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20507            ) -> Self {
20508                ModifyTriggerResponseOwnedView(inner)
20509            }
20510        }
20511        impl ::core::convert::From<ModifyTriggerResponseOwnedView>
20512        for ::buffa::OwnedView<ModifyTriggerResponseView<'static>> {
20513            fn from(wrapper: ModifyTriggerResponseOwnedView) -> Self {
20514                wrapper.0
20515            }
20516        }
20517        impl ::core::convert::AsRef<
20518            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20519        > for ModifyTriggerResponseOwnedView {
20520            fn as_ref(&self) -> &::buffa::OwnedView<ModifyTriggerResponseView<'static>> {
20521                &self.0
20522            }
20523        }
20524        impl ::buffa::HasMessageView for super::super::ModifyTriggerResponse {
20525            type View<'a> = ModifyTriggerResponseView<'a>;
20526            type ViewHandle = ModifyTriggerResponseOwnedView;
20527        }
20528        impl ::serde::Serialize for ModifyTriggerResponseOwnedView {
20529            fn serialize<__S: ::serde::Serializer>(
20530                &self,
20531                __s: __S,
20532            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20533                ::serde::Serialize::serialize(&self.0, __s)
20534            }
20535        }
20536        /// PauseTriggerRequest pauses an active trigger by ID.
20537        #[derive(Clone, Debug, Default)]
20538        pub struct PauseTriggerRequestView<'a> {
20539            /// Trigger ID to pause.
20540            ///
20541            /// Field 1: `trigger_id`
20542            pub trigger_id: u64,
20543            /// Optional sub-account for authorization.
20544            ///
20545            /// Field 2: `subaccount_id`
20546            pub subaccount_id: ::core::option::Option<u64>,
20547            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20548        }
20549        impl<'a> ::buffa::MessageView<'a> for PauseTriggerRequestView<'a> {
20550            type Owned = super::super::PauseTriggerRequest;
20551            fn decode_view(
20552                buf: &'a [u8],
20553            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20554                let __limit = ::core::cell::Cell::new(
20555                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20556                );
20557                <Self as ::buffa::MessageView>::decode_view_ctx(
20558                    buf,
20559                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20560                )
20561            }
20562            fn decode_view_with_ctx(
20563                buf: &'a [u8],
20564                ctx: ::buffa::DecodeContext<'_>,
20565            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20566                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20567            }
20568            fn merge_view_field(
20569                &mut self,
20570                tag: ::buffa::encoding::Tag,
20571                cur: &'a [u8],
20572                before_tag: &'a [u8],
20573                ctx: ::buffa::DecodeContext<'_>,
20574            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20575                let _ = ctx;
20576                #[allow(unused_variables)]
20577                let view = self;
20578                let mut cur = cur;
20579                match tag.field_number() {
20580                    1u32 => {
20581                        ::buffa::encoding::check_wire_type(
20582                            tag,
20583                            ::buffa::encoding::WireType::Fixed64,
20584                        )?;
20585                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20586                    }
20587                    2u32 => {
20588                        ::buffa::encoding::check_wire_type(
20589                            tag,
20590                            ::buffa::encoding::WireType::Fixed64,
20591                        )?;
20592                        view.subaccount_id = Some(
20593                            ::buffa::types::decode_fixed64(&mut cur)?,
20594                        );
20595                    }
20596                    _ => {
20597                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20598                        let span_len = before_tag.len() - cur.len();
20599                        view.__buffa_unknown_fields
20600                            .push_record(before_tag, span_len, ctx)?;
20601                    }
20602                }
20603                ::core::result::Result::Ok(cur)
20604            }
20605            fn to_owned_message(
20606                &self,
20607            ) -> ::core::result::Result<
20608                super::super::PauseTriggerRequest,
20609                ::buffa::DecodeError,
20610            > {
20611                self.to_owned_from_source(None)
20612            }
20613            #[allow(clippy::useless_conversion, clippy::needless_update)]
20614            fn to_owned_from_source(
20615                &self,
20616                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20617            ) -> ::core::result::Result<
20618                super::super::PauseTriggerRequest,
20619                ::buffa::DecodeError,
20620            > {
20621                #[allow(unused_imports)]
20622                use ::buffa::alloc::string::ToString as _;
20623                let _ = __buffa_src;
20624                ::core::result::Result::Ok(super::super::PauseTriggerRequest {
20625                    trigger_id: self.trigger_id,
20626                    subaccount_id: self.subaccount_id,
20627                    __buffa_unknown_fields: self
20628                        .__buffa_unknown_fields
20629                        .to_owned()?
20630                        .into(),
20631                    ..::core::default::Default::default()
20632                })
20633            }
20634        }
20635        impl<'a> ::buffa::ViewEncode<'a> for PauseTriggerRequestView<'a> {
20636            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20637            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
20638                #[allow(unused_imports)]
20639                use ::buffa::Enumeration as _;
20640                let mut size = 0u32;
20641                if self.trigger_id != 0u64 {
20642                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20643                }
20644                if self.subaccount_id.is_some() {
20645                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20646                }
20647                size += self.__buffa_unknown_fields.encoded_len() as u32;
20648                size
20649            }
20650            #[allow(clippy::needless_borrow)]
20651            fn write_to(
20652                &self,
20653                _cache: &mut ::buffa::SizeCache,
20654                buf: &mut impl ::buffa::bytes::BufMut,
20655            ) {
20656                #[allow(unused_imports)]
20657                use ::buffa::Enumeration as _;
20658                if self.trigger_id != 0u64 {
20659                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20660                }
20661                if let Some(v) = self.subaccount_id {
20662                    ::buffa::types::put_fixed64_field(2u32, v, buf);
20663                }
20664                self.__buffa_unknown_fields.write_to(buf);
20665            }
20666        }
20667        /// Serializes this view as protobuf JSON.
20668        ///
20669        /// Implicit-presence fields with default values are omitted, `required`
20670        /// fields are always emitted, explicit-presence (`optional`) fields are
20671        /// emitted only when set, bytes fields are base64-encoded, and enum
20672        /// values are their proto name strings.
20673        ///
20674        /// This impl uses `serialize_map(None)` because the number of emitted
20675        /// fields depends on default-omission rules; serializers that require
20676        /// known map lengths (e.g. `bincode`) will return a runtime error.
20677        /// Use the owned message type for those formats.
20678        impl<'__a> ::serde::Serialize for PauseTriggerRequestView<'__a> {
20679            fn serialize<__S: ::serde::Serializer>(
20680                &self,
20681                __s: __S,
20682            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20683                use ::serde::ser::SerializeMap as _;
20684                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20685                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20686                    __map
20687                        .serialize_entry(
20688                            "triggerId",
20689                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20690                        )?;
20691                }
20692                if let ::core::option::Option::Some(__v) = self.subaccount_id {
20693                    __map
20694                        .serialize_entry(
20695                            "subaccountId",
20696                            &::buffa::json_helpers::ProtoJson(&__v),
20697                        )?;
20698                }
20699                __map.end()
20700            }
20701        }
20702        impl<'a> ::buffa::MessageName for PauseTriggerRequestView<'a> {
20703            const PACKAGE: &'static str = "triggers.v1";
20704            const NAME: &'static str = "PauseTriggerRequest";
20705            const FULL_NAME: &'static str = "triggers.v1.PauseTriggerRequest";
20706            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
20707        }
20708        ::buffa::impl_default_view_instance!(PauseTriggerRequestView);
20709        ::buffa::impl_view_reborrow!(PauseTriggerRequestView);
20710        /** Self-contained, `'static` owned view of a `PauseTriggerRequest` message.
20711
20712 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.
20713
20714 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.*/
20715        #[derive(Clone, Debug)]
20716        pub struct PauseTriggerRequestOwnedView(
20717            ::buffa::OwnedView<PauseTriggerRequestView<'static>>,
20718        );
20719        impl PauseTriggerRequestOwnedView {
20720            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20721            ///
20722            /// The view borrows directly from the buffer's data; the buffer is
20723            /// retained inside the returned handle.
20724            ///
20725            /// # Errors
20726            ///
20727            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20728            /// protobuf data.
20729            pub fn decode(
20730                bytes: ::buffa::bytes::Bytes,
20731            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20732                ::core::result::Result::Ok(
20733                    PauseTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
20734                )
20735            }
20736            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20737            /// max message size).
20738            ///
20739            /// # Errors
20740            ///
20741            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20742            /// exceeds the configured limits.
20743            pub fn decode_with_options(
20744                bytes: ::buffa::bytes::Bytes,
20745                opts: &::buffa::DecodeOptions,
20746            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20747                ::core::result::Result::Ok(
20748                    PauseTriggerRequestOwnedView(
20749                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20750                    ),
20751                )
20752            }
20753            /// Build from an owned message via an encode → decode round-trip.
20754            ///
20755            /// # Errors
20756            ///
20757            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20758            /// somehow invalid (should not happen for well-formed messages).
20759            pub fn from_owned(
20760                msg: &super::super::PauseTriggerRequest,
20761            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20762                ::core::result::Result::Ok(
20763                    PauseTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
20764                )
20765            }
20766            /// Borrow the full [`PauseTriggerRequestView`] with its lifetime tied to `&self`.
20767            #[must_use]
20768            pub fn view(&self) -> &PauseTriggerRequestView<'_> {
20769                self.0.reborrow()
20770            }
20771            /// Convert to the owned message type.
20772            ///
20773            /// # Errors
20774            ///
20775            /// Returns an error if re-materializing preserved unknown fields
20776            /// fails (e.g. the unknown-field limit is exceeded).
20777            pub fn to_owned_message(
20778                &self,
20779            ) -> ::core::result::Result<
20780                super::super::PauseTriggerRequest,
20781                ::buffa::DecodeError,
20782            > {
20783                self.0.to_owned_message()
20784            }
20785            /// The underlying bytes buffer.
20786            #[must_use]
20787            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20788                self.0.bytes()
20789            }
20790            /// Consume the handle, returning the underlying bytes buffer.
20791            #[must_use]
20792            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20793                self.0.into_bytes()
20794            }
20795            /// Trigger ID to pause.
20796            ///
20797            /// Field 1: `trigger_id`
20798            #[must_use]
20799            pub fn trigger_id(&self) -> u64 {
20800                self.0.reborrow().trigger_id
20801            }
20802            /// Optional sub-account for authorization.
20803            ///
20804            /// Field 2: `subaccount_id`
20805            #[must_use]
20806            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
20807                self.0.reborrow().subaccount_id
20808            }
20809        }
20810        impl ::core::convert::From<::buffa::OwnedView<PauseTriggerRequestView<'static>>>
20811        for PauseTriggerRequestOwnedView {
20812            fn from(
20813                inner: ::buffa::OwnedView<PauseTriggerRequestView<'static>>,
20814            ) -> Self {
20815                PauseTriggerRequestOwnedView(inner)
20816            }
20817        }
20818        impl ::core::convert::From<PauseTriggerRequestOwnedView>
20819        for ::buffa::OwnedView<PauseTriggerRequestView<'static>> {
20820            fn from(wrapper: PauseTriggerRequestOwnedView) -> Self {
20821                wrapper.0
20822            }
20823        }
20824        impl ::core::convert::AsRef<::buffa::OwnedView<PauseTriggerRequestView<'static>>>
20825        for PauseTriggerRequestOwnedView {
20826            fn as_ref(&self) -> &::buffa::OwnedView<PauseTriggerRequestView<'static>> {
20827                &self.0
20828            }
20829        }
20830        impl ::buffa::HasMessageView for super::super::PauseTriggerRequest {
20831            type View<'a> = PauseTriggerRequestView<'a>;
20832            type ViewHandle = PauseTriggerRequestOwnedView;
20833        }
20834        impl ::serde::Serialize for PauseTriggerRequestOwnedView {
20835            fn serialize<__S: ::serde::Serializer>(
20836                &self,
20837                __s: __S,
20838            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20839                ::serde::Serialize::serialize(&self.0, __s)
20840            }
20841        }
20842        /// PauseTriggerResponse returns the trigger status after pausing.
20843        #[derive(Clone, Debug, Default)]
20844        pub struct PauseTriggerResponseView<'a> {
20845            /// Paused trigger ID.
20846            ///
20847            /// Field 1: `trigger_id`
20848            pub trigger_id: u64,
20849            /// Current trigger status after pausing.
20850            ///
20851            /// Field 2: `status`
20852            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
20853            /// Server timestamp.
20854            ///
20855            /// Field 3: `ts`
20856            pub ts: ::buffa::MessageFieldView<
20857                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
20858            >,
20859            /// Server timestamp in nanoseconds since epoch (UTC).
20860            ///
20861            /// Field 4: `ts_ns`
20862            pub ts_ns: u64,
20863            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20864        }
20865        impl<'a> ::buffa::MessageView<'a> for PauseTriggerResponseView<'a> {
20866            type Owned = super::super::PauseTriggerResponse;
20867            fn decode_view(
20868                buf: &'a [u8],
20869            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20870                let __limit = ::core::cell::Cell::new(
20871                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20872                );
20873                <Self as ::buffa::MessageView>::decode_view_ctx(
20874                    buf,
20875                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20876                )
20877            }
20878            fn decode_view_with_ctx(
20879                buf: &'a [u8],
20880                ctx: ::buffa::DecodeContext<'_>,
20881            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20882                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20883            }
20884            fn merge_view_field(
20885                &mut self,
20886                tag: ::buffa::encoding::Tag,
20887                cur: &'a [u8],
20888                before_tag: &'a [u8],
20889                ctx: ::buffa::DecodeContext<'_>,
20890            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20891                let _ = ctx;
20892                #[allow(unused_variables)]
20893                let view = self;
20894                let mut cur = cur;
20895                match tag.field_number() {
20896                    1u32 => {
20897                        ::buffa::encoding::check_wire_type(
20898                            tag,
20899                            ::buffa::encoding::WireType::Fixed64,
20900                        )?;
20901                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20902                    }
20903                    2u32 => {
20904                        ::buffa::encoding::check_wire_type(
20905                            tag,
20906                            ::buffa::encoding::WireType::Varint,
20907                        )?;
20908                        view.status = ::buffa::EnumValue::from(
20909                            ::buffa::types::decode_int32(&mut cur)?,
20910                        );
20911                    }
20912                    3u32 => {
20913                        ::buffa::encoding::check_wire_type(
20914                            tag,
20915                            ::buffa::encoding::WireType::LengthDelimited,
20916                        )?;
20917                        let __sub_ctx = ctx.descend()?;
20918                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
20919                        match view.ts.as_mut() {
20920                            Some(existing) => {
20921                                ::buffa::MessageView::merge_into_view(
20922                                    existing,
20923                                    sub,
20924                                    __sub_ctx,
20925                                )?
20926                            }
20927                            None => {
20928                                view.ts = ::buffa::MessageFieldView::set(
20929                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
20930                                        sub,
20931                                        __sub_ctx,
20932                                    )?,
20933                                );
20934                            }
20935                        }
20936                    }
20937                    4u32 => {
20938                        ::buffa::encoding::check_wire_type(
20939                            tag,
20940                            ::buffa::encoding::WireType::Varint,
20941                        )?;
20942                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
20943                    }
20944                    _ => {
20945                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20946                        let span_len = before_tag.len() - cur.len();
20947                        view.__buffa_unknown_fields
20948                            .push_record(before_tag, span_len, ctx)?;
20949                    }
20950                }
20951                ::core::result::Result::Ok(cur)
20952            }
20953            fn to_owned_message(
20954                &self,
20955            ) -> ::core::result::Result<
20956                super::super::PauseTriggerResponse,
20957                ::buffa::DecodeError,
20958            > {
20959                self.to_owned_from_source(None)
20960            }
20961            #[allow(clippy::useless_conversion, clippy::needless_update)]
20962            fn to_owned_from_source(
20963                &self,
20964                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20965            ) -> ::core::result::Result<
20966                super::super::PauseTriggerResponse,
20967                ::buffa::DecodeError,
20968            > {
20969                #[allow(unused_imports)]
20970                use ::buffa::alloc::string::ToString as _;
20971                let _ = __buffa_src;
20972                ::core::result::Result::Ok(super::super::PauseTriggerResponse {
20973                    trigger_id: self.trigger_id,
20974                    status: self.status,
20975                    ts: match self.ts.as_option() {
20976                        Some(v) => {
20977                            ::buffa::MessageField::<
20978                                ::buffa_types::google::protobuf::Timestamp,
20979                            >::some(v.to_owned_from_source(__buffa_src)?)
20980                        }
20981                        None => ::buffa::MessageField::none(),
20982                    },
20983                    ts_ns: self.ts_ns,
20984                    __buffa_unknown_fields: self
20985                        .__buffa_unknown_fields
20986                        .to_owned()?
20987                        .into(),
20988                    ..::core::default::Default::default()
20989                })
20990            }
20991        }
20992        impl<'a> ::buffa::ViewEncode<'a> for PauseTriggerResponseView<'a> {
20993            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20994            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
20995                #[allow(unused_imports)]
20996                use ::buffa::Enumeration as _;
20997                let mut size = 0u32;
20998                if self.trigger_id != 0u64 {
20999                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21000                }
21001                {
21002                    let val = self.status.to_i32();
21003                    if val != 0 {
21004                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
21005                    }
21006                }
21007                if self.ts.is_set() {
21008                    let __slot = __cache.reserve();
21009                    let inner_size = self.ts.compute_size(__cache);
21010                    __cache.set(__slot, inner_size);
21011                    size
21012                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
21013                            + inner_size;
21014                }
21015                if self.ts_ns != 0u64 {
21016                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
21017                }
21018                size += self.__buffa_unknown_fields.encoded_len() as u32;
21019                size
21020            }
21021            #[allow(clippy::needless_borrow)]
21022            fn write_to(
21023                &self,
21024                __cache: &mut ::buffa::SizeCache,
21025                buf: &mut impl ::buffa::bytes::BufMut,
21026            ) {
21027                #[allow(unused_imports)]
21028                use ::buffa::Enumeration as _;
21029                if self.trigger_id != 0u64 {
21030                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21031                }
21032                {
21033                    let val = self.status.to_i32();
21034                    if val != 0 {
21035                        ::buffa::types::put_int32_field(2u32, val, buf);
21036                    }
21037                }
21038                if self.ts.is_set() {
21039                    ::buffa::types::put_len_delimited_header(
21040                        3u32,
21041                        __cache.consume_next(),
21042                        buf,
21043                    );
21044                    self.ts.write_to(__cache, buf);
21045                }
21046                if self.ts_ns != 0u64 {
21047                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
21048                }
21049                self.__buffa_unknown_fields.write_to(buf);
21050            }
21051        }
21052        /// Serializes this view as protobuf JSON.
21053        ///
21054        /// Implicit-presence fields with default values are omitted, `required`
21055        /// fields are always emitted, explicit-presence (`optional`) fields are
21056        /// emitted only when set, bytes fields are base64-encoded, and enum
21057        /// values are their proto name strings.
21058        ///
21059        /// This impl uses `serialize_map(None)` because the number of emitted
21060        /// fields depends on default-omission rules; serializers that require
21061        /// known map lengths (e.g. `bincode`) will return a runtime error.
21062        /// Use the owned message type for those formats.
21063        impl<'__a> ::serde::Serialize for PauseTriggerResponseView<'__a> {
21064            fn serialize<__S: ::serde::Serializer>(
21065                &self,
21066                __s: __S,
21067            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21068                use ::serde::ser::SerializeMap as _;
21069                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21070                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21071                    __map
21072                        .serialize_entry(
21073                            "triggerId",
21074                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21075                        )?;
21076                }
21077                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
21078                    __map.serialize_entry("status", &self.status)?;
21079                }
21080                {
21081                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
21082                        __map.serialize_entry("ts", __v)?;
21083                    }
21084                }
21085                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
21086                    __map
21087                        .serialize_entry(
21088                            "tsNs",
21089                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
21090                        )?;
21091                }
21092                __map.end()
21093            }
21094        }
21095        impl<'a> ::buffa::MessageName for PauseTriggerResponseView<'a> {
21096            const PACKAGE: &'static str = "triggers.v1";
21097            const NAME: &'static str = "PauseTriggerResponse";
21098            const FULL_NAME: &'static str = "triggers.v1.PauseTriggerResponse";
21099            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
21100        }
21101        ::buffa::impl_default_view_instance!(PauseTriggerResponseView);
21102        ::buffa::impl_view_reborrow!(PauseTriggerResponseView);
21103        /** Self-contained, `'static` owned view of a `PauseTriggerResponse` message.
21104
21105 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.
21106
21107 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.*/
21108        #[derive(Clone, Debug)]
21109        pub struct PauseTriggerResponseOwnedView(
21110            ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21111        );
21112        impl PauseTriggerResponseOwnedView {
21113            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21114            ///
21115            /// The view borrows directly from the buffer's data; the buffer is
21116            /// retained inside the returned handle.
21117            ///
21118            /// # Errors
21119            ///
21120            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21121            /// protobuf data.
21122            pub fn decode(
21123                bytes: ::buffa::bytes::Bytes,
21124            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21125                ::core::result::Result::Ok(
21126                    PauseTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
21127                )
21128            }
21129            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21130            /// max message size).
21131            ///
21132            /// # Errors
21133            ///
21134            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21135            /// exceeds the configured limits.
21136            pub fn decode_with_options(
21137                bytes: ::buffa::bytes::Bytes,
21138                opts: &::buffa::DecodeOptions,
21139            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21140                ::core::result::Result::Ok(
21141                    PauseTriggerResponseOwnedView(
21142                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21143                    ),
21144                )
21145            }
21146            /// Build from an owned message via an encode → decode round-trip.
21147            ///
21148            /// # Errors
21149            ///
21150            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21151            /// somehow invalid (should not happen for well-formed messages).
21152            pub fn from_owned(
21153                msg: &super::super::PauseTriggerResponse,
21154            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21155                ::core::result::Result::Ok(
21156                    PauseTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
21157                )
21158            }
21159            /// Borrow the full [`PauseTriggerResponseView`] with its lifetime tied to `&self`.
21160            #[must_use]
21161            pub fn view(&self) -> &PauseTriggerResponseView<'_> {
21162                self.0.reborrow()
21163            }
21164            /// Convert to the owned message type.
21165            ///
21166            /// # Errors
21167            ///
21168            /// Returns an error if re-materializing preserved unknown fields
21169            /// fails (e.g. the unknown-field limit is exceeded).
21170            pub fn to_owned_message(
21171                &self,
21172            ) -> ::core::result::Result<
21173                super::super::PauseTriggerResponse,
21174                ::buffa::DecodeError,
21175            > {
21176                self.0.to_owned_message()
21177            }
21178            /// The underlying bytes buffer.
21179            #[must_use]
21180            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21181                self.0.bytes()
21182            }
21183            /// Consume the handle, returning the underlying bytes buffer.
21184            #[must_use]
21185            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21186                self.0.into_bytes()
21187            }
21188            /// Paused trigger ID.
21189            ///
21190            /// Field 1: `trigger_id`
21191            #[must_use]
21192            pub fn trigger_id(&self) -> u64 {
21193                self.0.reborrow().trigger_id
21194            }
21195            /// Current trigger status after pausing.
21196            ///
21197            /// Field 2: `status`
21198            #[must_use]
21199            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
21200                self.0.reborrow().status
21201            }
21202            /// Server timestamp.
21203            ///
21204            /// Field 3: `ts`
21205            #[must_use]
21206            pub fn ts(
21207                &self,
21208            ) -> &::buffa::MessageFieldView<
21209                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
21210            > {
21211                &self.0.reborrow().ts
21212            }
21213            /// Server timestamp in nanoseconds since epoch (UTC).
21214            ///
21215            /// Field 4: `ts_ns`
21216            #[must_use]
21217            pub fn ts_ns(&self) -> u64 {
21218                self.0.reborrow().ts_ns
21219            }
21220        }
21221        impl ::core::convert::From<::buffa::OwnedView<PauseTriggerResponseView<'static>>>
21222        for PauseTriggerResponseOwnedView {
21223            fn from(
21224                inner: ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21225            ) -> Self {
21226                PauseTriggerResponseOwnedView(inner)
21227            }
21228        }
21229        impl ::core::convert::From<PauseTriggerResponseOwnedView>
21230        for ::buffa::OwnedView<PauseTriggerResponseView<'static>> {
21231            fn from(wrapper: PauseTriggerResponseOwnedView) -> Self {
21232                wrapper.0
21233            }
21234        }
21235        impl ::core::convert::AsRef<
21236            ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21237        > for PauseTriggerResponseOwnedView {
21238            fn as_ref(&self) -> &::buffa::OwnedView<PauseTriggerResponseView<'static>> {
21239                &self.0
21240            }
21241        }
21242        impl ::buffa::HasMessageView for super::super::PauseTriggerResponse {
21243            type View<'a> = PauseTriggerResponseView<'a>;
21244            type ViewHandle = PauseTriggerResponseOwnedView;
21245        }
21246        impl ::serde::Serialize for PauseTriggerResponseOwnedView {
21247            fn serialize<__S: ::serde::Serializer>(
21248                &self,
21249                __s: __S,
21250            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21251                ::serde::Serialize::serialize(&self.0, __s)
21252            }
21253        }
21254        /// ResumeTriggerRequest resumes a paused trigger by ID.
21255        #[derive(Clone, Debug, Default)]
21256        pub struct ResumeTriggerRequestView<'a> {
21257            /// Trigger ID to resume.
21258            ///
21259            /// Field 1: `trigger_id`
21260            pub trigger_id: u64,
21261            /// Optional sub-account for authorization.
21262            ///
21263            /// Field 2: `subaccount_id`
21264            pub subaccount_id: ::core::option::Option<u64>,
21265            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21266        }
21267        impl<'a> ::buffa::MessageView<'a> for ResumeTriggerRequestView<'a> {
21268            type Owned = super::super::ResumeTriggerRequest;
21269            fn decode_view(
21270                buf: &'a [u8],
21271            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21272                let __limit = ::core::cell::Cell::new(
21273                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21274                );
21275                <Self as ::buffa::MessageView>::decode_view_ctx(
21276                    buf,
21277                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21278                )
21279            }
21280            fn decode_view_with_ctx(
21281                buf: &'a [u8],
21282                ctx: ::buffa::DecodeContext<'_>,
21283            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21284                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21285            }
21286            fn merge_view_field(
21287                &mut self,
21288                tag: ::buffa::encoding::Tag,
21289                cur: &'a [u8],
21290                before_tag: &'a [u8],
21291                ctx: ::buffa::DecodeContext<'_>,
21292            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21293                let _ = ctx;
21294                #[allow(unused_variables)]
21295                let view = self;
21296                let mut cur = cur;
21297                match tag.field_number() {
21298                    1u32 => {
21299                        ::buffa::encoding::check_wire_type(
21300                            tag,
21301                            ::buffa::encoding::WireType::Fixed64,
21302                        )?;
21303                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
21304                    }
21305                    2u32 => {
21306                        ::buffa::encoding::check_wire_type(
21307                            tag,
21308                            ::buffa::encoding::WireType::Fixed64,
21309                        )?;
21310                        view.subaccount_id = Some(
21311                            ::buffa::types::decode_fixed64(&mut cur)?,
21312                        );
21313                    }
21314                    _ => {
21315                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21316                        let span_len = before_tag.len() - cur.len();
21317                        view.__buffa_unknown_fields
21318                            .push_record(before_tag, span_len, ctx)?;
21319                    }
21320                }
21321                ::core::result::Result::Ok(cur)
21322            }
21323            fn to_owned_message(
21324                &self,
21325            ) -> ::core::result::Result<
21326                super::super::ResumeTriggerRequest,
21327                ::buffa::DecodeError,
21328            > {
21329                self.to_owned_from_source(None)
21330            }
21331            #[allow(clippy::useless_conversion, clippy::needless_update)]
21332            fn to_owned_from_source(
21333                &self,
21334                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21335            ) -> ::core::result::Result<
21336                super::super::ResumeTriggerRequest,
21337                ::buffa::DecodeError,
21338            > {
21339                #[allow(unused_imports)]
21340                use ::buffa::alloc::string::ToString as _;
21341                let _ = __buffa_src;
21342                ::core::result::Result::Ok(super::super::ResumeTriggerRequest {
21343                    trigger_id: self.trigger_id,
21344                    subaccount_id: self.subaccount_id,
21345                    __buffa_unknown_fields: self
21346                        .__buffa_unknown_fields
21347                        .to_owned()?
21348                        .into(),
21349                    ..::core::default::Default::default()
21350                })
21351            }
21352        }
21353        impl<'a> ::buffa::ViewEncode<'a> for ResumeTriggerRequestView<'a> {
21354            #[allow(clippy::needless_borrow, clippy::let_and_return)]
21355            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
21356                #[allow(unused_imports)]
21357                use ::buffa::Enumeration as _;
21358                let mut size = 0u32;
21359                if self.trigger_id != 0u64 {
21360                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21361                }
21362                if self.subaccount_id.is_some() {
21363                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21364                }
21365                size += self.__buffa_unknown_fields.encoded_len() as u32;
21366                size
21367            }
21368            #[allow(clippy::needless_borrow)]
21369            fn write_to(
21370                &self,
21371                _cache: &mut ::buffa::SizeCache,
21372                buf: &mut impl ::buffa::bytes::BufMut,
21373            ) {
21374                #[allow(unused_imports)]
21375                use ::buffa::Enumeration as _;
21376                if self.trigger_id != 0u64 {
21377                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21378                }
21379                if let Some(v) = self.subaccount_id {
21380                    ::buffa::types::put_fixed64_field(2u32, v, buf);
21381                }
21382                self.__buffa_unknown_fields.write_to(buf);
21383            }
21384        }
21385        /// Serializes this view as protobuf JSON.
21386        ///
21387        /// Implicit-presence fields with default values are omitted, `required`
21388        /// fields are always emitted, explicit-presence (`optional`) fields are
21389        /// emitted only when set, bytes fields are base64-encoded, and enum
21390        /// values are their proto name strings.
21391        ///
21392        /// This impl uses `serialize_map(None)` because the number of emitted
21393        /// fields depends on default-omission rules; serializers that require
21394        /// known map lengths (e.g. `bincode`) will return a runtime error.
21395        /// Use the owned message type for those formats.
21396        impl<'__a> ::serde::Serialize for ResumeTriggerRequestView<'__a> {
21397            fn serialize<__S: ::serde::Serializer>(
21398                &self,
21399                __s: __S,
21400            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21401                use ::serde::ser::SerializeMap as _;
21402                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21403                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21404                    __map
21405                        .serialize_entry(
21406                            "triggerId",
21407                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21408                        )?;
21409                }
21410                if let ::core::option::Option::Some(__v) = self.subaccount_id {
21411                    __map
21412                        .serialize_entry(
21413                            "subaccountId",
21414                            &::buffa::json_helpers::ProtoJson(&__v),
21415                        )?;
21416                }
21417                __map.end()
21418            }
21419        }
21420        impl<'a> ::buffa::MessageName for ResumeTriggerRequestView<'a> {
21421            const PACKAGE: &'static str = "triggers.v1";
21422            const NAME: &'static str = "ResumeTriggerRequest";
21423            const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerRequest";
21424            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
21425        }
21426        ::buffa::impl_default_view_instance!(ResumeTriggerRequestView);
21427        ::buffa::impl_view_reborrow!(ResumeTriggerRequestView);
21428        /** Self-contained, `'static` owned view of a `ResumeTriggerRequest` message.
21429
21430 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.
21431
21432 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.*/
21433        #[derive(Clone, Debug)]
21434        pub struct ResumeTriggerRequestOwnedView(
21435            ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21436        );
21437        impl ResumeTriggerRequestOwnedView {
21438            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21439            ///
21440            /// The view borrows directly from the buffer's data; the buffer is
21441            /// retained inside the returned handle.
21442            ///
21443            /// # Errors
21444            ///
21445            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21446            /// protobuf data.
21447            pub fn decode(
21448                bytes: ::buffa::bytes::Bytes,
21449            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21450                ::core::result::Result::Ok(
21451                    ResumeTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
21452                )
21453            }
21454            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21455            /// max message size).
21456            ///
21457            /// # Errors
21458            ///
21459            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21460            /// exceeds the configured limits.
21461            pub fn decode_with_options(
21462                bytes: ::buffa::bytes::Bytes,
21463                opts: &::buffa::DecodeOptions,
21464            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21465                ::core::result::Result::Ok(
21466                    ResumeTriggerRequestOwnedView(
21467                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21468                    ),
21469                )
21470            }
21471            /// Build from an owned message via an encode → decode round-trip.
21472            ///
21473            /// # Errors
21474            ///
21475            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21476            /// somehow invalid (should not happen for well-formed messages).
21477            pub fn from_owned(
21478                msg: &super::super::ResumeTriggerRequest,
21479            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21480                ::core::result::Result::Ok(
21481                    ResumeTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
21482                )
21483            }
21484            /// Borrow the full [`ResumeTriggerRequestView`] with its lifetime tied to `&self`.
21485            #[must_use]
21486            pub fn view(&self) -> &ResumeTriggerRequestView<'_> {
21487                self.0.reborrow()
21488            }
21489            /// Convert to the owned message type.
21490            ///
21491            /// # Errors
21492            ///
21493            /// Returns an error if re-materializing preserved unknown fields
21494            /// fails (e.g. the unknown-field limit is exceeded).
21495            pub fn to_owned_message(
21496                &self,
21497            ) -> ::core::result::Result<
21498                super::super::ResumeTriggerRequest,
21499                ::buffa::DecodeError,
21500            > {
21501                self.0.to_owned_message()
21502            }
21503            /// The underlying bytes buffer.
21504            #[must_use]
21505            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21506                self.0.bytes()
21507            }
21508            /// Consume the handle, returning the underlying bytes buffer.
21509            #[must_use]
21510            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21511                self.0.into_bytes()
21512            }
21513            /// Trigger ID to resume.
21514            ///
21515            /// Field 1: `trigger_id`
21516            #[must_use]
21517            pub fn trigger_id(&self) -> u64 {
21518                self.0.reborrow().trigger_id
21519            }
21520            /// Optional sub-account for authorization.
21521            ///
21522            /// Field 2: `subaccount_id`
21523            #[must_use]
21524            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
21525                self.0.reborrow().subaccount_id
21526            }
21527        }
21528        impl ::core::convert::From<::buffa::OwnedView<ResumeTriggerRequestView<'static>>>
21529        for ResumeTriggerRequestOwnedView {
21530            fn from(
21531                inner: ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21532            ) -> Self {
21533                ResumeTriggerRequestOwnedView(inner)
21534            }
21535        }
21536        impl ::core::convert::From<ResumeTriggerRequestOwnedView>
21537        for ::buffa::OwnedView<ResumeTriggerRequestView<'static>> {
21538            fn from(wrapper: ResumeTriggerRequestOwnedView) -> Self {
21539                wrapper.0
21540            }
21541        }
21542        impl ::core::convert::AsRef<
21543            ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21544        > for ResumeTriggerRequestOwnedView {
21545            fn as_ref(&self) -> &::buffa::OwnedView<ResumeTriggerRequestView<'static>> {
21546                &self.0
21547            }
21548        }
21549        impl ::buffa::HasMessageView for super::super::ResumeTriggerRequest {
21550            type View<'a> = ResumeTriggerRequestView<'a>;
21551            type ViewHandle = ResumeTriggerRequestOwnedView;
21552        }
21553        impl ::serde::Serialize for ResumeTriggerRequestOwnedView {
21554            fn serialize<__S: ::serde::Serializer>(
21555                &self,
21556                __s: __S,
21557            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21558                ::serde::Serialize::serialize(&self.0, __s)
21559            }
21560        }
21561        /// ResumeTriggerResponse returns the trigger status after resuming.
21562        #[derive(Clone, Debug, Default)]
21563        pub struct ResumeTriggerResponseView<'a> {
21564            /// Resumed trigger ID.
21565            ///
21566            /// Field 1: `trigger_id`
21567            pub trigger_id: u64,
21568            /// Current trigger status after resuming.
21569            ///
21570            /// Field 2: `status`
21571            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
21572            /// Server timestamp.
21573            ///
21574            /// Field 3: `ts`
21575            pub ts: ::buffa::MessageFieldView<
21576                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
21577            >,
21578            /// Server timestamp in nanoseconds since epoch (UTC).
21579            ///
21580            /// Field 4: `ts_ns`
21581            pub ts_ns: u64,
21582            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21583        }
21584        impl<'a> ::buffa::MessageView<'a> for ResumeTriggerResponseView<'a> {
21585            type Owned = super::super::ResumeTriggerResponse;
21586            fn decode_view(
21587                buf: &'a [u8],
21588            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21589                let __limit = ::core::cell::Cell::new(
21590                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21591                );
21592                <Self as ::buffa::MessageView>::decode_view_ctx(
21593                    buf,
21594                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21595                )
21596            }
21597            fn decode_view_with_ctx(
21598                buf: &'a [u8],
21599                ctx: ::buffa::DecodeContext<'_>,
21600            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21601                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21602            }
21603            fn merge_view_field(
21604                &mut self,
21605                tag: ::buffa::encoding::Tag,
21606                cur: &'a [u8],
21607                before_tag: &'a [u8],
21608                ctx: ::buffa::DecodeContext<'_>,
21609            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21610                let _ = ctx;
21611                #[allow(unused_variables)]
21612                let view = self;
21613                let mut cur = cur;
21614                match tag.field_number() {
21615                    1u32 => {
21616                        ::buffa::encoding::check_wire_type(
21617                            tag,
21618                            ::buffa::encoding::WireType::Fixed64,
21619                        )?;
21620                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
21621                    }
21622                    2u32 => {
21623                        ::buffa::encoding::check_wire_type(
21624                            tag,
21625                            ::buffa::encoding::WireType::Varint,
21626                        )?;
21627                        view.status = ::buffa::EnumValue::from(
21628                            ::buffa::types::decode_int32(&mut cur)?,
21629                        );
21630                    }
21631                    3u32 => {
21632                        ::buffa::encoding::check_wire_type(
21633                            tag,
21634                            ::buffa::encoding::WireType::LengthDelimited,
21635                        )?;
21636                        let __sub_ctx = ctx.descend()?;
21637                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
21638                        match view.ts.as_mut() {
21639                            Some(existing) => {
21640                                ::buffa::MessageView::merge_into_view(
21641                                    existing,
21642                                    sub,
21643                                    __sub_ctx,
21644                                )?
21645                            }
21646                            None => {
21647                                view.ts = ::buffa::MessageFieldView::set(
21648                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
21649                                        sub,
21650                                        __sub_ctx,
21651                                    )?,
21652                                );
21653                            }
21654                        }
21655                    }
21656                    4u32 => {
21657                        ::buffa::encoding::check_wire_type(
21658                            tag,
21659                            ::buffa::encoding::WireType::Varint,
21660                        )?;
21661                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
21662                    }
21663                    _ => {
21664                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21665                        let span_len = before_tag.len() - cur.len();
21666                        view.__buffa_unknown_fields
21667                            .push_record(before_tag, span_len, ctx)?;
21668                    }
21669                }
21670                ::core::result::Result::Ok(cur)
21671            }
21672            fn to_owned_message(
21673                &self,
21674            ) -> ::core::result::Result<
21675                super::super::ResumeTriggerResponse,
21676                ::buffa::DecodeError,
21677            > {
21678                self.to_owned_from_source(None)
21679            }
21680            #[allow(clippy::useless_conversion, clippy::needless_update)]
21681            fn to_owned_from_source(
21682                &self,
21683                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21684            ) -> ::core::result::Result<
21685                super::super::ResumeTriggerResponse,
21686                ::buffa::DecodeError,
21687            > {
21688                #[allow(unused_imports)]
21689                use ::buffa::alloc::string::ToString as _;
21690                let _ = __buffa_src;
21691                ::core::result::Result::Ok(super::super::ResumeTriggerResponse {
21692                    trigger_id: self.trigger_id,
21693                    status: self.status,
21694                    ts: match self.ts.as_option() {
21695                        Some(v) => {
21696                            ::buffa::MessageField::<
21697                                ::buffa_types::google::protobuf::Timestamp,
21698                            >::some(v.to_owned_from_source(__buffa_src)?)
21699                        }
21700                        None => ::buffa::MessageField::none(),
21701                    },
21702                    ts_ns: self.ts_ns,
21703                    __buffa_unknown_fields: self
21704                        .__buffa_unknown_fields
21705                        .to_owned()?
21706                        .into(),
21707                    ..::core::default::Default::default()
21708                })
21709            }
21710        }
21711        impl<'a> ::buffa::ViewEncode<'a> for ResumeTriggerResponseView<'a> {
21712            #[allow(clippy::needless_borrow, clippy::let_and_return)]
21713            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
21714                #[allow(unused_imports)]
21715                use ::buffa::Enumeration as _;
21716                let mut size = 0u32;
21717                if self.trigger_id != 0u64 {
21718                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21719                }
21720                {
21721                    let val = self.status.to_i32();
21722                    if val != 0 {
21723                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
21724                    }
21725                }
21726                if self.ts.is_set() {
21727                    let __slot = __cache.reserve();
21728                    let inner_size = self.ts.compute_size(__cache);
21729                    __cache.set(__slot, inner_size);
21730                    size
21731                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
21732                            + inner_size;
21733                }
21734                if self.ts_ns != 0u64 {
21735                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
21736                }
21737                size += self.__buffa_unknown_fields.encoded_len() as u32;
21738                size
21739            }
21740            #[allow(clippy::needless_borrow)]
21741            fn write_to(
21742                &self,
21743                __cache: &mut ::buffa::SizeCache,
21744                buf: &mut impl ::buffa::bytes::BufMut,
21745            ) {
21746                #[allow(unused_imports)]
21747                use ::buffa::Enumeration as _;
21748                if self.trigger_id != 0u64 {
21749                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21750                }
21751                {
21752                    let val = self.status.to_i32();
21753                    if val != 0 {
21754                        ::buffa::types::put_int32_field(2u32, val, buf);
21755                    }
21756                }
21757                if self.ts.is_set() {
21758                    ::buffa::types::put_len_delimited_header(
21759                        3u32,
21760                        __cache.consume_next(),
21761                        buf,
21762                    );
21763                    self.ts.write_to(__cache, buf);
21764                }
21765                if self.ts_ns != 0u64 {
21766                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
21767                }
21768                self.__buffa_unknown_fields.write_to(buf);
21769            }
21770        }
21771        /// Serializes this view as protobuf JSON.
21772        ///
21773        /// Implicit-presence fields with default values are omitted, `required`
21774        /// fields are always emitted, explicit-presence (`optional`) fields are
21775        /// emitted only when set, bytes fields are base64-encoded, and enum
21776        /// values are their proto name strings.
21777        ///
21778        /// This impl uses `serialize_map(None)` because the number of emitted
21779        /// fields depends on default-omission rules; serializers that require
21780        /// known map lengths (e.g. `bincode`) will return a runtime error.
21781        /// Use the owned message type for those formats.
21782        impl<'__a> ::serde::Serialize for ResumeTriggerResponseView<'__a> {
21783            fn serialize<__S: ::serde::Serializer>(
21784                &self,
21785                __s: __S,
21786            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21787                use ::serde::ser::SerializeMap as _;
21788                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21789                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21790                    __map
21791                        .serialize_entry(
21792                            "triggerId",
21793                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21794                        )?;
21795                }
21796                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
21797                    __map.serialize_entry("status", &self.status)?;
21798                }
21799                {
21800                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
21801                        __map.serialize_entry("ts", __v)?;
21802                    }
21803                }
21804                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
21805                    __map
21806                        .serialize_entry(
21807                            "tsNs",
21808                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
21809                        )?;
21810                }
21811                __map.end()
21812            }
21813        }
21814        impl<'a> ::buffa::MessageName for ResumeTriggerResponseView<'a> {
21815            const PACKAGE: &'static str = "triggers.v1";
21816            const NAME: &'static str = "ResumeTriggerResponse";
21817            const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerResponse";
21818            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
21819        }
21820        ::buffa::impl_default_view_instance!(ResumeTriggerResponseView);
21821        ::buffa::impl_view_reborrow!(ResumeTriggerResponseView);
21822        /** Self-contained, `'static` owned view of a `ResumeTriggerResponse` message.
21823
21824 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.
21825
21826 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.*/
21827        #[derive(Clone, Debug)]
21828        pub struct ResumeTriggerResponseOwnedView(
21829            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21830        );
21831        impl ResumeTriggerResponseOwnedView {
21832            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21833            ///
21834            /// The view borrows directly from the buffer's data; the buffer is
21835            /// retained inside the returned handle.
21836            ///
21837            /// # Errors
21838            ///
21839            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21840            /// protobuf data.
21841            pub fn decode(
21842                bytes: ::buffa::bytes::Bytes,
21843            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21844                ::core::result::Result::Ok(
21845                    ResumeTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
21846                )
21847            }
21848            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21849            /// max message size).
21850            ///
21851            /// # Errors
21852            ///
21853            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21854            /// exceeds the configured limits.
21855            pub fn decode_with_options(
21856                bytes: ::buffa::bytes::Bytes,
21857                opts: &::buffa::DecodeOptions,
21858            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21859                ::core::result::Result::Ok(
21860                    ResumeTriggerResponseOwnedView(
21861                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21862                    ),
21863                )
21864            }
21865            /// Build from an owned message via an encode → decode round-trip.
21866            ///
21867            /// # Errors
21868            ///
21869            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21870            /// somehow invalid (should not happen for well-formed messages).
21871            pub fn from_owned(
21872                msg: &super::super::ResumeTriggerResponse,
21873            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21874                ::core::result::Result::Ok(
21875                    ResumeTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
21876                )
21877            }
21878            /// Borrow the full [`ResumeTriggerResponseView`] with its lifetime tied to `&self`.
21879            #[must_use]
21880            pub fn view(&self) -> &ResumeTriggerResponseView<'_> {
21881                self.0.reborrow()
21882            }
21883            /// Convert to the owned message type.
21884            ///
21885            /// # Errors
21886            ///
21887            /// Returns an error if re-materializing preserved unknown fields
21888            /// fails (e.g. the unknown-field limit is exceeded).
21889            pub fn to_owned_message(
21890                &self,
21891            ) -> ::core::result::Result<
21892                super::super::ResumeTriggerResponse,
21893                ::buffa::DecodeError,
21894            > {
21895                self.0.to_owned_message()
21896            }
21897            /// The underlying bytes buffer.
21898            #[must_use]
21899            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21900                self.0.bytes()
21901            }
21902            /// Consume the handle, returning the underlying bytes buffer.
21903            #[must_use]
21904            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21905                self.0.into_bytes()
21906            }
21907            /// Resumed trigger ID.
21908            ///
21909            /// Field 1: `trigger_id`
21910            #[must_use]
21911            pub fn trigger_id(&self) -> u64 {
21912                self.0.reborrow().trigger_id
21913            }
21914            /// Current trigger status after resuming.
21915            ///
21916            /// Field 2: `status`
21917            #[must_use]
21918            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
21919                self.0.reborrow().status
21920            }
21921            /// Server timestamp.
21922            ///
21923            /// Field 3: `ts`
21924            #[must_use]
21925            pub fn ts(
21926                &self,
21927            ) -> &::buffa::MessageFieldView<
21928                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
21929            > {
21930                &self.0.reborrow().ts
21931            }
21932            /// Server timestamp in nanoseconds since epoch (UTC).
21933            ///
21934            /// Field 4: `ts_ns`
21935            #[must_use]
21936            pub fn ts_ns(&self) -> u64 {
21937                self.0.reborrow().ts_ns
21938            }
21939        }
21940        impl ::core::convert::From<
21941            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21942        > for ResumeTriggerResponseOwnedView {
21943            fn from(
21944                inner: ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21945            ) -> Self {
21946                ResumeTriggerResponseOwnedView(inner)
21947            }
21948        }
21949        impl ::core::convert::From<ResumeTriggerResponseOwnedView>
21950        for ::buffa::OwnedView<ResumeTriggerResponseView<'static>> {
21951            fn from(wrapper: ResumeTriggerResponseOwnedView) -> Self {
21952                wrapper.0
21953            }
21954        }
21955        impl ::core::convert::AsRef<
21956            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21957        > for ResumeTriggerResponseOwnedView {
21958            fn as_ref(&self) -> &::buffa::OwnedView<ResumeTriggerResponseView<'static>> {
21959                &self.0
21960            }
21961        }
21962        impl ::buffa::HasMessageView for super::super::ResumeTriggerResponse {
21963            type View<'a> = ResumeTriggerResponseView<'a>;
21964            type ViewHandle = ResumeTriggerResponseOwnedView;
21965        }
21966        impl ::serde::Serialize for ResumeTriggerResponseOwnedView {
21967            fn serialize<__S: ::serde::Serializer>(
21968                &self,
21969                __s: __S,
21970            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21971                ::serde::Serialize::serialize(&self.0, __s)
21972            }
21973        }
21974        /// =============================================================================
21975        /// Trigger Model
21976        /// =============================================================================
21977        ///
21978        /// StopDetails contains configuration for STOP_LOSS and TAKE_PROFIT triggers.
21979        #[derive(Clone, Debug, Default)]
21980        pub struct StopDetailsView<'a> {
21981            /// Trigger threshold price in quote units scaled by 1e6.
21982            ///
21983            /// Field 1: `trigger_price_ticks`
21984            pub trigger_price_ticks: i64,
21985            /// Price source used for trigger evaluation.
21986            ///
21987            /// Field 2: `trigger_price_source`
21988            pub trigger_price_source: ::buffa::EnumValue<
21989                super::super::super::super::orders::v1::TriggerPriceSource,
21990            >,
21991            /// Direction the price must cross to fire the trigger.
21992            ///
21993            /// Field 3: `trigger_direction`
21994            pub trigger_direction: ::buffa::EnumValue<
21995                super::super::super::super::orders::v1::TriggerDirection,
21996            >,
21997            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21998        }
21999        impl<'a> ::buffa::MessageView<'a> for StopDetailsView<'a> {
22000            type Owned = super::super::StopDetails;
22001            fn decode_view(
22002                buf: &'a [u8],
22003            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22004                let __limit = ::core::cell::Cell::new(
22005                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
22006                );
22007                <Self as ::buffa::MessageView>::decode_view_ctx(
22008                    buf,
22009                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
22010                )
22011            }
22012            fn decode_view_with_ctx(
22013                buf: &'a [u8],
22014                ctx: ::buffa::DecodeContext<'_>,
22015            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22016                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
22017            }
22018            fn merge_view_field(
22019                &mut self,
22020                tag: ::buffa::encoding::Tag,
22021                cur: &'a [u8],
22022                before_tag: &'a [u8],
22023                ctx: ::buffa::DecodeContext<'_>,
22024            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
22025                let _ = ctx;
22026                #[allow(unused_variables)]
22027                let view = self;
22028                let mut cur = cur;
22029                match tag.field_number() {
22030                    1u32 => {
22031                        ::buffa::encoding::check_wire_type(
22032                            tag,
22033                            ::buffa::encoding::WireType::Varint,
22034                        )?;
22035                        view.trigger_price_ticks = ::buffa::types::decode_int64(
22036                            &mut cur,
22037                        )?;
22038                    }
22039                    2u32 => {
22040                        ::buffa::encoding::check_wire_type(
22041                            tag,
22042                            ::buffa::encoding::WireType::Varint,
22043                        )?;
22044                        view.trigger_price_source = ::buffa::EnumValue::from(
22045                            ::buffa::types::decode_int32(&mut cur)?,
22046                        );
22047                    }
22048                    3u32 => {
22049                        ::buffa::encoding::check_wire_type(
22050                            tag,
22051                            ::buffa::encoding::WireType::Varint,
22052                        )?;
22053                        view.trigger_direction = ::buffa::EnumValue::from(
22054                            ::buffa::types::decode_int32(&mut cur)?,
22055                        );
22056                    }
22057                    _ => {
22058                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
22059                        let span_len = before_tag.len() - cur.len();
22060                        view.__buffa_unknown_fields
22061                            .push_record(before_tag, span_len, ctx)?;
22062                    }
22063                }
22064                ::core::result::Result::Ok(cur)
22065            }
22066            fn to_owned_message(
22067                &self,
22068            ) -> ::core::result::Result<
22069                super::super::StopDetails,
22070                ::buffa::DecodeError,
22071            > {
22072                self.to_owned_from_source(None)
22073            }
22074            #[allow(clippy::useless_conversion, clippy::needless_update)]
22075            fn to_owned_from_source(
22076                &self,
22077                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
22078            ) -> ::core::result::Result<
22079                super::super::StopDetails,
22080                ::buffa::DecodeError,
22081            > {
22082                #[allow(unused_imports)]
22083                use ::buffa::alloc::string::ToString as _;
22084                let _ = __buffa_src;
22085                ::core::result::Result::Ok(super::super::StopDetails {
22086                    trigger_price_ticks: self.trigger_price_ticks,
22087                    trigger_price_source: self.trigger_price_source,
22088                    trigger_direction: self.trigger_direction,
22089                    __buffa_unknown_fields: self
22090                        .__buffa_unknown_fields
22091                        .to_owned()?
22092                        .into(),
22093                    ..::core::default::Default::default()
22094                })
22095            }
22096        }
22097        impl<'a> ::buffa::ViewEncode<'a> for StopDetailsView<'a> {
22098            #[allow(clippy::needless_borrow, clippy::let_and_return)]
22099            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
22100                #[allow(unused_imports)]
22101                use ::buffa::Enumeration as _;
22102                let mut size = 0u32;
22103                if self.trigger_price_ticks != 0i64 {
22104                    size
22105                        += 1u32
22106                            + ::buffa::types::int64_encoded_len(self.trigger_price_ticks)
22107                                as u32;
22108                }
22109                {
22110                    let val = self.trigger_price_source.to_i32();
22111                    if val != 0 {
22112                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22113                    }
22114                }
22115                {
22116                    let val = self.trigger_direction.to_i32();
22117                    if val != 0 {
22118                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22119                    }
22120                }
22121                size += self.__buffa_unknown_fields.encoded_len() as u32;
22122                size
22123            }
22124            #[allow(clippy::needless_borrow)]
22125            fn write_to(
22126                &self,
22127                _cache: &mut ::buffa::SizeCache,
22128                buf: &mut impl ::buffa::bytes::BufMut,
22129            ) {
22130                #[allow(unused_imports)]
22131                use ::buffa::Enumeration as _;
22132                if self.trigger_price_ticks != 0i64 {
22133                    ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
22134                }
22135                {
22136                    let val = self.trigger_price_source.to_i32();
22137                    if val != 0 {
22138                        ::buffa::types::put_int32_field(2u32, val, buf);
22139                    }
22140                }
22141                {
22142                    let val = self.trigger_direction.to_i32();
22143                    if val != 0 {
22144                        ::buffa::types::put_int32_field(3u32, val, buf);
22145                    }
22146                }
22147                self.__buffa_unknown_fields.write_to(buf);
22148            }
22149        }
22150        /// Serializes this view as protobuf JSON.
22151        ///
22152        /// Implicit-presence fields with default values are omitted, `required`
22153        /// fields are always emitted, explicit-presence (`optional`) fields are
22154        /// emitted only when set, bytes fields are base64-encoded, and enum
22155        /// values are their proto name strings.
22156        ///
22157        /// This impl uses `serialize_map(None)` because the number of emitted
22158        /// fields depends on default-omission rules; serializers that require
22159        /// known map lengths (e.g. `bincode`) will return a runtime error.
22160        /// Use the owned message type for those formats.
22161        impl<'__a> ::serde::Serialize for StopDetailsView<'__a> {
22162            fn serialize<__S: ::serde::Serializer>(
22163                &self,
22164                __s: __S,
22165            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22166                use ::serde::ser::SerializeMap as _;
22167                let mut __map = __s.serialize_map(::core::option::Option::None)?;
22168                if !::buffa::json_helpers::skip_if::is_zero_i64(
22169                    &self.trigger_price_ticks,
22170                ) {
22171                    __map
22172                        .serialize_entry(
22173                            "triggerPriceTicks",
22174                            &::buffa::json_helpers::ProtoJson(&self.trigger_price_ticks),
22175                        )?;
22176                }
22177                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22178                    &self.trigger_price_source,
22179                ) {
22180                    __map
22181                        .serialize_entry(
22182                            "triggerPriceSource",
22183                            &self.trigger_price_source,
22184                        )?;
22185                }
22186                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22187                    &self.trigger_direction,
22188                ) {
22189                    __map.serialize_entry("triggerDirection", &self.trigger_direction)?;
22190                }
22191                __map.end()
22192            }
22193        }
22194        impl<'a> ::buffa::MessageName for StopDetailsView<'a> {
22195            const PACKAGE: &'static str = "triggers.v1";
22196            const NAME: &'static str = "StopDetails";
22197            const FULL_NAME: &'static str = "triggers.v1.StopDetails";
22198            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
22199        }
22200        ::buffa::impl_default_view_instance!(StopDetailsView);
22201        ::buffa::impl_view_reborrow!(StopDetailsView);
22202        /** Self-contained, `'static` owned view of a `StopDetails` message.
22203
22204 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.
22205
22206 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.*/
22207        #[derive(Clone, Debug)]
22208        pub struct StopDetailsOwnedView(::buffa::OwnedView<StopDetailsView<'static>>);
22209        impl StopDetailsOwnedView {
22210            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
22211            ///
22212            /// The view borrows directly from the buffer's data; the buffer is
22213            /// retained inside the returned handle.
22214            ///
22215            /// # Errors
22216            ///
22217            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
22218            /// protobuf data.
22219            pub fn decode(
22220                bytes: ::buffa::bytes::Bytes,
22221            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22222                ::core::result::Result::Ok(
22223                    StopDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
22224                )
22225            }
22226            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
22227            /// max message size).
22228            ///
22229            /// # Errors
22230            ///
22231            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
22232            /// exceeds the configured limits.
22233            pub fn decode_with_options(
22234                bytes: ::buffa::bytes::Bytes,
22235                opts: &::buffa::DecodeOptions,
22236            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22237                ::core::result::Result::Ok(
22238                    StopDetailsOwnedView(
22239                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
22240                    ),
22241                )
22242            }
22243            /// Build from an owned message via an encode → decode round-trip.
22244            ///
22245            /// # Errors
22246            ///
22247            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
22248            /// somehow invalid (should not happen for well-formed messages).
22249            pub fn from_owned(
22250                msg: &super::super::StopDetails,
22251            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22252                ::core::result::Result::Ok(
22253                    StopDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
22254                )
22255            }
22256            /// Borrow the full [`StopDetailsView`] with its lifetime tied to `&self`.
22257            #[must_use]
22258            pub fn view(&self) -> &StopDetailsView<'_> {
22259                self.0.reborrow()
22260            }
22261            /// Convert to the owned message type.
22262            ///
22263            /// # Errors
22264            ///
22265            /// Returns an error if re-materializing preserved unknown fields
22266            /// fails (e.g. the unknown-field limit is exceeded).
22267            pub fn to_owned_message(
22268                &self,
22269            ) -> ::core::result::Result<
22270                super::super::StopDetails,
22271                ::buffa::DecodeError,
22272            > {
22273                self.0.to_owned_message()
22274            }
22275            /// The underlying bytes buffer.
22276            #[must_use]
22277            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
22278                self.0.bytes()
22279            }
22280            /// Consume the handle, returning the underlying bytes buffer.
22281            #[must_use]
22282            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
22283                self.0.into_bytes()
22284            }
22285            /// Trigger threshold price in quote units scaled by 1e6.
22286            ///
22287            /// Field 1: `trigger_price_ticks`
22288            #[must_use]
22289            pub fn trigger_price_ticks(&self) -> i64 {
22290                self.0.reborrow().trigger_price_ticks
22291            }
22292            /// Price source used for trigger evaluation.
22293            ///
22294            /// Field 2: `trigger_price_source`
22295            #[must_use]
22296            pub fn trigger_price_source(
22297                &self,
22298            ) -> ::buffa::EnumValue<
22299                super::super::super::super::orders::v1::TriggerPriceSource,
22300            > {
22301                self.0.reborrow().trigger_price_source
22302            }
22303            /// Direction the price must cross to fire the trigger.
22304            ///
22305            /// Field 3: `trigger_direction`
22306            #[must_use]
22307            pub fn trigger_direction(
22308                &self,
22309            ) -> ::buffa::EnumValue<
22310                super::super::super::super::orders::v1::TriggerDirection,
22311            > {
22312                self.0.reborrow().trigger_direction
22313            }
22314        }
22315        impl ::core::convert::From<::buffa::OwnedView<StopDetailsView<'static>>>
22316        for StopDetailsOwnedView {
22317            fn from(inner: ::buffa::OwnedView<StopDetailsView<'static>>) -> Self {
22318                StopDetailsOwnedView(inner)
22319            }
22320        }
22321        impl ::core::convert::From<StopDetailsOwnedView>
22322        for ::buffa::OwnedView<StopDetailsView<'static>> {
22323            fn from(wrapper: StopDetailsOwnedView) -> Self {
22324                wrapper.0
22325            }
22326        }
22327        impl ::core::convert::AsRef<::buffa::OwnedView<StopDetailsView<'static>>>
22328        for StopDetailsOwnedView {
22329            fn as_ref(&self) -> &::buffa::OwnedView<StopDetailsView<'static>> {
22330                &self.0
22331            }
22332        }
22333        impl ::buffa::HasMessageView for super::super::StopDetails {
22334            type View<'a> = StopDetailsView<'a>;
22335            type ViewHandle = StopDetailsOwnedView;
22336        }
22337        impl ::serde::Serialize for StopDetailsOwnedView {
22338            fn serialize<__S: ::serde::Serializer>(
22339                &self,
22340                __s: __S,
22341            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22342                ::serde::Serialize::serialize(&self.0, __s)
22343            }
22344        }
22345        /// TrailingDetails contains configuration and runtime state for TRAILING_STOP
22346        /// triggers.
22347        #[derive(Clone, Debug, Default)]
22348        pub struct TrailingDetailsView<'a> {
22349            /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
22350            ///
22351            /// Field 1: `trailing_distance_ticks`
22352            pub trailing_distance_ticks: i64,
22353            /// Optional activation price: trailing only starts after this price is
22354            /// reached. Expressed in quote units scaled by 1e6.
22355            ///
22356            /// Field 2: `activation_price_ticks`
22357            pub activation_price_ticks: i64,
22358            /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
22359            ///
22360            /// Field 3: `peak_price_ticks`
22361            pub peak_price_ticks: i64,
22362            /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
22363            ///
22364            /// Field 4: `trough_price_ticks`
22365            pub trough_price_ticks: i64,
22366            /// Trailing distance in basis points (1 bp = 0.01%).
22367            ///
22368            /// Field 5: `trailing_distance_bps`
22369            pub trailing_distance_bps: i32,
22370            /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
22371            ///
22372            /// Field 6: `max_slippage_ticks`
22373            pub max_slippage_ticks: i32,
22374            /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
22375            ///
22376            /// Field 7: `max_slippage_bps`
22377            pub max_slippage_bps: i32,
22378            /// Price source used for trigger evaluation. Fixed for the lifetime of the
22379            /// trigger and exposed for completeness.
22380            ///
22381            /// Field 8: `trigger_price_source`
22382            pub trigger_price_source: ::buffa::EnumValue<
22383                super::super::super::super::orders::v1::TriggerPriceSource,
22384            >,
22385            /// Direction the price must cross to fire the trigger. Fixed for the lifetime
22386            /// of the trigger and exposed for completeness.
22387            ///
22388            /// Field 9: `trigger_direction`
22389            pub trigger_direction: ::buffa::EnumValue<
22390                super::super::super::super::orders::v1::TriggerDirection,
22391            >,
22392            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22393        }
22394        impl<'a> ::buffa::MessageView<'a> for TrailingDetailsView<'a> {
22395            type Owned = super::super::TrailingDetails;
22396            fn decode_view(
22397                buf: &'a [u8],
22398            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22399                let __limit = ::core::cell::Cell::new(
22400                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
22401                );
22402                <Self as ::buffa::MessageView>::decode_view_ctx(
22403                    buf,
22404                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
22405                )
22406            }
22407            fn decode_view_with_ctx(
22408                buf: &'a [u8],
22409                ctx: ::buffa::DecodeContext<'_>,
22410            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22411                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
22412            }
22413            fn merge_view_field(
22414                &mut self,
22415                tag: ::buffa::encoding::Tag,
22416                cur: &'a [u8],
22417                before_tag: &'a [u8],
22418                ctx: ::buffa::DecodeContext<'_>,
22419            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
22420                let _ = ctx;
22421                #[allow(unused_variables)]
22422                let view = self;
22423                let mut cur = cur;
22424                match tag.field_number() {
22425                    1u32 => {
22426                        ::buffa::encoding::check_wire_type(
22427                            tag,
22428                            ::buffa::encoding::WireType::Varint,
22429                        )?;
22430                        view.trailing_distance_ticks = ::buffa::types::decode_int64(
22431                            &mut cur,
22432                        )?;
22433                    }
22434                    2u32 => {
22435                        ::buffa::encoding::check_wire_type(
22436                            tag,
22437                            ::buffa::encoding::WireType::Varint,
22438                        )?;
22439                        view.activation_price_ticks = ::buffa::types::decode_int64(
22440                            &mut cur,
22441                        )?;
22442                    }
22443                    3u32 => {
22444                        ::buffa::encoding::check_wire_type(
22445                            tag,
22446                            ::buffa::encoding::WireType::Varint,
22447                        )?;
22448                        view.peak_price_ticks = ::buffa::types::decode_int64(&mut cur)?;
22449                    }
22450                    4u32 => {
22451                        ::buffa::encoding::check_wire_type(
22452                            tag,
22453                            ::buffa::encoding::WireType::Varint,
22454                        )?;
22455                        view.trough_price_ticks = ::buffa::types::decode_int64(
22456                            &mut cur,
22457                        )?;
22458                    }
22459                    5u32 => {
22460                        ::buffa::encoding::check_wire_type(
22461                            tag,
22462                            ::buffa::encoding::WireType::Varint,
22463                        )?;
22464                        view.trailing_distance_bps = ::buffa::types::decode_int32(
22465                            &mut cur,
22466                        )?;
22467                    }
22468                    6u32 => {
22469                        ::buffa::encoding::check_wire_type(
22470                            tag,
22471                            ::buffa::encoding::WireType::Varint,
22472                        )?;
22473                        view.max_slippage_ticks = ::buffa::types::decode_int32(
22474                            &mut cur,
22475                        )?;
22476                    }
22477                    7u32 => {
22478                        ::buffa::encoding::check_wire_type(
22479                            tag,
22480                            ::buffa::encoding::WireType::Varint,
22481                        )?;
22482                        view.max_slippage_bps = ::buffa::types::decode_int32(&mut cur)?;
22483                    }
22484                    8u32 => {
22485                        ::buffa::encoding::check_wire_type(
22486                            tag,
22487                            ::buffa::encoding::WireType::Varint,
22488                        )?;
22489                        view.trigger_price_source = ::buffa::EnumValue::from(
22490                            ::buffa::types::decode_int32(&mut cur)?,
22491                        );
22492                    }
22493                    9u32 => {
22494                        ::buffa::encoding::check_wire_type(
22495                            tag,
22496                            ::buffa::encoding::WireType::Varint,
22497                        )?;
22498                        view.trigger_direction = ::buffa::EnumValue::from(
22499                            ::buffa::types::decode_int32(&mut cur)?,
22500                        );
22501                    }
22502                    _ => {
22503                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
22504                        let span_len = before_tag.len() - cur.len();
22505                        view.__buffa_unknown_fields
22506                            .push_record(before_tag, span_len, ctx)?;
22507                    }
22508                }
22509                ::core::result::Result::Ok(cur)
22510            }
22511            fn to_owned_message(
22512                &self,
22513            ) -> ::core::result::Result<
22514                super::super::TrailingDetails,
22515                ::buffa::DecodeError,
22516            > {
22517                self.to_owned_from_source(None)
22518            }
22519            #[allow(clippy::useless_conversion, clippy::needless_update)]
22520            fn to_owned_from_source(
22521                &self,
22522                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
22523            ) -> ::core::result::Result<
22524                super::super::TrailingDetails,
22525                ::buffa::DecodeError,
22526            > {
22527                #[allow(unused_imports)]
22528                use ::buffa::alloc::string::ToString as _;
22529                let _ = __buffa_src;
22530                ::core::result::Result::Ok(super::super::TrailingDetails {
22531                    trailing_distance_ticks: self.trailing_distance_ticks,
22532                    activation_price_ticks: self.activation_price_ticks,
22533                    peak_price_ticks: self.peak_price_ticks,
22534                    trough_price_ticks: self.trough_price_ticks,
22535                    trailing_distance_bps: self.trailing_distance_bps,
22536                    max_slippage_ticks: self.max_slippage_ticks,
22537                    max_slippage_bps: self.max_slippage_bps,
22538                    trigger_price_source: self.trigger_price_source,
22539                    trigger_direction: self.trigger_direction,
22540                    __buffa_unknown_fields: self
22541                        .__buffa_unknown_fields
22542                        .to_owned()?
22543                        .into(),
22544                    ..::core::default::Default::default()
22545                })
22546            }
22547        }
22548        impl<'a> ::buffa::ViewEncode<'a> for TrailingDetailsView<'a> {
22549            #[allow(clippy::needless_borrow, clippy::let_and_return)]
22550            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
22551                #[allow(unused_imports)]
22552                use ::buffa::Enumeration as _;
22553                let mut size = 0u32;
22554                if self.trailing_distance_ticks != 0i64 {
22555                    size
22556                        += 1u32
22557                            + ::buffa::types::int64_encoded_len(
22558                                self.trailing_distance_ticks,
22559                            ) as u32;
22560                }
22561                if self.activation_price_ticks != 0i64 {
22562                    size
22563                        += 1u32
22564                            + ::buffa::types::int64_encoded_len(
22565                                self.activation_price_ticks,
22566                            ) as u32;
22567                }
22568                if self.peak_price_ticks != 0i64 {
22569                    size
22570                        += 1u32
22571                            + ::buffa::types::int64_encoded_len(self.peak_price_ticks)
22572                                as u32;
22573                }
22574                if self.trough_price_ticks != 0i64 {
22575                    size
22576                        += 1u32
22577                            + ::buffa::types::int64_encoded_len(self.trough_price_ticks)
22578                                as u32;
22579                }
22580                if self.trailing_distance_bps != 0i32 {
22581                    size
22582                        += 1u32
22583                            + ::buffa::types::int32_encoded_len(
22584                                self.trailing_distance_bps,
22585                            ) as u32;
22586                }
22587                if self.max_slippage_ticks != 0i32 {
22588                    size
22589                        += 1u32
22590                            + ::buffa::types::int32_encoded_len(self.max_slippage_ticks)
22591                                as u32;
22592                }
22593                if self.max_slippage_bps != 0i32 {
22594                    size
22595                        += 1u32
22596                            + ::buffa::types::int32_encoded_len(self.max_slippage_bps)
22597                                as u32;
22598                }
22599                {
22600                    let val = self.trigger_price_source.to_i32();
22601                    if val != 0 {
22602                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22603                    }
22604                }
22605                {
22606                    let val = self.trigger_direction.to_i32();
22607                    if val != 0 {
22608                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22609                    }
22610                }
22611                size += self.__buffa_unknown_fields.encoded_len() as u32;
22612                size
22613            }
22614            #[allow(clippy::needless_borrow)]
22615            fn write_to(
22616                &self,
22617                _cache: &mut ::buffa::SizeCache,
22618                buf: &mut impl ::buffa::bytes::BufMut,
22619            ) {
22620                #[allow(unused_imports)]
22621                use ::buffa::Enumeration as _;
22622                if self.trailing_distance_ticks != 0i64 {
22623                    ::buffa::types::put_int64_field(
22624                        1u32,
22625                        self.trailing_distance_ticks,
22626                        buf,
22627                    );
22628                }
22629                if self.activation_price_ticks != 0i64 {
22630                    ::buffa::types::put_int64_field(
22631                        2u32,
22632                        self.activation_price_ticks,
22633                        buf,
22634                    );
22635                }
22636                if self.peak_price_ticks != 0i64 {
22637                    ::buffa::types::put_int64_field(3u32, self.peak_price_ticks, buf);
22638                }
22639                if self.trough_price_ticks != 0i64 {
22640                    ::buffa::types::put_int64_field(4u32, self.trough_price_ticks, buf);
22641                }
22642                if self.trailing_distance_bps != 0i32 {
22643                    ::buffa::types::put_int32_field(
22644                        5u32,
22645                        self.trailing_distance_bps,
22646                        buf,
22647                    );
22648                }
22649                if self.max_slippage_ticks != 0i32 {
22650                    ::buffa::types::put_int32_field(6u32, self.max_slippage_ticks, buf);
22651                }
22652                if self.max_slippage_bps != 0i32 {
22653                    ::buffa::types::put_int32_field(7u32, self.max_slippage_bps, buf);
22654                }
22655                {
22656                    let val = self.trigger_price_source.to_i32();
22657                    if val != 0 {
22658                        ::buffa::types::put_int32_field(8u32, val, buf);
22659                    }
22660                }
22661                {
22662                    let val = self.trigger_direction.to_i32();
22663                    if val != 0 {
22664                        ::buffa::types::put_int32_field(9u32, val, buf);
22665                    }
22666                }
22667                self.__buffa_unknown_fields.write_to(buf);
22668            }
22669        }
22670        /// Serializes this view as protobuf JSON.
22671        ///
22672        /// Implicit-presence fields with default values are omitted, `required`
22673        /// fields are always emitted, explicit-presence (`optional`) fields are
22674        /// emitted only when set, bytes fields are base64-encoded, and enum
22675        /// values are their proto name strings.
22676        ///
22677        /// This impl uses `serialize_map(None)` because the number of emitted
22678        /// fields depends on default-omission rules; serializers that require
22679        /// known map lengths (e.g. `bincode`) will return a runtime error.
22680        /// Use the owned message type for those formats.
22681        impl<'__a> ::serde::Serialize for TrailingDetailsView<'__a> {
22682            fn serialize<__S: ::serde::Serializer>(
22683                &self,
22684                __s: __S,
22685            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22686                use ::serde::ser::SerializeMap as _;
22687                let mut __map = __s.serialize_map(::core::option::Option::None)?;
22688                if !::buffa::json_helpers::skip_if::is_zero_i64(
22689                    &self.trailing_distance_ticks,
22690                ) {
22691                    __map
22692                        .serialize_entry(
22693                            "trailingDistanceTicks",
22694                            &::buffa::json_helpers::ProtoJson(
22695                                &self.trailing_distance_ticks,
22696                            ),
22697                        )?;
22698                }
22699                if !::buffa::json_helpers::skip_if::is_zero_i64(
22700                    &self.activation_price_ticks,
22701                ) {
22702                    __map
22703                        .serialize_entry(
22704                            "activationPriceTicks",
22705                            &::buffa::json_helpers::ProtoJson(
22706                                &self.activation_price_ticks,
22707                            ),
22708                        )?;
22709                }
22710                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.peak_price_ticks) {
22711                    __map
22712                        .serialize_entry(
22713                            "peakPriceTicks",
22714                            &::buffa::json_helpers::ProtoJson(&self.peak_price_ticks),
22715                        )?;
22716                }
22717                if !::buffa::json_helpers::skip_if::is_zero_i64(
22718                    &self.trough_price_ticks,
22719                ) {
22720                    __map
22721                        .serialize_entry(
22722                            "troughPriceTicks",
22723                            &::buffa::json_helpers::ProtoJson(&self.trough_price_ticks),
22724                        )?;
22725                }
22726                if !::buffa::json_helpers::skip_if::is_zero_i32(
22727                    &self.trailing_distance_bps,
22728                ) {
22729                    __map
22730                        .serialize_entry(
22731                            "trailingDistanceBps",
22732                            &::buffa::json_helpers::ProtoJson(
22733                                &self.trailing_distance_bps,
22734                            ),
22735                        )?;
22736                }
22737                if !::buffa::json_helpers::skip_if::is_zero_i32(
22738                    &self.max_slippage_ticks,
22739                ) {
22740                    __map
22741                        .serialize_entry(
22742                            "maxSlippageTicks",
22743                            &::buffa::json_helpers::ProtoJson(&self.max_slippage_ticks),
22744                        )?;
22745                }
22746                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.max_slippage_bps) {
22747                    __map
22748                        .serialize_entry(
22749                            "maxSlippageBps",
22750                            &::buffa::json_helpers::ProtoJson(&self.max_slippage_bps),
22751                        )?;
22752                }
22753                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22754                    &self.trigger_price_source,
22755                ) {
22756                    __map
22757                        .serialize_entry(
22758                            "triggerPriceSource",
22759                            &self.trigger_price_source,
22760                        )?;
22761                }
22762                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22763                    &self.trigger_direction,
22764                ) {
22765                    __map.serialize_entry("triggerDirection", &self.trigger_direction)?;
22766                }
22767                __map.end()
22768            }
22769        }
22770        impl<'a> ::buffa::MessageName for TrailingDetailsView<'a> {
22771            const PACKAGE: &'static str = "triggers.v1";
22772            const NAME: &'static str = "TrailingDetails";
22773            const FULL_NAME: &'static str = "triggers.v1.TrailingDetails";
22774            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
22775        }
22776        ::buffa::impl_default_view_instance!(TrailingDetailsView);
22777        ::buffa::impl_view_reborrow!(TrailingDetailsView);
22778        /** Self-contained, `'static` owned view of a `TrailingDetails` message.
22779
22780 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.
22781
22782 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.*/
22783        #[derive(Clone, Debug)]
22784        pub struct TrailingDetailsOwnedView(
22785            ::buffa::OwnedView<TrailingDetailsView<'static>>,
22786        );
22787        impl TrailingDetailsOwnedView {
22788            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
22789            ///
22790            /// The view borrows directly from the buffer's data; the buffer is
22791            /// retained inside the returned handle.
22792            ///
22793            /// # Errors
22794            ///
22795            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
22796            /// protobuf data.
22797            pub fn decode(
22798                bytes: ::buffa::bytes::Bytes,
22799            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22800                ::core::result::Result::Ok(
22801                    TrailingDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
22802                )
22803            }
22804            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
22805            /// max message size).
22806            ///
22807            /// # Errors
22808            ///
22809            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
22810            /// exceeds the configured limits.
22811            pub fn decode_with_options(
22812                bytes: ::buffa::bytes::Bytes,
22813                opts: &::buffa::DecodeOptions,
22814            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22815                ::core::result::Result::Ok(
22816                    TrailingDetailsOwnedView(
22817                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
22818                    ),
22819                )
22820            }
22821            /// Build from an owned message via an encode → decode round-trip.
22822            ///
22823            /// # Errors
22824            ///
22825            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
22826            /// somehow invalid (should not happen for well-formed messages).
22827            pub fn from_owned(
22828                msg: &super::super::TrailingDetails,
22829            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22830                ::core::result::Result::Ok(
22831                    TrailingDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
22832                )
22833            }
22834            /// Borrow the full [`TrailingDetailsView`] with its lifetime tied to `&self`.
22835            #[must_use]
22836            pub fn view(&self) -> &TrailingDetailsView<'_> {
22837                self.0.reborrow()
22838            }
22839            /// Convert to the owned message type.
22840            ///
22841            /// # Errors
22842            ///
22843            /// Returns an error if re-materializing preserved unknown fields
22844            /// fails (e.g. the unknown-field limit is exceeded).
22845            pub fn to_owned_message(
22846                &self,
22847            ) -> ::core::result::Result<
22848                super::super::TrailingDetails,
22849                ::buffa::DecodeError,
22850            > {
22851                self.0.to_owned_message()
22852            }
22853            /// The underlying bytes buffer.
22854            #[must_use]
22855            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
22856                self.0.bytes()
22857            }
22858            /// Consume the handle, returning the underlying bytes buffer.
22859            #[must_use]
22860            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
22861                self.0.into_bytes()
22862            }
22863            /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
22864            ///
22865            /// Field 1: `trailing_distance_ticks`
22866            #[must_use]
22867            pub fn trailing_distance_ticks(&self) -> i64 {
22868                self.0.reborrow().trailing_distance_ticks
22869            }
22870            /// Optional activation price: trailing only starts after this price is
22871            /// reached. Expressed in quote units scaled by 1e6.
22872            ///
22873            /// Field 2: `activation_price_ticks`
22874            #[must_use]
22875            pub fn activation_price_ticks(&self) -> i64 {
22876                self.0.reborrow().activation_price_ticks
22877            }
22878            /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
22879            ///
22880            /// Field 3: `peak_price_ticks`
22881            #[must_use]
22882            pub fn peak_price_ticks(&self) -> i64 {
22883                self.0.reborrow().peak_price_ticks
22884            }
22885            /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
22886            ///
22887            /// Field 4: `trough_price_ticks`
22888            #[must_use]
22889            pub fn trough_price_ticks(&self) -> i64 {
22890                self.0.reborrow().trough_price_ticks
22891            }
22892            /// Trailing distance in basis points (1 bp = 0.01%).
22893            ///
22894            /// Field 5: `trailing_distance_bps`
22895            #[must_use]
22896            pub fn trailing_distance_bps(&self) -> i32 {
22897                self.0.reborrow().trailing_distance_bps
22898            }
22899            /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
22900            ///
22901            /// Field 6: `max_slippage_ticks`
22902            #[must_use]
22903            pub fn max_slippage_ticks(&self) -> i32 {
22904                self.0.reborrow().max_slippage_ticks
22905            }
22906            /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
22907            ///
22908            /// Field 7: `max_slippage_bps`
22909            #[must_use]
22910            pub fn max_slippage_bps(&self) -> i32 {
22911                self.0.reborrow().max_slippage_bps
22912            }
22913            /// Price source used for trigger evaluation. Fixed for the lifetime of the
22914            /// trigger and exposed for completeness.
22915            ///
22916            /// Field 8: `trigger_price_source`
22917            #[must_use]
22918            pub fn trigger_price_source(
22919                &self,
22920            ) -> ::buffa::EnumValue<
22921                super::super::super::super::orders::v1::TriggerPriceSource,
22922            > {
22923                self.0.reborrow().trigger_price_source
22924            }
22925            /// Direction the price must cross to fire the trigger. Fixed for the lifetime
22926            /// of the trigger and exposed for completeness.
22927            ///
22928            /// Field 9: `trigger_direction`
22929            #[must_use]
22930            pub fn trigger_direction(
22931                &self,
22932            ) -> ::buffa::EnumValue<
22933                super::super::super::super::orders::v1::TriggerDirection,
22934            > {
22935                self.0.reborrow().trigger_direction
22936            }
22937        }
22938        impl ::core::convert::From<::buffa::OwnedView<TrailingDetailsView<'static>>>
22939        for TrailingDetailsOwnedView {
22940            fn from(inner: ::buffa::OwnedView<TrailingDetailsView<'static>>) -> Self {
22941                TrailingDetailsOwnedView(inner)
22942            }
22943        }
22944        impl ::core::convert::From<TrailingDetailsOwnedView>
22945        for ::buffa::OwnedView<TrailingDetailsView<'static>> {
22946            fn from(wrapper: TrailingDetailsOwnedView) -> Self {
22947                wrapper.0
22948            }
22949        }
22950        impl ::core::convert::AsRef<::buffa::OwnedView<TrailingDetailsView<'static>>>
22951        for TrailingDetailsOwnedView {
22952            fn as_ref(&self) -> &::buffa::OwnedView<TrailingDetailsView<'static>> {
22953                &self.0
22954            }
22955        }
22956        impl ::buffa::HasMessageView for super::super::TrailingDetails {
22957            type View<'a> = TrailingDetailsView<'a>;
22958            type ViewHandle = TrailingDetailsOwnedView;
22959        }
22960        impl ::serde::Serialize for TrailingDetailsOwnedView {
22961            fn serialize<__S: ::serde::Serializer>(
22962                &self,
22963                __s: __S,
22964            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22965                ::serde::Serialize::serialize(&self.0, __s)
22966            }
22967        }
22968        /// TwapDetails contains configuration and runtime state for TWAP triggers.
22969        #[derive(Clone, Debug, Default)]
22970        pub struct TwapDetailsView<'a> {
22971            /// Total duration of TWAP execution in milliseconds.
22972            ///
22973            /// Field 1: `twap_duration_ms`
22974            pub twap_duration_ms: i64,
22975            /// Interval between TWAP slices in milliseconds.
22976            ///
22977            /// Field 2: `twap_slice_interval_ms`
22978            pub twap_slice_interval_ms: i64,
22979            /// Current slice index, zero-based.
22980            ///
22981            /// Field 4: `slice_idx`
22982            pub slice_idx: i32,
22983            /// Total number of planned slices.
22984            ///
22985            /// Field 5: `slice_count`
22986            pub slice_count: i32,
22987            /// Cumulative filled child-order base quantity scaled by the pair's
22988            /// base_quantity_scale from GetSpotConfig.
22989            ///
22990            /// Field 6: `executed_qty_scaled`
22991            pub executed_qty_scaled: i64,
22992            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22993        }
22994        impl<'a> ::buffa::MessageView<'a> for TwapDetailsView<'a> {
22995            type Owned = super::super::TwapDetails;
22996            fn decode_view(
22997                buf: &'a [u8],
22998            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22999                let __limit = ::core::cell::Cell::new(
23000                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23001                );
23002                <Self as ::buffa::MessageView>::decode_view_ctx(
23003                    buf,
23004                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23005                )
23006            }
23007            fn decode_view_with_ctx(
23008                buf: &'a [u8],
23009                ctx: ::buffa::DecodeContext<'_>,
23010            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23011                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23012            }
23013            fn merge_view_field(
23014                &mut self,
23015                tag: ::buffa::encoding::Tag,
23016                cur: &'a [u8],
23017                before_tag: &'a [u8],
23018                ctx: ::buffa::DecodeContext<'_>,
23019            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23020                let _ = ctx;
23021                #[allow(unused_variables)]
23022                let view = self;
23023                let mut cur = cur;
23024                match tag.field_number() {
23025                    1u32 => {
23026                        ::buffa::encoding::check_wire_type(
23027                            tag,
23028                            ::buffa::encoding::WireType::Varint,
23029                        )?;
23030                        view.twap_duration_ms = ::buffa::types::decode_int64(&mut cur)?;
23031                    }
23032                    2u32 => {
23033                        ::buffa::encoding::check_wire_type(
23034                            tag,
23035                            ::buffa::encoding::WireType::Varint,
23036                        )?;
23037                        view.twap_slice_interval_ms = ::buffa::types::decode_int64(
23038                            &mut cur,
23039                        )?;
23040                    }
23041                    4u32 => {
23042                        ::buffa::encoding::check_wire_type(
23043                            tag,
23044                            ::buffa::encoding::WireType::Varint,
23045                        )?;
23046                        view.slice_idx = ::buffa::types::decode_int32(&mut cur)?;
23047                    }
23048                    5u32 => {
23049                        ::buffa::encoding::check_wire_type(
23050                            tag,
23051                            ::buffa::encoding::WireType::Varint,
23052                        )?;
23053                        view.slice_count = ::buffa::types::decode_int32(&mut cur)?;
23054                    }
23055                    6u32 => {
23056                        ::buffa::encoding::check_wire_type(
23057                            tag,
23058                            ::buffa::encoding::WireType::Varint,
23059                        )?;
23060                        view.executed_qty_scaled = ::buffa::types::decode_int64(
23061                            &mut cur,
23062                        )?;
23063                    }
23064                    _ => {
23065                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
23066                        let span_len = before_tag.len() - cur.len();
23067                        view.__buffa_unknown_fields
23068                            .push_record(before_tag, span_len, ctx)?;
23069                    }
23070                }
23071                ::core::result::Result::Ok(cur)
23072            }
23073            fn to_owned_message(
23074                &self,
23075            ) -> ::core::result::Result<
23076                super::super::TwapDetails,
23077                ::buffa::DecodeError,
23078            > {
23079                self.to_owned_from_source(None)
23080            }
23081            #[allow(clippy::useless_conversion, clippy::needless_update)]
23082            fn to_owned_from_source(
23083                &self,
23084                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
23085            ) -> ::core::result::Result<
23086                super::super::TwapDetails,
23087                ::buffa::DecodeError,
23088            > {
23089                #[allow(unused_imports)]
23090                use ::buffa::alloc::string::ToString as _;
23091                let _ = __buffa_src;
23092                ::core::result::Result::Ok(super::super::TwapDetails {
23093                    twap_duration_ms: self.twap_duration_ms,
23094                    twap_slice_interval_ms: self.twap_slice_interval_ms,
23095                    slice_idx: self.slice_idx,
23096                    slice_count: self.slice_count,
23097                    executed_qty_scaled: self.executed_qty_scaled,
23098                    __buffa_unknown_fields: self
23099                        .__buffa_unknown_fields
23100                        .to_owned()?
23101                        .into(),
23102                    ..::core::default::Default::default()
23103                })
23104            }
23105        }
23106        impl<'a> ::buffa::ViewEncode<'a> for TwapDetailsView<'a> {
23107            #[allow(clippy::needless_borrow, clippy::let_and_return)]
23108            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
23109                #[allow(unused_imports)]
23110                use ::buffa::Enumeration as _;
23111                let mut size = 0u32;
23112                if self.twap_duration_ms != 0i64 {
23113                    size
23114                        += 1u32
23115                            + ::buffa::types::int64_encoded_len(self.twap_duration_ms)
23116                                as u32;
23117                }
23118                if self.twap_slice_interval_ms != 0i64 {
23119                    size
23120                        += 1u32
23121                            + ::buffa::types::int64_encoded_len(
23122                                self.twap_slice_interval_ms,
23123                            ) as u32;
23124                }
23125                if self.slice_idx != 0i32 {
23126                    size
23127                        += 1u32
23128                            + ::buffa::types::int32_encoded_len(self.slice_idx) as u32;
23129                }
23130                if self.slice_count != 0i32 {
23131                    size
23132                        += 1u32
23133                            + ::buffa::types::int32_encoded_len(self.slice_count) as u32;
23134                }
23135                if self.executed_qty_scaled != 0i64 {
23136                    size
23137                        += 1u32
23138                            + ::buffa::types::int64_encoded_len(self.executed_qty_scaled)
23139                                as u32;
23140                }
23141                size += self.__buffa_unknown_fields.encoded_len() as u32;
23142                size
23143            }
23144            #[allow(clippy::needless_borrow)]
23145            fn write_to(
23146                &self,
23147                _cache: &mut ::buffa::SizeCache,
23148                buf: &mut impl ::buffa::bytes::BufMut,
23149            ) {
23150                #[allow(unused_imports)]
23151                use ::buffa::Enumeration as _;
23152                if self.twap_duration_ms != 0i64 {
23153                    ::buffa::types::put_int64_field(1u32, self.twap_duration_ms, buf);
23154                }
23155                if self.twap_slice_interval_ms != 0i64 {
23156                    ::buffa::types::put_int64_field(
23157                        2u32,
23158                        self.twap_slice_interval_ms,
23159                        buf,
23160                    );
23161                }
23162                if self.slice_idx != 0i32 {
23163                    ::buffa::types::put_int32_field(4u32, self.slice_idx, buf);
23164                }
23165                if self.slice_count != 0i32 {
23166                    ::buffa::types::put_int32_field(5u32, self.slice_count, buf);
23167                }
23168                if self.executed_qty_scaled != 0i64 {
23169                    ::buffa::types::put_int64_field(6u32, self.executed_qty_scaled, buf);
23170                }
23171                self.__buffa_unknown_fields.write_to(buf);
23172            }
23173        }
23174        /// Serializes this view as protobuf JSON.
23175        ///
23176        /// Implicit-presence fields with default values are omitted, `required`
23177        /// fields are always emitted, explicit-presence (`optional`) fields are
23178        /// emitted only when set, bytes fields are base64-encoded, and enum
23179        /// values are their proto name strings.
23180        ///
23181        /// This impl uses `serialize_map(None)` because the number of emitted
23182        /// fields depends on default-omission rules; serializers that require
23183        /// known map lengths (e.g. `bincode`) will return a runtime error.
23184        /// Use the owned message type for those formats.
23185        impl<'__a> ::serde::Serialize for TwapDetailsView<'__a> {
23186            fn serialize<__S: ::serde::Serializer>(
23187                &self,
23188                __s: __S,
23189            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23190                use ::serde::ser::SerializeMap as _;
23191                let mut __map = __s.serialize_map(::core::option::Option::None)?;
23192                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.twap_duration_ms) {
23193                    __map
23194                        .serialize_entry(
23195                            "twapDurationMs",
23196                            &::buffa::json_helpers::ProtoJson(&self.twap_duration_ms),
23197                        )?;
23198                }
23199                if !::buffa::json_helpers::skip_if::is_zero_i64(
23200                    &self.twap_slice_interval_ms,
23201                ) {
23202                    __map
23203                        .serialize_entry(
23204                            "twapSliceIntervalMs",
23205                            &::buffa::json_helpers::ProtoJson(
23206                                &self.twap_slice_interval_ms,
23207                            ),
23208                        )?;
23209                }
23210                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.slice_idx) {
23211                    __map
23212                        .serialize_entry(
23213                            "sliceIdx",
23214                            &::buffa::json_helpers::ProtoJson(&self.slice_idx),
23215                        )?;
23216                }
23217                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.slice_count) {
23218                    __map
23219                        .serialize_entry(
23220                            "sliceCount",
23221                            &::buffa::json_helpers::ProtoJson(&self.slice_count),
23222                        )?;
23223                }
23224                if !::buffa::json_helpers::skip_if::is_zero_i64(
23225                    &self.executed_qty_scaled,
23226                ) {
23227                    __map
23228                        .serialize_entry(
23229                            "executedQtyScaled",
23230                            &::buffa::json_helpers::ProtoJson(&self.executed_qty_scaled),
23231                        )?;
23232                }
23233                __map.end()
23234            }
23235        }
23236        impl<'a> ::buffa::MessageName for TwapDetailsView<'a> {
23237            const PACKAGE: &'static str = "triggers.v1";
23238            const NAME: &'static str = "TwapDetails";
23239            const FULL_NAME: &'static str = "triggers.v1.TwapDetails";
23240            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
23241        }
23242        ::buffa::impl_default_view_instance!(TwapDetailsView);
23243        ::buffa::impl_view_reborrow!(TwapDetailsView);
23244        /** Self-contained, `'static` owned view of a `TwapDetails` message.
23245
23246 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.
23247
23248 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.*/
23249        #[derive(Clone, Debug)]
23250        pub struct TwapDetailsOwnedView(::buffa::OwnedView<TwapDetailsView<'static>>);
23251        impl TwapDetailsOwnedView {
23252            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
23253            ///
23254            /// The view borrows directly from the buffer's data; the buffer is
23255            /// retained inside the returned handle.
23256            ///
23257            /// # Errors
23258            ///
23259            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
23260            /// protobuf data.
23261            pub fn decode(
23262                bytes: ::buffa::bytes::Bytes,
23263            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23264                ::core::result::Result::Ok(
23265                    TwapDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
23266                )
23267            }
23268            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
23269            /// max message size).
23270            ///
23271            /// # Errors
23272            ///
23273            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
23274            /// exceeds the configured limits.
23275            pub fn decode_with_options(
23276                bytes: ::buffa::bytes::Bytes,
23277                opts: &::buffa::DecodeOptions,
23278            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23279                ::core::result::Result::Ok(
23280                    TwapDetailsOwnedView(
23281                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
23282                    ),
23283                )
23284            }
23285            /// Build from an owned message via an encode → decode round-trip.
23286            ///
23287            /// # Errors
23288            ///
23289            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
23290            /// somehow invalid (should not happen for well-formed messages).
23291            pub fn from_owned(
23292                msg: &super::super::TwapDetails,
23293            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23294                ::core::result::Result::Ok(
23295                    TwapDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
23296                )
23297            }
23298            /// Borrow the full [`TwapDetailsView`] with its lifetime tied to `&self`.
23299            #[must_use]
23300            pub fn view(&self) -> &TwapDetailsView<'_> {
23301                self.0.reborrow()
23302            }
23303            /// Convert to the owned message type.
23304            ///
23305            /// # Errors
23306            ///
23307            /// Returns an error if re-materializing preserved unknown fields
23308            /// fails (e.g. the unknown-field limit is exceeded).
23309            pub fn to_owned_message(
23310                &self,
23311            ) -> ::core::result::Result<
23312                super::super::TwapDetails,
23313                ::buffa::DecodeError,
23314            > {
23315                self.0.to_owned_message()
23316            }
23317            /// The underlying bytes buffer.
23318            #[must_use]
23319            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
23320                self.0.bytes()
23321            }
23322            /// Consume the handle, returning the underlying bytes buffer.
23323            #[must_use]
23324            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
23325                self.0.into_bytes()
23326            }
23327            /// Total duration of TWAP execution in milliseconds.
23328            ///
23329            /// Field 1: `twap_duration_ms`
23330            #[must_use]
23331            pub fn twap_duration_ms(&self) -> i64 {
23332                self.0.reborrow().twap_duration_ms
23333            }
23334            /// Interval between TWAP slices in milliseconds.
23335            ///
23336            /// Field 2: `twap_slice_interval_ms`
23337            #[must_use]
23338            pub fn twap_slice_interval_ms(&self) -> i64 {
23339                self.0.reborrow().twap_slice_interval_ms
23340            }
23341            /// Current slice index, zero-based.
23342            ///
23343            /// Field 4: `slice_idx`
23344            #[must_use]
23345            pub fn slice_idx(&self) -> i32 {
23346                self.0.reborrow().slice_idx
23347            }
23348            /// Total number of planned slices.
23349            ///
23350            /// Field 5: `slice_count`
23351            #[must_use]
23352            pub fn slice_count(&self) -> i32 {
23353                self.0.reborrow().slice_count
23354            }
23355            /// Cumulative filled child-order base quantity scaled by the pair's
23356            /// base_quantity_scale from GetSpotConfig.
23357            ///
23358            /// Field 6: `executed_qty_scaled`
23359            #[must_use]
23360            pub fn executed_qty_scaled(&self) -> i64 {
23361                self.0.reborrow().executed_qty_scaled
23362            }
23363        }
23364        impl ::core::convert::From<::buffa::OwnedView<TwapDetailsView<'static>>>
23365        for TwapDetailsOwnedView {
23366            fn from(inner: ::buffa::OwnedView<TwapDetailsView<'static>>) -> Self {
23367                TwapDetailsOwnedView(inner)
23368            }
23369        }
23370        impl ::core::convert::From<TwapDetailsOwnedView>
23371        for ::buffa::OwnedView<TwapDetailsView<'static>> {
23372            fn from(wrapper: TwapDetailsOwnedView) -> Self {
23373                wrapper.0
23374            }
23375        }
23376        impl ::core::convert::AsRef<::buffa::OwnedView<TwapDetailsView<'static>>>
23377        for TwapDetailsOwnedView {
23378            fn as_ref(&self) -> &::buffa::OwnedView<TwapDetailsView<'static>> {
23379                &self.0
23380            }
23381        }
23382        impl ::buffa::HasMessageView for super::super::TwapDetails {
23383            type View<'a> = TwapDetailsView<'a>;
23384            type ViewHandle = TwapDetailsOwnedView;
23385        }
23386        impl ::serde::Serialize for TwapDetailsOwnedView {
23387            fn serialize<__S: ::serde::Serializer>(
23388                &self,
23389                __s: __S,
23390            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23391                ::serde::Serialize::serialize(&self.0, __s)
23392            }
23393        }
23394        /// LadderDetails contains configuration for LADDER triggers.
23395        #[derive(Clone, Debug, Default)]
23396        pub struct LadderDetailsView<'a> {
23397            /// Minimum price in quote units scaled by 1e6 for the ladder range.
23398            ///
23399            /// Field 1: `ladder_price_min_ticks`
23400            pub ladder_price_min_ticks: i64,
23401            /// Maximum price in quote units scaled by 1e6 for the ladder range.
23402            ///
23403            /// Field 2: `ladder_price_max_ticks`
23404            pub ladder_price_max_ticks: i64,
23405            /// Number of price levels in the ladder.
23406            ///
23407            /// Field 3: `ladder_levels`
23408            pub ladder_levels: i32,
23409            /// Quantity distribution across ladder levels.
23410            ///
23411            /// Field 4: `ladder_distribution`
23412            pub ladder_distribution: ::buffa::EnumValue<
23413                super::super::LadderDistribution,
23414            >,
23415            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
23416        }
23417        impl<'a> ::buffa::MessageView<'a> for LadderDetailsView<'a> {
23418            type Owned = super::super::LadderDetails;
23419            fn decode_view(
23420                buf: &'a [u8],
23421            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23422                let __limit = ::core::cell::Cell::new(
23423                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23424                );
23425                <Self as ::buffa::MessageView>::decode_view_ctx(
23426                    buf,
23427                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23428                )
23429            }
23430            fn decode_view_with_ctx(
23431                buf: &'a [u8],
23432                ctx: ::buffa::DecodeContext<'_>,
23433            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23434                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23435            }
23436            fn merge_view_field(
23437                &mut self,
23438                tag: ::buffa::encoding::Tag,
23439                cur: &'a [u8],
23440                before_tag: &'a [u8],
23441                ctx: ::buffa::DecodeContext<'_>,
23442            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23443                let _ = ctx;
23444                #[allow(unused_variables)]
23445                let view = self;
23446                let mut cur = cur;
23447                match tag.field_number() {
23448                    1u32 => {
23449                        ::buffa::encoding::check_wire_type(
23450                            tag,
23451                            ::buffa::encoding::WireType::Varint,
23452                        )?;
23453                        view.ladder_price_min_ticks = ::buffa::types::decode_int64(
23454                            &mut cur,
23455                        )?;
23456                    }
23457                    2u32 => {
23458                        ::buffa::encoding::check_wire_type(
23459                            tag,
23460                            ::buffa::encoding::WireType::Varint,
23461                        )?;
23462                        view.ladder_price_max_ticks = ::buffa::types::decode_int64(
23463                            &mut cur,
23464                        )?;
23465                    }
23466                    3u32 => {
23467                        ::buffa::encoding::check_wire_type(
23468                            tag,
23469                            ::buffa::encoding::WireType::Varint,
23470                        )?;
23471                        view.ladder_levels = ::buffa::types::decode_int32(&mut cur)?;
23472                    }
23473                    4u32 => {
23474                        ::buffa::encoding::check_wire_type(
23475                            tag,
23476                            ::buffa::encoding::WireType::Varint,
23477                        )?;
23478                        view.ladder_distribution = ::buffa::EnumValue::from(
23479                            ::buffa::types::decode_int32(&mut cur)?,
23480                        );
23481                    }
23482                    _ => {
23483                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
23484                        let span_len = before_tag.len() - cur.len();
23485                        view.__buffa_unknown_fields
23486                            .push_record(before_tag, span_len, ctx)?;
23487                    }
23488                }
23489                ::core::result::Result::Ok(cur)
23490            }
23491            fn to_owned_message(
23492                &self,
23493            ) -> ::core::result::Result<
23494                super::super::LadderDetails,
23495                ::buffa::DecodeError,
23496            > {
23497                self.to_owned_from_source(None)
23498            }
23499            #[allow(clippy::useless_conversion, clippy::needless_update)]
23500            fn to_owned_from_source(
23501                &self,
23502                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
23503            ) -> ::core::result::Result<
23504                super::super::LadderDetails,
23505                ::buffa::DecodeError,
23506            > {
23507                #[allow(unused_imports)]
23508                use ::buffa::alloc::string::ToString as _;
23509                let _ = __buffa_src;
23510                ::core::result::Result::Ok(super::super::LadderDetails {
23511                    ladder_price_min_ticks: self.ladder_price_min_ticks,
23512                    ladder_price_max_ticks: self.ladder_price_max_ticks,
23513                    ladder_levels: self.ladder_levels,
23514                    ladder_distribution: self.ladder_distribution,
23515                    __buffa_unknown_fields: self
23516                        .__buffa_unknown_fields
23517                        .to_owned()?
23518                        .into(),
23519                    ..::core::default::Default::default()
23520                })
23521            }
23522        }
23523        impl<'a> ::buffa::ViewEncode<'a> for LadderDetailsView<'a> {
23524            #[allow(clippy::needless_borrow, clippy::let_and_return)]
23525            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
23526                #[allow(unused_imports)]
23527                use ::buffa::Enumeration as _;
23528                let mut size = 0u32;
23529                if self.ladder_price_min_ticks != 0i64 {
23530                    size
23531                        += 1u32
23532                            + ::buffa::types::int64_encoded_len(
23533                                self.ladder_price_min_ticks,
23534                            ) as u32;
23535                }
23536                if self.ladder_price_max_ticks != 0i64 {
23537                    size
23538                        += 1u32
23539                            + ::buffa::types::int64_encoded_len(
23540                                self.ladder_price_max_ticks,
23541                            ) as u32;
23542                }
23543                if self.ladder_levels != 0i32 {
23544                    size
23545                        += 1u32
23546                            + ::buffa::types::int32_encoded_len(self.ladder_levels)
23547                                as u32;
23548                }
23549                {
23550                    let val = self.ladder_distribution.to_i32();
23551                    if val != 0 {
23552                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
23553                    }
23554                }
23555                size += self.__buffa_unknown_fields.encoded_len() as u32;
23556                size
23557            }
23558            #[allow(clippy::needless_borrow)]
23559            fn write_to(
23560                &self,
23561                _cache: &mut ::buffa::SizeCache,
23562                buf: &mut impl ::buffa::bytes::BufMut,
23563            ) {
23564                #[allow(unused_imports)]
23565                use ::buffa::Enumeration as _;
23566                if self.ladder_price_min_ticks != 0i64 {
23567                    ::buffa::types::put_int64_field(
23568                        1u32,
23569                        self.ladder_price_min_ticks,
23570                        buf,
23571                    );
23572                }
23573                if self.ladder_price_max_ticks != 0i64 {
23574                    ::buffa::types::put_int64_field(
23575                        2u32,
23576                        self.ladder_price_max_ticks,
23577                        buf,
23578                    );
23579                }
23580                if self.ladder_levels != 0i32 {
23581                    ::buffa::types::put_int32_field(3u32, self.ladder_levels, buf);
23582                }
23583                {
23584                    let val = self.ladder_distribution.to_i32();
23585                    if val != 0 {
23586                        ::buffa::types::put_int32_field(4u32, val, buf);
23587                    }
23588                }
23589                self.__buffa_unknown_fields.write_to(buf);
23590            }
23591        }
23592        /// Serializes this view as protobuf JSON.
23593        ///
23594        /// Implicit-presence fields with default values are omitted, `required`
23595        /// fields are always emitted, explicit-presence (`optional`) fields are
23596        /// emitted only when set, bytes fields are base64-encoded, and enum
23597        /// values are their proto name strings.
23598        ///
23599        /// This impl uses `serialize_map(None)` because the number of emitted
23600        /// fields depends on default-omission rules; serializers that require
23601        /// known map lengths (e.g. `bincode`) will return a runtime error.
23602        /// Use the owned message type for those formats.
23603        impl<'__a> ::serde::Serialize for LadderDetailsView<'__a> {
23604            fn serialize<__S: ::serde::Serializer>(
23605                &self,
23606                __s: __S,
23607            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23608                use ::serde::ser::SerializeMap as _;
23609                let mut __map = __s.serialize_map(::core::option::Option::None)?;
23610                if !::buffa::json_helpers::skip_if::is_zero_i64(
23611                    &self.ladder_price_min_ticks,
23612                ) {
23613                    __map
23614                        .serialize_entry(
23615                            "ladderPriceMinTicks",
23616                            &::buffa::json_helpers::ProtoJson(
23617                                &self.ladder_price_min_ticks,
23618                            ),
23619                        )?;
23620                }
23621                if !::buffa::json_helpers::skip_if::is_zero_i64(
23622                    &self.ladder_price_max_ticks,
23623                ) {
23624                    __map
23625                        .serialize_entry(
23626                            "ladderPriceMaxTicks",
23627                            &::buffa::json_helpers::ProtoJson(
23628                                &self.ladder_price_max_ticks,
23629                            ),
23630                        )?;
23631                }
23632                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.ladder_levels) {
23633                    __map
23634                        .serialize_entry(
23635                            "ladderLevels",
23636                            &::buffa::json_helpers::ProtoJson(&self.ladder_levels),
23637                        )?;
23638                }
23639                if !::buffa::json_helpers::skip_if::is_default_enum_value(
23640                    &self.ladder_distribution,
23641                ) {
23642                    __map
23643                        .serialize_entry(
23644                            "ladderDistribution",
23645                            &self.ladder_distribution,
23646                        )?;
23647                }
23648                __map.end()
23649            }
23650        }
23651        impl<'a> ::buffa::MessageName for LadderDetailsView<'a> {
23652            const PACKAGE: &'static str = "triggers.v1";
23653            const NAME: &'static str = "LadderDetails";
23654            const FULL_NAME: &'static str = "triggers.v1.LadderDetails";
23655            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
23656        }
23657        ::buffa::impl_default_view_instance!(LadderDetailsView);
23658        ::buffa::impl_view_reborrow!(LadderDetailsView);
23659        /** Self-contained, `'static` owned view of a `LadderDetails` message.
23660
23661 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.
23662
23663 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.*/
23664        #[derive(Clone, Debug)]
23665        pub struct LadderDetailsOwnedView(
23666            ::buffa::OwnedView<LadderDetailsView<'static>>,
23667        );
23668        impl LadderDetailsOwnedView {
23669            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
23670            ///
23671            /// The view borrows directly from the buffer's data; the buffer is
23672            /// retained inside the returned handle.
23673            ///
23674            /// # Errors
23675            ///
23676            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
23677            /// protobuf data.
23678            pub fn decode(
23679                bytes: ::buffa::bytes::Bytes,
23680            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23681                ::core::result::Result::Ok(
23682                    LadderDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
23683                )
23684            }
23685            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
23686            /// max message size).
23687            ///
23688            /// # Errors
23689            ///
23690            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
23691            /// exceeds the configured limits.
23692            pub fn decode_with_options(
23693                bytes: ::buffa::bytes::Bytes,
23694                opts: &::buffa::DecodeOptions,
23695            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23696                ::core::result::Result::Ok(
23697                    LadderDetailsOwnedView(
23698                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
23699                    ),
23700                )
23701            }
23702            /// Build from an owned message via an encode → decode round-trip.
23703            ///
23704            /// # Errors
23705            ///
23706            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
23707            /// somehow invalid (should not happen for well-formed messages).
23708            pub fn from_owned(
23709                msg: &super::super::LadderDetails,
23710            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23711                ::core::result::Result::Ok(
23712                    LadderDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
23713                )
23714            }
23715            /// Borrow the full [`LadderDetailsView`] with its lifetime tied to `&self`.
23716            #[must_use]
23717            pub fn view(&self) -> &LadderDetailsView<'_> {
23718                self.0.reborrow()
23719            }
23720            /// Convert to the owned message type.
23721            ///
23722            /// # Errors
23723            ///
23724            /// Returns an error if re-materializing preserved unknown fields
23725            /// fails (e.g. the unknown-field limit is exceeded).
23726            pub fn to_owned_message(
23727                &self,
23728            ) -> ::core::result::Result<
23729                super::super::LadderDetails,
23730                ::buffa::DecodeError,
23731            > {
23732                self.0.to_owned_message()
23733            }
23734            /// The underlying bytes buffer.
23735            #[must_use]
23736            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
23737                self.0.bytes()
23738            }
23739            /// Consume the handle, returning the underlying bytes buffer.
23740            #[must_use]
23741            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
23742                self.0.into_bytes()
23743            }
23744            /// Minimum price in quote units scaled by 1e6 for the ladder range.
23745            ///
23746            /// Field 1: `ladder_price_min_ticks`
23747            #[must_use]
23748            pub fn ladder_price_min_ticks(&self) -> i64 {
23749                self.0.reborrow().ladder_price_min_ticks
23750            }
23751            /// Maximum price in quote units scaled by 1e6 for the ladder range.
23752            ///
23753            /// Field 2: `ladder_price_max_ticks`
23754            #[must_use]
23755            pub fn ladder_price_max_ticks(&self) -> i64 {
23756                self.0.reborrow().ladder_price_max_ticks
23757            }
23758            /// Number of price levels in the ladder.
23759            ///
23760            /// Field 3: `ladder_levels`
23761            #[must_use]
23762            pub fn ladder_levels(&self) -> i32 {
23763                self.0.reborrow().ladder_levels
23764            }
23765            /// Quantity distribution across ladder levels.
23766            ///
23767            /// Field 4: `ladder_distribution`
23768            #[must_use]
23769            pub fn ladder_distribution(
23770                &self,
23771            ) -> ::buffa::EnumValue<super::super::LadderDistribution> {
23772                self.0.reborrow().ladder_distribution
23773            }
23774        }
23775        impl ::core::convert::From<::buffa::OwnedView<LadderDetailsView<'static>>>
23776        for LadderDetailsOwnedView {
23777            fn from(inner: ::buffa::OwnedView<LadderDetailsView<'static>>) -> Self {
23778                LadderDetailsOwnedView(inner)
23779            }
23780        }
23781        impl ::core::convert::From<LadderDetailsOwnedView>
23782        for ::buffa::OwnedView<LadderDetailsView<'static>> {
23783            fn from(wrapper: LadderDetailsOwnedView) -> Self {
23784                wrapper.0
23785            }
23786        }
23787        impl ::core::convert::AsRef<::buffa::OwnedView<LadderDetailsView<'static>>>
23788        for LadderDetailsOwnedView {
23789            fn as_ref(&self) -> &::buffa::OwnedView<LadderDetailsView<'static>> {
23790                &self.0
23791            }
23792        }
23793        impl ::buffa::HasMessageView for super::super::LadderDetails {
23794            type View<'a> = LadderDetailsView<'a>;
23795            type ViewHandle = LadderDetailsOwnedView;
23796        }
23797        impl ::serde::Serialize for LadderDetailsOwnedView {
23798            fn serialize<__S: ::serde::Serializer>(
23799                &self,
23800                __s: __S,
23801            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23802                ::serde::Serialize::serialize(&self.0, __s)
23803            }
23804        }
23805        /// Trigger represents current trigger configuration, lifecycle state, and
23806        /// aggregate strategy progress. Use ListTriggerEvents to enumerate child-order
23807        /// actions and inspect append-only lifecycle history.
23808        #[derive(Clone, Debug, Default)]
23809        pub struct TriggerView<'a> {
23810            /// Trigger ID.
23811            ///
23812            /// Field 1: `trigger_id`
23813            pub trigger_id: u64,
23814            /// Public account or sub-account ID associated with the trigger.
23815            ///
23816            /// Field 2: `subaccount_id`
23817            pub subaccount_id: u64,
23818            /// Trading symbol numeric identifier.
23819            ///
23820            /// Field 3: `symbol_id`
23821            pub symbol_id: u32,
23822            /// Trading symbol, for example "BTC-USDT".
23823            ///
23824            /// Field 4: `symbol`
23825            pub symbol: &'a str,
23826            /// Current trigger lifecycle status.
23827            ///
23828            /// Field 5: `status`
23829            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
23830            /// Parent order ID for attached-risk triggers; empty for standalone triggers.
23831            ///
23832            /// Field 6: `parent_order_id`
23833            pub parent_order_id: ::core::option::Option<u64>,
23834            /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
23835            ///
23836            /// Field 20: `qty_scaled`
23837            pub qty_scaled: i64,
23838            /// Fee asset for BUY child orders.
23839            ///
23840            /// Field 21: `fee_asset`
23841            pub fee_asset: ::buffa::EnumValue<
23842                super::super::super::super::orders::v1::FeeAsset,
23843            >,
23844            /// Self-trade prevention mode for child orders.
23845            ///
23846            /// Field 22: `self_trade_prevention_mode`
23847            pub self_trade_prevention_mode: ::buffa::EnumValue<
23848                super::super::super::super::orders::v1::SelfTradePreventionMode,
23849            >,
23850            /// Client-provided trigger ID for idempotency and correlation.
23851            ///
23852            /// Field 60: `client_trigger_id`
23853            pub client_trigger_id: &'a str,
23854            /// Creation timestamp.
23855            ///
23856            /// Field 61: `created_at`
23857            pub created_at: ::buffa::MessageFieldView<
23858                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23859            >,
23860            /// Last update timestamp.
23861            ///
23862            /// Field 62: `updated_at`
23863            pub updated_at: ::buffa::MessageFieldView<
23864                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23865            >,
23866            /// Timestamp when the trigger became armed.
23867            ///
23868            /// Field 63: `armed_at`
23869            pub armed_at: ::buffa::MessageFieldView<
23870                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23871            >,
23872            /// Timestamp when the trigger reached a terminal successful state.
23873            ///
23874            /// Field 64: `completed_at`
23875            pub completed_at: ::buffa::MessageFieldView<
23876                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23877            >,
23878            pub configuration: ::core::option::Option<
23879                super::super::__buffa::view::oneof::trigger::Configuration<'a>,
23880            >,
23881            pub runtime_details: ::core::option::Option<
23882                super::super::__buffa::view::oneof::trigger::RuntimeDetails<'a>,
23883            >,
23884            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
23885        }
23886        impl<'a> ::buffa::MessageView<'a> for TriggerView<'a> {
23887            type Owned = super::super::Trigger;
23888            fn decode_view(
23889                buf: &'a [u8],
23890            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23891                let __limit = ::core::cell::Cell::new(
23892                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23893                );
23894                <Self as ::buffa::MessageView>::decode_view_ctx(
23895                    buf,
23896                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23897                )
23898            }
23899            fn decode_view_with_ctx(
23900                buf: &'a [u8],
23901                ctx: ::buffa::DecodeContext<'_>,
23902            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23903                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23904            }
23905            fn merge_view_field(
23906                &mut self,
23907                tag: ::buffa::encoding::Tag,
23908                cur: &'a [u8],
23909                before_tag: &'a [u8],
23910                ctx: ::buffa::DecodeContext<'_>,
23911            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23912                let _ = ctx;
23913                #[allow(unused_variables)]
23914                let view = self;
23915                let mut cur = cur;
23916                match tag.field_number() {
23917                    1u32 => {
23918                        ::buffa::encoding::check_wire_type(
23919                            tag,
23920                            ::buffa::encoding::WireType::Fixed64,
23921                        )?;
23922                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
23923                    }
23924                    2u32 => {
23925                        ::buffa::encoding::check_wire_type(
23926                            tag,
23927                            ::buffa::encoding::WireType::Fixed64,
23928                        )?;
23929                        view.subaccount_id = ::buffa::types::decode_fixed64(&mut cur)?;
23930                    }
23931                    3u32 => {
23932                        ::buffa::encoding::check_wire_type(
23933                            tag,
23934                            ::buffa::encoding::WireType::Varint,
23935                        )?;
23936                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
23937                    }
23938                    4u32 => {
23939                        ::buffa::encoding::check_wire_type(
23940                            tag,
23941                            ::buffa::encoding::WireType::LengthDelimited,
23942                        )?;
23943                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
23944                    }
23945                    5u32 => {
23946                        ::buffa::encoding::check_wire_type(
23947                            tag,
23948                            ::buffa::encoding::WireType::Varint,
23949                        )?;
23950                        view.status = ::buffa::EnumValue::from(
23951                            ::buffa::types::decode_int32(&mut cur)?,
23952                        );
23953                    }
23954                    6u32 => {
23955                        ::buffa::encoding::check_wire_type(
23956                            tag,
23957                            ::buffa::encoding::WireType::Fixed64,
23958                        )?;
23959                        view.parent_order_id = Some(
23960                            ::buffa::types::decode_fixed64(&mut cur)?,
23961                        );
23962                    }
23963                    20u32 => {
23964                        ::buffa::encoding::check_wire_type(
23965                            tag,
23966                            ::buffa::encoding::WireType::Varint,
23967                        )?;
23968                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
23969                    }
23970                    21u32 => {
23971                        ::buffa::encoding::check_wire_type(
23972                            tag,
23973                            ::buffa::encoding::WireType::Varint,
23974                        )?;
23975                        view.fee_asset = ::buffa::EnumValue::from(
23976                            ::buffa::types::decode_int32(&mut cur)?,
23977                        );
23978                    }
23979                    22u32 => {
23980                        ::buffa::encoding::check_wire_type(
23981                            tag,
23982                            ::buffa::encoding::WireType::Varint,
23983                        )?;
23984                        view.self_trade_prevention_mode = ::buffa::EnumValue::from(
23985                            ::buffa::types::decode_int32(&mut cur)?,
23986                        );
23987                    }
23988                    60u32 => {
23989                        ::buffa::encoding::check_wire_type(
23990                            tag,
23991                            ::buffa::encoding::WireType::LengthDelimited,
23992                        )?;
23993                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
23994                    }
23995                    61u32 => {
23996                        ::buffa::encoding::check_wire_type(
23997                            tag,
23998                            ::buffa::encoding::WireType::LengthDelimited,
23999                        )?;
24000                        let __sub_ctx = ctx.descend()?;
24001                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24002                        match view.created_at.as_mut() {
24003                            Some(existing) => {
24004                                ::buffa::MessageView::merge_into_view(
24005                                    existing,
24006                                    sub,
24007                                    __sub_ctx,
24008                                )?
24009                            }
24010                            None => {
24011                                view.created_at = ::buffa::MessageFieldView::set(
24012                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24013                                        sub,
24014                                        __sub_ctx,
24015                                    )?,
24016                                );
24017                            }
24018                        }
24019                    }
24020                    62u32 => {
24021                        ::buffa::encoding::check_wire_type(
24022                            tag,
24023                            ::buffa::encoding::WireType::LengthDelimited,
24024                        )?;
24025                        let __sub_ctx = ctx.descend()?;
24026                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24027                        match view.updated_at.as_mut() {
24028                            Some(existing) => {
24029                                ::buffa::MessageView::merge_into_view(
24030                                    existing,
24031                                    sub,
24032                                    __sub_ctx,
24033                                )?
24034                            }
24035                            None => {
24036                                view.updated_at = ::buffa::MessageFieldView::set(
24037                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24038                                        sub,
24039                                        __sub_ctx,
24040                                    )?,
24041                                );
24042                            }
24043                        }
24044                    }
24045                    63u32 => {
24046                        ::buffa::encoding::check_wire_type(
24047                            tag,
24048                            ::buffa::encoding::WireType::LengthDelimited,
24049                        )?;
24050                        let __sub_ctx = ctx.descend()?;
24051                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24052                        match view.armed_at.as_mut() {
24053                            Some(existing) => {
24054                                ::buffa::MessageView::merge_into_view(
24055                                    existing,
24056                                    sub,
24057                                    __sub_ctx,
24058                                )?
24059                            }
24060                            None => {
24061                                view.armed_at = ::buffa::MessageFieldView::set(
24062                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24063                                        sub,
24064                                        __sub_ctx,
24065                                    )?,
24066                                );
24067                            }
24068                        }
24069                    }
24070                    64u32 => {
24071                        ::buffa::encoding::check_wire_type(
24072                            tag,
24073                            ::buffa::encoding::WireType::LengthDelimited,
24074                        )?;
24075                        let __sub_ctx = ctx.descend()?;
24076                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24077                        match view.completed_at.as_mut() {
24078                            Some(existing) => {
24079                                ::buffa::MessageView::merge_into_view(
24080                                    existing,
24081                                    sub,
24082                                    __sub_ctx,
24083                                )?
24084                            }
24085                            None => {
24086                                view.completed_at = ::buffa::MessageFieldView::set(
24087                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24088                                        sub,
24089                                        __sub_ctx,
24090                                    )?,
24091                                );
24092                            }
24093                        }
24094                    }
24095                    30u32 => {
24096                        ::buffa::encoding::check_wire_type(
24097                            tag,
24098                            ::buffa::encoding::WireType::LengthDelimited,
24099                        )?;
24100                        let __sub_ctx = ctx.descend()?;
24101                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24102                        if let Some(
24103                            super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24104                                ref mut existing,
24105                            ),
24106                        ) = view.configuration
24107                        {
24108                            ::buffa::MessageView::merge_into_view(
24109                                &mut **existing,
24110                                sub,
24111                                __sub_ctx,
24112                            )?;
24113                        } else {
24114                            view.configuration = Some(
24115                                super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24116                                    ::buffa::alloc::boxed::Box::new(
24117                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
24118                                            sub,
24119                                            __sub_ctx,
24120                                        )?,
24121                                    ),
24122                                ),
24123                            );
24124                        }
24125                    }
24126                    31u32 => {
24127                        ::buffa::encoding::check_wire_type(
24128                            tag,
24129                            ::buffa::encoding::WireType::LengthDelimited,
24130                        )?;
24131                        let __sub_ctx = ctx.descend()?;
24132                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24133                        if let Some(
24134                            super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24135                                ref mut existing,
24136                            ),
24137                        ) = view.configuration
24138                        {
24139                            ::buffa::MessageView::merge_into_view(
24140                                &mut **existing,
24141                                sub,
24142                                __sub_ctx,
24143                            )?;
24144                        } else {
24145                            view.configuration = Some(
24146                                super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24147                                    ::buffa::alloc::boxed::Box::new(
24148                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
24149                                            sub,
24150                                            __sub_ctx,
24151                                        )?,
24152                                    ),
24153                                ),
24154                            );
24155                        }
24156                    }
24157                    32u32 => {
24158                        ::buffa::encoding::check_wire_type(
24159                            tag,
24160                            ::buffa::encoding::WireType::LengthDelimited,
24161                        )?;
24162                        let __sub_ctx = ctx.descend()?;
24163                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24164                        if let Some(
24165                            super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24166                                ref mut existing,
24167                            ),
24168                        ) = view.configuration
24169                        {
24170                            ::buffa::MessageView::merge_into_view(
24171                                &mut **existing,
24172                                sub,
24173                                __sub_ctx,
24174                            )?;
24175                        } else {
24176                            view.configuration = Some(
24177                                super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24178                                    ::buffa::alloc::boxed::Box::new(
24179                                        <super::super::__buffa::view::TrailingStopTriggerView as ::buffa::MessageView>::decode_view_ctx(
24180                                            sub,
24181                                            __sub_ctx,
24182                                        )?,
24183                                    ),
24184                                ),
24185                            );
24186                        }
24187                    }
24188                    33u32 => {
24189                        ::buffa::encoding::check_wire_type(
24190                            tag,
24191                            ::buffa::encoding::WireType::LengthDelimited,
24192                        )?;
24193                        let __sub_ctx = ctx.descend()?;
24194                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24195                        if let Some(
24196                            super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24197                                ref mut existing,
24198                            ),
24199                        ) = view.configuration
24200                        {
24201                            ::buffa::MessageView::merge_into_view(
24202                                &mut **existing,
24203                                sub,
24204                                __sub_ctx,
24205                            )?;
24206                        } else {
24207                            view.configuration = Some(
24208                                super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24209                                    ::buffa::alloc::boxed::Box::new(
24210                                        <super::super::__buffa::view::TwapTriggerView as ::buffa::MessageView>::decode_view_ctx(
24211                                            sub,
24212                                            __sub_ctx,
24213                                        )?,
24214                                    ),
24215                                ),
24216                            );
24217                        }
24218                    }
24219                    34u32 => {
24220                        ::buffa::encoding::check_wire_type(
24221                            tag,
24222                            ::buffa::encoding::WireType::LengthDelimited,
24223                        )?;
24224                        let __sub_ctx = ctx.descend()?;
24225                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24226                        if let Some(
24227                            super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24228                                ref mut existing,
24229                            ),
24230                        ) = view.configuration
24231                        {
24232                            ::buffa::MessageView::merge_into_view(
24233                                &mut **existing,
24234                                sub,
24235                                __sub_ctx,
24236                            )?;
24237                        } else {
24238                            view.configuration = Some(
24239                                super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24240                                    ::buffa::alloc::boxed::Box::new(
24241                                        <super::super::__buffa::view::LadderTriggerView as ::buffa::MessageView>::decode_view_ctx(
24242                                            sub,
24243                                            __sub_ctx,
24244                                        )?,
24245                                    ),
24246                                ),
24247                            );
24248                        }
24249                    }
24250                    100u32 => {
24251                        ::buffa::encoding::check_wire_type(
24252                            tag,
24253                            ::buffa::encoding::WireType::LengthDelimited,
24254                        )?;
24255                        let __sub_ctx = ctx.descend()?;
24256                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24257                        if let Some(
24258                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24259                                ref mut existing,
24260                            ),
24261                        ) = view.runtime_details
24262                        {
24263                            ::buffa::MessageView::merge_into_view(
24264                                &mut **existing,
24265                                sub,
24266                                __sub_ctx,
24267                            )?;
24268                        } else {
24269                            view.runtime_details = Some(
24270                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24271                                    ::buffa::alloc::boxed::Box::new(
24272                                        <super::super::__buffa::view::StopDetailsView as ::buffa::MessageView>::decode_view_ctx(
24273                                            sub,
24274                                            __sub_ctx,
24275                                        )?,
24276                                    ),
24277                                ),
24278                            );
24279                        }
24280                    }
24281                    101u32 => {
24282                        ::buffa::encoding::check_wire_type(
24283                            tag,
24284                            ::buffa::encoding::WireType::LengthDelimited,
24285                        )?;
24286                        let __sub_ctx = ctx.descend()?;
24287                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24288                        if let Some(
24289                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24290                                ref mut existing,
24291                            ),
24292                        ) = view.runtime_details
24293                        {
24294                            ::buffa::MessageView::merge_into_view(
24295                                &mut **existing,
24296                                sub,
24297                                __sub_ctx,
24298                            )?;
24299                        } else {
24300                            view.runtime_details = Some(
24301                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24302                                    ::buffa::alloc::boxed::Box::new(
24303                                        <super::super::__buffa::view::TrailingDetailsView as ::buffa::MessageView>::decode_view_ctx(
24304                                            sub,
24305                                            __sub_ctx,
24306                                        )?,
24307                                    ),
24308                                ),
24309                            );
24310                        }
24311                    }
24312                    102u32 => {
24313                        ::buffa::encoding::check_wire_type(
24314                            tag,
24315                            ::buffa::encoding::WireType::LengthDelimited,
24316                        )?;
24317                        let __sub_ctx = ctx.descend()?;
24318                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24319                        if let Some(
24320                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24321                                ref mut existing,
24322                            ),
24323                        ) = view.runtime_details
24324                        {
24325                            ::buffa::MessageView::merge_into_view(
24326                                &mut **existing,
24327                                sub,
24328                                __sub_ctx,
24329                            )?;
24330                        } else {
24331                            view.runtime_details = Some(
24332                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24333                                    ::buffa::alloc::boxed::Box::new(
24334                                        <super::super::__buffa::view::TwapDetailsView as ::buffa::MessageView>::decode_view_ctx(
24335                                            sub,
24336                                            __sub_ctx,
24337                                        )?,
24338                                    ),
24339                                ),
24340                            );
24341                        }
24342                    }
24343                    103u32 => {
24344                        ::buffa::encoding::check_wire_type(
24345                            tag,
24346                            ::buffa::encoding::WireType::LengthDelimited,
24347                        )?;
24348                        let __sub_ctx = ctx.descend()?;
24349                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24350                        if let Some(
24351                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24352                                ref mut existing,
24353                            ),
24354                        ) = view.runtime_details
24355                        {
24356                            ::buffa::MessageView::merge_into_view(
24357                                &mut **existing,
24358                                sub,
24359                                __sub_ctx,
24360                            )?;
24361                        } else {
24362                            view.runtime_details = Some(
24363                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24364                                    ::buffa::alloc::boxed::Box::new(
24365                                        <super::super::__buffa::view::LadderDetailsView as ::buffa::MessageView>::decode_view_ctx(
24366                                            sub,
24367                                            __sub_ctx,
24368                                        )?,
24369                                    ),
24370                                ),
24371                            );
24372                        }
24373                    }
24374                    _ => {
24375                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
24376                        let span_len = before_tag.len() - cur.len();
24377                        view.__buffa_unknown_fields
24378                            .push_record(before_tag, span_len, ctx)?;
24379                    }
24380                }
24381                ::core::result::Result::Ok(cur)
24382            }
24383            fn to_owned_message(
24384                &self,
24385            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
24386                self.to_owned_from_source(None)
24387            }
24388            #[allow(clippy::useless_conversion, clippy::needless_update)]
24389            fn to_owned_from_source(
24390                &self,
24391                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
24392            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
24393                #[allow(unused_imports)]
24394                use ::buffa::alloc::string::ToString as _;
24395                let _ = __buffa_src;
24396                ::core::result::Result::Ok(super::super::Trigger {
24397                    trigger_id: self.trigger_id,
24398                    subaccount_id: self.subaccount_id,
24399                    symbol_id: self.symbol_id,
24400                    symbol: self.symbol.to_string(),
24401                    status: self.status,
24402                    parent_order_id: self.parent_order_id,
24403                    qty_scaled: self.qty_scaled,
24404                    fee_asset: self.fee_asset,
24405                    self_trade_prevention_mode: self.self_trade_prevention_mode,
24406                    client_trigger_id: self.client_trigger_id.to_string(),
24407                    created_at: match self.created_at.as_option() {
24408                        Some(v) => {
24409                            ::buffa::MessageField::<
24410                                ::buffa_types::google::protobuf::Timestamp,
24411                            >::some(v.to_owned_from_source(__buffa_src)?)
24412                        }
24413                        None => ::buffa::MessageField::none(),
24414                    },
24415                    updated_at: match self.updated_at.as_option() {
24416                        Some(v) => {
24417                            ::buffa::MessageField::<
24418                                ::buffa_types::google::protobuf::Timestamp,
24419                            >::some(v.to_owned_from_source(__buffa_src)?)
24420                        }
24421                        None => ::buffa::MessageField::none(),
24422                    },
24423                    armed_at: match self.armed_at.as_option() {
24424                        Some(v) => {
24425                            ::buffa::MessageField::<
24426                                ::buffa_types::google::protobuf::Timestamp,
24427                            >::some(v.to_owned_from_source(__buffa_src)?)
24428                        }
24429                        None => ::buffa::MessageField::none(),
24430                    },
24431                    completed_at: match self.completed_at.as_option() {
24432                        Some(v) => {
24433                            ::buffa::MessageField::<
24434                                ::buffa_types::google::protobuf::Timestamp,
24435                            >::some(v.to_owned_from_source(__buffa_src)?)
24436                        }
24437                        None => ::buffa::MessageField::none(),
24438                    },
24439                    configuration: match self.configuration.as_ref() {
24440                        ::core::option::Option::Some(v) => {
24441                            ::core::option::Option::Some(
24442                                match v {
24443                                    super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24444                                        v,
24445                                    ) => {
24446                                        super::super::__buffa::oneof::trigger::Configuration::StopLoss(
24447                                            ::buffa::alloc::boxed::Box::new(
24448                                                v.to_owned_from_source(__buffa_src)?,
24449                                            ),
24450                                        )
24451                                    }
24452                                    super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24453                                        v,
24454                                    ) => {
24455                                        super::super::__buffa::oneof::trigger::Configuration::TakeProfit(
24456                                            ::buffa::alloc::boxed::Box::new(
24457                                                v.to_owned_from_source(__buffa_src)?,
24458                                            ),
24459                                        )
24460                                    }
24461                                    super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24462                                        v,
24463                                    ) => {
24464                                        super::super::__buffa::oneof::trigger::Configuration::TrailingStop(
24465                                            ::buffa::alloc::boxed::Box::new(
24466                                                v.to_owned_from_source(__buffa_src)?,
24467                                            ),
24468                                        )
24469                                    }
24470                                    super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24471                                        v,
24472                                    ) => {
24473                                        super::super::__buffa::oneof::trigger::Configuration::Twap(
24474                                            ::buffa::alloc::boxed::Box::new(
24475                                                v.to_owned_from_source(__buffa_src)?,
24476                                            ),
24477                                        )
24478                                    }
24479                                    super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24480                                        v,
24481                                    ) => {
24482                                        super::super::__buffa::oneof::trigger::Configuration::Ladder(
24483                                            ::buffa::alloc::boxed::Box::new(
24484                                                v.to_owned_from_source(__buffa_src)?,
24485                                            ),
24486                                        )
24487                                    }
24488                                },
24489                            )
24490                        }
24491                        ::core::option::Option::None => ::core::option::Option::None,
24492                    },
24493                    runtime_details: match self.runtime_details.as_ref() {
24494                        ::core::option::Option::Some(v) => {
24495                            ::core::option::Option::Some(
24496                                match v {
24497                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24498                                        v,
24499                                    ) => {
24500                                        super::super::__buffa::oneof::trigger::RuntimeDetails::Stop(
24501                                            ::buffa::alloc::boxed::Box::new(
24502                                                v.to_owned_from_source(__buffa_src)?,
24503                                            ),
24504                                        )
24505                                    }
24506                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24507                                        v,
24508                                    ) => {
24509                                        super::super::__buffa::oneof::trigger::RuntimeDetails::Trailing(
24510                                            ::buffa::alloc::boxed::Box::new(
24511                                                v.to_owned_from_source(__buffa_src)?,
24512                                            ),
24513                                        )
24514                                    }
24515                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24516                                        v,
24517                                    ) => {
24518                                        super::super::__buffa::oneof::trigger::RuntimeDetails::TwapState(
24519                                            ::buffa::alloc::boxed::Box::new(
24520                                                v.to_owned_from_source(__buffa_src)?,
24521                                            ),
24522                                        )
24523                                    }
24524                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24525                                        v,
24526                                    ) => {
24527                                        super::super::__buffa::oneof::trigger::RuntimeDetails::LadderState(
24528                                            ::buffa::alloc::boxed::Box::new(
24529                                                v.to_owned_from_source(__buffa_src)?,
24530                                            ),
24531                                        )
24532                                    }
24533                                },
24534                            )
24535                        }
24536                        ::core::option::Option::None => ::core::option::Option::None,
24537                    },
24538                    __buffa_unknown_fields: self
24539                        .__buffa_unknown_fields
24540                        .to_owned()?
24541                        .into(),
24542                    ..::core::default::Default::default()
24543                })
24544            }
24545        }
24546        impl<'a> ::buffa::ViewEncode<'a> for TriggerView<'a> {
24547            #[allow(clippy::needless_borrow, clippy::let_and_return)]
24548            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
24549                #[allow(unused_imports)]
24550                use ::buffa::Enumeration as _;
24551                let mut size = 0u32;
24552                if self.trigger_id != 0u64 {
24553                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24554                }
24555                if self.subaccount_id != 0u64 {
24556                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24557                }
24558                if self.symbol_id != 0u32 {
24559                    size
24560                        += 1u32
24561                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
24562                }
24563                if !self.symbol.is_empty() {
24564                    size
24565                        += 1u32
24566                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
24567                }
24568                {
24569                    let val = self.status.to_i32();
24570                    if val != 0 {
24571                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
24572                    }
24573                }
24574                if self.parent_order_id.is_some() {
24575                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24576                }
24577                if self.qty_scaled != 0i64 {
24578                    size
24579                        += 2u32
24580                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
24581                }
24582                {
24583                    let val = self.fee_asset.to_i32();
24584                    if val != 0 {
24585                        size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
24586                    }
24587                }
24588                {
24589                    let val = self.self_trade_prevention_mode.to_i32();
24590                    if val != 0 {
24591                        size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
24592                    }
24593                }
24594                if let ::core::option::Option::Some(ref v) = self.configuration {
24595                    match v {
24596                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24597                            x,
24598                        ) => {
24599                            let __slot = __cache.reserve();
24600                            let inner = x.compute_size(__cache);
24601                            __cache.set(__slot, inner);
24602                            size
24603                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24604                                    + inner;
24605                        }
24606                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24607                            x,
24608                        ) => {
24609                            let __slot = __cache.reserve();
24610                            let inner = x.compute_size(__cache);
24611                            __cache.set(__slot, inner);
24612                            size
24613                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24614                                    + inner;
24615                        }
24616                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24617                            x,
24618                        ) => {
24619                            let __slot = __cache.reserve();
24620                            let inner = x.compute_size(__cache);
24621                            __cache.set(__slot, inner);
24622                            size
24623                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24624                                    + inner;
24625                        }
24626                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24627                            x,
24628                        ) => {
24629                            let __slot = __cache.reserve();
24630                            let inner = x.compute_size(__cache);
24631                            __cache.set(__slot, inner);
24632                            size
24633                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24634                                    + inner;
24635                        }
24636                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24637                            x,
24638                        ) => {
24639                            let __slot = __cache.reserve();
24640                            let inner = x.compute_size(__cache);
24641                            __cache.set(__slot, inner);
24642                            size
24643                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24644                                    + inner;
24645                        }
24646                    }
24647                }
24648                if !self.client_trigger_id.is_empty() {
24649                    size
24650                        += 2u32
24651                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
24652                                as u32;
24653                }
24654                if self.created_at.is_set() {
24655                    let __slot = __cache.reserve();
24656                    let inner_size = self.created_at.compute_size(__cache);
24657                    __cache.set(__slot, inner_size);
24658                    size
24659                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24660                            + inner_size;
24661                }
24662                if self.updated_at.is_set() {
24663                    let __slot = __cache.reserve();
24664                    let inner_size = self.updated_at.compute_size(__cache);
24665                    __cache.set(__slot, inner_size);
24666                    size
24667                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24668                            + inner_size;
24669                }
24670                if self.armed_at.is_set() {
24671                    let __slot = __cache.reserve();
24672                    let inner_size = self.armed_at.compute_size(__cache);
24673                    __cache.set(__slot, inner_size);
24674                    size
24675                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24676                            + inner_size;
24677                }
24678                if self.completed_at.is_set() {
24679                    let __slot = __cache.reserve();
24680                    let inner_size = self.completed_at.compute_size(__cache);
24681                    __cache.set(__slot, inner_size);
24682                    size
24683                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24684                            + inner_size;
24685                }
24686                if let ::core::option::Option::Some(ref v) = self.runtime_details {
24687                    match v {
24688                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24689                            x,
24690                        ) => {
24691                            let __slot = __cache.reserve();
24692                            let inner = x.compute_size(__cache);
24693                            __cache.set(__slot, inner);
24694                            size
24695                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24696                                    + inner;
24697                        }
24698                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24699                            x,
24700                        ) => {
24701                            let __slot = __cache.reserve();
24702                            let inner = x.compute_size(__cache);
24703                            __cache.set(__slot, inner);
24704                            size
24705                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24706                                    + inner;
24707                        }
24708                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24709                            x,
24710                        ) => {
24711                            let __slot = __cache.reserve();
24712                            let inner = x.compute_size(__cache);
24713                            __cache.set(__slot, inner);
24714                            size
24715                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24716                                    + inner;
24717                        }
24718                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24719                            x,
24720                        ) => {
24721                            let __slot = __cache.reserve();
24722                            let inner = x.compute_size(__cache);
24723                            __cache.set(__slot, inner);
24724                            size
24725                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24726                                    + inner;
24727                        }
24728                    }
24729                }
24730                size += self.__buffa_unknown_fields.encoded_len() as u32;
24731                size
24732            }
24733            #[allow(clippy::needless_borrow)]
24734            fn write_to(
24735                &self,
24736                __cache: &mut ::buffa::SizeCache,
24737                buf: &mut impl ::buffa::bytes::BufMut,
24738            ) {
24739                #[allow(unused_imports)]
24740                use ::buffa::Enumeration as _;
24741                if self.trigger_id != 0u64 {
24742                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
24743                }
24744                if self.subaccount_id != 0u64 {
24745                    ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
24746                }
24747                if self.symbol_id != 0u32 {
24748                    ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
24749                }
24750                if !self.symbol.is_empty() {
24751                    ::buffa::types::put_string_field(4u32, &self.symbol, buf);
24752                }
24753                {
24754                    let val = self.status.to_i32();
24755                    if val != 0 {
24756                        ::buffa::types::put_int32_field(5u32, val, buf);
24757                    }
24758                }
24759                if let Some(v) = self.parent_order_id {
24760                    ::buffa::types::put_fixed64_field(6u32, v, buf);
24761                }
24762                if self.qty_scaled != 0i64 {
24763                    ::buffa::types::put_int64_field(20u32, self.qty_scaled, buf);
24764                }
24765                {
24766                    let val = self.fee_asset.to_i32();
24767                    if val != 0 {
24768                        ::buffa::types::put_int32_field(21u32, val, buf);
24769                    }
24770                }
24771                {
24772                    let val = self.self_trade_prevention_mode.to_i32();
24773                    if val != 0 {
24774                        ::buffa::types::put_int32_field(22u32, val, buf);
24775                    }
24776                }
24777                if let ::core::option::Option::Some(ref v) = self.configuration {
24778                    match v {
24779                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24780                            x,
24781                        ) => {
24782                            ::buffa::types::put_len_delimited_header(
24783                                30u32,
24784                                __cache.consume_next(),
24785                                buf,
24786                            );
24787                            x.write_to(__cache, buf);
24788                        }
24789                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24790                            x,
24791                        ) => {
24792                            ::buffa::types::put_len_delimited_header(
24793                                31u32,
24794                                __cache.consume_next(),
24795                                buf,
24796                            );
24797                            x.write_to(__cache, buf);
24798                        }
24799                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24800                            x,
24801                        ) => {
24802                            ::buffa::types::put_len_delimited_header(
24803                                32u32,
24804                                __cache.consume_next(),
24805                                buf,
24806                            );
24807                            x.write_to(__cache, buf);
24808                        }
24809                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24810                            x,
24811                        ) => {
24812                            ::buffa::types::put_len_delimited_header(
24813                                33u32,
24814                                __cache.consume_next(),
24815                                buf,
24816                            );
24817                            x.write_to(__cache, buf);
24818                        }
24819                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24820                            x,
24821                        ) => {
24822                            ::buffa::types::put_len_delimited_header(
24823                                34u32,
24824                                __cache.consume_next(),
24825                                buf,
24826                            );
24827                            x.write_to(__cache, buf);
24828                        }
24829                    }
24830                }
24831                if !self.client_trigger_id.is_empty() {
24832                    ::buffa::types::put_string_field(
24833                        60u32,
24834                        &self.client_trigger_id,
24835                        buf,
24836                    );
24837                }
24838                if self.created_at.is_set() {
24839                    ::buffa::types::put_len_delimited_header(
24840                        61u32,
24841                        __cache.consume_next(),
24842                        buf,
24843                    );
24844                    self.created_at.write_to(__cache, buf);
24845                }
24846                if self.updated_at.is_set() {
24847                    ::buffa::types::put_len_delimited_header(
24848                        62u32,
24849                        __cache.consume_next(),
24850                        buf,
24851                    );
24852                    self.updated_at.write_to(__cache, buf);
24853                }
24854                if self.armed_at.is_set() {
24855                    ::buffa::types::put_len_delimited_header(
24856                        63u32,
24857                        __cache.consume_next(),
24858                        buf,
24859                    );
24860                    self.armed_at.write_to(__cache, buf);
24861                }
24862                if self.completed_at.is_set() {
24863                    ::buffa::types::put_len_delimited_header(
24864                        64u32,
24865                        __cache.consume_next(),
24866                        buf,
24867                    );
24868                    self.completed_at.write_to(__cache, buf);
24869                }
24870                if let ::core::option::Option::Some(ref v) = self.runtime_details {
24871                    match v {
24872                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24873                            x,
24874                        ) => {
24875                            ::buffa::types::put_len_delimited_header(
24876                                100u32,
24877                                __cache.consume_next(),
24878                                buf,
24879                            );
24880                            x.write_to(__cache, buf);
24881                        }
24882                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24883                            x,
24884                        ) => {
24885                            ::buffa::types::put_len_delimited_header(
24886                                101u32,
24887                                __cache.consume_next(),
24888                                buf,
24889                            );
24890                            x.write_to(__cache, buf);
24891                        }
24892                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24893                            x,
24894                        ) => {
24895                            ::buffa::types::put_len_delimited_header(
24896                                102u32,
24897                                __cache.consume_next(),
24898                                buf,
24899                            );
24900                            x.write_to(__cache, buf);
24901                        }
24902                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24903                            x,
24904                        ) => {
24905                            ::buffa::types::put_len_delimited_header(
24906                                103u32,
24907                                __cache.consume_next(),
24908                                buf,
24909                            );
24910                            x.write_to(__cache, buf);
24911                        }
24912                    }
24913                }
24914                self.__buffa_unknown_fields.write_to(buf);
24915            }
24916        }
24917        /// Serializes this view as protobuf JSON.
24918        ///
24919        /// Implicit-presence fields with default values are omitted, `required`
24920        /// fields are always emitted, explicit-presence (`optional`) fields are
24921        /// emitted only when set, bytes fields are base64-encoded, and enum
24922        /// values are their proto name strings.
24923        ///
24924        /// This impl uses `serialize_map(None)` because the number of emitted
24925        /// fields depends on default-omission rules; serializers that require
24926        /// known map lengths (e.g. `bincode`) will return a runtime error.
24927        /// Use the owned message type for those formats.
24928        impl<'__a> ::serde::Serialize for TriggerView<'__a> {
24929            fn serialize<__S: ::serde::Serializer>(
24930                &self,
24931                __s: __S,
24932            ) -> ::core::result::Result<__S::Ok, __S::Error> {
24933                use ::serde::ser::SerializeMap as _;
24934                let mut __map = __s.serialize_map(::core::option::Option::None)?;
24935                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
24936                    __map
24937                        .serialize_entry(
24938                            "triggerId",
24939                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
24940                        )?;
24941                }
24942                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
24943                    __map
24944                        .serialize_entry(
24945                            "subaccountId",
24946                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
24947                        )?;
24948                }
24949                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
24950                    __map
24951                        .serialize_entry(
24952                            "symbolId",
24953                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
24954                        )?;
24955                }
24956                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
24957                    __map.serialize_entry("symbol", self.symbol)?;
24958                }
24959                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
24960                    __map.serialize_entry("status", &self.status)?;
24961                }
24962                if let ::core::option::Option::Some(__v) = self.parent_order_id {
24963                    __map
24964                        .serialize_entry(
24965                            "parentOrderId",
24966                            &::buffa::json_helpers::ProtoJson(&__v),
24967                        )?;
24968                }
24969                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
24970                    __map
24971                        .serialize_entry(
24972                            "qtyScaled",
24973                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
24974                        )?;
24975                }
24976                if !::buffa::json_helpers::skip_if::is_default_enum_value(
24977                    &self.fee_asset,
24978                ) {
24979                    __map.serialize_entry("feeAsset", &self.fee_asset)?;
24980                }
24981                if !::buffa::json_helpers::skip_if::is_default_enum_value(
24982                    &self.self_trade_prevention_mode,
24983                ) {
24984                    __map
24985                        .serialize_entry(
24986                            "selfTradePreventionMode",
24987                            &self.self_trade_prevention_mode,
24988                        )?;
24989                }
24990                if !::buffa::json_helpers::skip_if::is_empty_str(
24991                    self.client_trigger_id,
24992                ) {
24993                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
24994                }
24995                {
24996                    if let ::core::option::Option::Some(__v) = self
24997                        .created_at
24998                        .as_option()
24999                    {
25000                        __map.serialize_entry("createdAt", __v)?;
25001                    }
25002                }
25003                {
25004                    if let ::core::option::Option::Some(__v) = self
25005                        .updated_at
25006                        .as_option()
25007                    {
25008                        __map.serialize_entry("updatedAt", __v)?;
25009                    }
25010                }
25011                {
25012                    if let ::core::option::Option::Some(__v) = self.armed_at.as_option()
25013                    {
25014                        __map.serialize_entry("armedAt", __v)?;
25015                    }
25016                }
25017                {
25018                    if let ::core::option::Option::Some(__v) = self
25019                        .completed_at
25020                        .as_option()
25021                    {
25022                        __map.serialize_entry("completedAt", __v)?;
25023                    }
25024                }
25025                if let ::core::option::Option::Some(ref __ov) = self.configuration {
25026                    match __ov {
25027                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
25028                            v,
25029                        ) => {
25030                            __map.serialize_entry("stopLoss", v)?;
25031                        }
25032                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
25033                            v,
25034                        ) => {
25035                            __map.serialize_entry("takeProfit", v)?;
25036                        }
25037                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
25038                            v,
25039                        ) => {
25040                            __map.serialize_entry("trailingStop", v)?;
25041                        }
25042                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
25043                            v,
25044                        ) => {
25045                            __map.serialize_entry("twap", v)?;
25046                        }
25047                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
25048                            v,
25049                        ) => {
25050                            __map.serialize_entry("ladder", v)?;
25051                        }
25052                    }
25053                }
25054                if let ::core::option::Option::Some(ref __ov) = self.runtime_details {
25055                    match __ov {
25056                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
25057                            v,
25058                        ) => {
25059                            __map.serialize_entry("stop", v)?;
25060                        }
25061                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
25062                            v,
25063                        ) => {
25064                            __map.serialize_entry("trailing", v)?;
25065                        }
25066                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
25067                            v,
25068                        ) => {
25069                            __map.serialize_entry("twapState", v)?;
25070                        }
25071                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
25072                            v,
25073                        ) => {
25074                            __map.serialize_entry("ladderState", v)?;
25075                        }
25076                    }
25077                }
25078                __map.end()
25079            }
25080        }
25081        impl<'a> ::buffa::MessageName for TriggerView<'a> {
25082            const PACKAGE: &'static str = "triggers.v1";
25083            const NAME: &'static str = "Trigger";
25084            const FULL_NAME: &'static str = "triggers.v1.Trigger";
25085            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
25086        }
25087        ::buffa::impl_default_view_instance!(TriggerView);
25088        ::buffa::impl_view_reborrow!(TriggerView);
25089        /** Self-contained, `'static` owned view of a `Trigger` message.
25090
25091 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.
25092
25093 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.*/
25094        #[derive(Clone, Debug)]
25095        pub struct TriggerOwnedView(::buffa::OwnedView<TriggerView<'static>>);
25096        impl TriggerOwnedView {
25097            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
25098            ///
25099            /// The view borrows directly from the buffer's data; the buffer is
25100            /// retained inside the returned handle.
25101            ///
25102            /// # Errors
25103            ///
25104            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
25105            /// protobuf data.
25106            pub fn decode(
25107                bytes: ::buffa::bytes::Bytes,
25108            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25109                ::core::result::Result::Ok(
25110                    TriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
25111                )
25112            }
25113            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
25114            /// max message size).
25115            ///
25116            /// # Errors
25117            ///
25118            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
25119            /// exceeds the configured limits.
25120            pub fn decode_with_options(
25121                bytes: ::buffa::bytes::Bytes,
25122                opts: &::buffa::DecodeOptions,
25123            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25124                ::core::result::Result::Ok(
25125                    TriggerOwnedView(
25126                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
25127                    ),
25128                )
25129            }
25130            /// Build from an owned message via an encode → decode round-trip.
25131            ///
25132            /// # Errors
25133            ///
25134            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
25135            /// somehow invalid (should not happen for well-formed messages).
25136            pub fn from_owned(
25137                msg: &super::super::Trigger,
25138            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25139                ::core::result::Result::Ok(
25140                    TriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
25141                )
25142            }
25143            /// Borrow the full [`TriggerView`] with its lifetime tied to `&self`.
25144            #[must_use]
25145            pub fn view(&self) -> &TriggerView<'_> {
25146                self.0.reborrow()
25147            }
25148            /// Convert to the owned message type.
25149            ///
25150            /// # Errors
25151            ///
25152            /// Returns an error if re-materializing preserved unknown fields
25153            /// fails (e.g. the unknown-field limit is exceeded).
25154            pub fn to_owned_message(
25155                &self,
25156            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
25157                self.0.to_owned_message()
25158            }
25159            /// The underlying bytes buffer.
25160            #[must_use]
25161            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
25162                self.0.bytes()
25163            }
25164            /// Consume the handle, returning the underlying bytes buffer.
25165            #[must_use]
25166            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
25167                self.0.into_bytes()
25168            }
25169            /// Trigger ID.
25170            ///
25171            /// Field 1: `trigger_id`
25172            #[must_use]
25173            pub fn trigger_id(&self) -> u64 {
25174                self.0.reborrow().trigger_id
25175            }
25176            /// Public account or sub-account ID associated with the trigger.
25177            ///
25178            /// Field 2: `subaccount_id`
25179            #[must_use]
25180            pub fn subaccount_id(&self) -> u64 {
25181                self.0.reborrow().subaccount_id
25182            }
25183            /// Trading symbol numeric identifier.
25184            ///
25185            /// Field 3: `symbol_id`
25186            #[must_use]
25187            pub fn symbol_id(&self) -> u32 {
25188                self.0.reborrow().symbol_id
25189            }
25190            /// Trading symbol, for example "BTC-USDT".
25191            ///
25192            /// Field 4: `symbol`
25193            #[must_use]
25194            pub fn symbol(&self) -> &'_ str {
25195                self.0.reborrow().symbol
25196            }
25197            /// Current trigger lifecycle status.
25198            ///
25199            /// Field 5: `status`
25200            #[must_use]
25201            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
25202                self.0.reborrow().status
25203            }
25204            /// Parent order ID for attached-risk triggers; empty for standalone triggers.
25205            ///
25206            /// Field 6: `parent_order_id`
25207            #[must_use]
25208            pub fn parent_order_id(&self) -> ::core::option::Option<u64> {
25209                self.0.reborrow().parent_order_id
25210            }
25211            /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
25212            ///
25213            /// Field 20: `qty_scaled`
25214            #[must_use]
25215            pub fn qty_scaled(&self) -> i64 {
25216                self.0.reborrow().qty_scaled
25217            }
25218            /// Fee asset for BUY child orders.
25219            ///
25220            /// Field 21: `fee_asset`
25221            #[must_use]
25222            pub fn fee_asset(
25223                &self,
25224            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::FeeAsset> {
25225                self.0.reborrow().fee_asset
25226            }
25227            /// Self-trade prevention mode for child orders.
25228            ///
25229            /// Field 22: `self_trade_prevention_mode`
25230            #[must_use]
25231            pub fn self_trade_prevention_mode(
25232                &self,
25233            ) -> ::buffa::EnumValue<
25234                super::super::super::super::orders::v1::SelfTradePreventionMode,
25235            > {
25236                self.0.reborrow().self_trade_prevention_mode
25237            }
25238            /// Client-provided trigger ID for idempotency and correlation.
25239            ///
25240            /// Field 60: `client_trigger_id`
25241            #[must_use]
25242            pub fn client_trigger_id(&self) -> &'_ str {
25243                self.0.reborrow().client_trigger_id
25244            }
25245            /// Creation timestamp.
25246            ///
25247            /// Field 61: `created_at`
25248            #[must_use]
25249            pub fn created_at(
25250                &self,
25251            ) -> &::buffa::MessageFieldView<
25252                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25253            > {
25254                &self.0.reborrow().created_at
25255            }
25256            /// Last update timestamp.
25257            ///
25258            /// Field 62: `updated_at`
25259            #[must_use]
25260            pub fn updated_at(
25261                &self,
25262            ) -> &::buffa::MessageFieldView<
25263                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25264            > {
25265                &self.0.reborrow().updated_at
25266            }
25267            /// Timestamp when the trigger became armed.
25268            ///
25269            /// Field 63: `armed_at`
25270            #[must_use]
25271            pub fn armed_at(
25272                &self,
25273            ) -> &::buffa::MessageFieldView<
25274                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25275            > {
25276                &self.0.reborrow().armed_at
25277            }
25278            /// Timestamp when the trigger reached a terminal successful state.
25279            ///
25280            /// Field 64: `completed_at`
25281            #[must_use]
25282            pub fn completed_at(
25283                &self,
25284            ) -> &::buffa::MessageFieldView<
25285                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25286            > {
25287                &self.0.reborrow().completed_at
25288            }
25289            /// Oneof `configuration`.
25290            #[must_use]
25291            pub fn configuration(
25292                &self,
25293            ) -> ::core::option::Option<
25294                &super::super::__buffa::view::oneof::trigger::Configuration<'_>,
25295            > {
25296                self.0.reborrow().configuration.as_ref()
25297            }
25298            /// Oneof `runtime_details`.
25299            #[must_use]
25300            pub fn runtime_details(
25301                &self,
25302            ) -> ::core::option::Option<
25303                &super::super::__buffa::view::oneof::trigger::RuntimeDetails<'_>,
25304            > {
25305                self.0.reborrow().runtime_details.as_ref()
25306            }
25307        }
25308        impl ::core::convert::From<::buffa::OwnedView<TriggerView<'static>>>
25309        for TriggerOwnedView {
25310            fn from(inner: ::buffa::OwnedView<TriggerView<'static>>) -> Self {
25311                TriggerOwnedView(inner)
25312            }
25313        }
25314        impl ::core::convert::From<TriggerOwnedView>
25315        for ::buffa::OwnedView<TriggerView<'static>> {
25316            fn from(wrapper: TriggerOwnedView) -> Self {
25317                wrapper.0
25318            }
25319        }
25320        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerView<'static>>>
25321        for TriggerOwnedView {
25322            fn as_ref(&self) -> &::buffa::OwnedView<TriggerView<'static>> {
25323                &self.0
25324            }
25325        }
25326        impl ::buffa::HasMessageView for super::super::Trigger {
25327            type View<'a> = TriggerView<'a>;
25328            type ViewHandle = TriggerOwnedView;
25329        }
25330        impl ::serde::Serialize for TriggerOwnedView {
25331            fn serialize<__S: ::serde::Serializer>(
25332                &self,
25333                __s: __S,
25334            ) -> ::core::result::Result<__S::Ok, __S::Error> {
25335                ::serde::Serialize::serialize(&self.0, __s)
25336            }
25337        }
25338        pub mod oneof {
25339            #[allow(unused_imports)]
25340            use super::*;
25341            pub mod conditional_child_execution {
25342                #[allow(unused_imports)]
25343                use super::*;
25344                #[derive(Clone, Debug)]
25345                pub enum Execution<'a> {
25346                    MarketIoc(
25347                        ::buffa::alloc::boxed::Box<
25348                            super::super::super::super::__buffa::view::TriggerMarketIocView<
25349                                'a,
25350                            >,
25351                        >,
25352                    ),
25353                    LimitGtc(
25354                        ::buffa::alloc::boxed::Box<
25355                            super::super::super::super::__buffa::view::TriggerLimitGtcView<
25356                                'a,
25357                            >,
25358                        >,
25359                    ),
25360                    LimitIoc(
25361                        ::buffa::alloc::boxed::Box<
25362                            super::super::super::super::__buffa::view::TriggerLimitIocView<
25363                                'a,
25364                            >,
25365                        >,
25366                    ),
25367                    LimitFok(
25368                        ::buffa::alloc::boxed::Box<
25369                            super::super::super::super::__buffa::view::TriggerLimitFokView<
25370                                'a,
25371                            >,
25372                        >,
25373                    ),
25374                }
25375            }
25376            pub mod trailing_stop_trigger {
25377                #[allow(unused_imports)]
25378                use super::*;
25379                #[derive(Clone, Debug)]
25380                pub enum TrailingDistance {
25381                    TrailingDistanceTicks(i64),
25382                    TrailingDistanceBps(i32),
25383                }
25384                #[derive(Clone, Debug)]
25385                pub enum MaxSlippage {
25386                    MaxSlippageTicks(i32),
25387                    MaxSlippageBps(i32),
25388                }
25389            }
25390            pub mod twap_trigger {
25391                #[allow(unused_imports)]
25392                use super::*;
25393                #[derive(Clone, Debug)]
25394                pub enum Execution<'a> {
25395                    MarketIoc(
25396                        ::buffa::alloc::boxed::Box<
25397                            super::super::super::super::__buffa::view::TwapMarketIocView<
25398                                'a,
25399                            >,
25400                        >,
25401                    ),
25402                    LimitGtc(
25403                        ::buffa::alloc::boxed::Box<
25404                            super::super::super::super::__buffa::view::TwapLimitGtcView<
25405                                'a,
25406                            >,
25407                        >,
25408                    ),
25409                }
25410            }
25411            pub mod trigger_intent {
25412                #[allow(unused_imports)]
25413                use super::*;
25414                #[derive(Clone, Debug)]
25415                pub enum Strategy<'a> {
25416                    StopLoss(
25417                        ::buffa::alloc::boxed::Box<
25418                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25419                                'a,
25420                            >,
25421                        >,
25422                    ),
25423                    TakeProfit(
25424                        ::buffa::alloc::boxed::Box<
25425                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25426                                'a,
25427                            >,
25428                        >,
25429                    ),
25430                    TrailingStop(
25431                        ::buffa::alloc::boxed::Box<
25432                            super::super::super::super::__buffa::view::TrailingStopTriggerView<
25433                                'a,
25434                            >,
25435                        >,
25436                    ),
25437                    Twap(
25438                        ::buffa::alloc::boxed::Box<
25439                            super::super::super::super::__buffa::view::TwapTriggerView<
25440                                'a,
25441                            >,
25442                        >,
25443                    ),
25444                    Ladder(
25445                        ::buffa::alloc::boxed::Box<
25446                            super::super::super::super::__buffa::view::LadderTriggerView<
25447                                'a,
25448                            >,
25449                        >,
25450                    ),
25451                }
25452            }
25453            pub mod modify_trigger_request {
25454                #[allow(unused_imports)]
25455                use super::*;
25456                #[derive(Clone, Debug)]
25457                pub enum TrailingDistance {
25458                    TrailingDistanceTicks(i64),
25459                    TrailingDistanceBps(i32),
25460                }
25461                #[derive(Clone, Debug)]
25462                pub enum MaxSlippage {
25463                    MaxSlippageTicks(i32),
25464                    MaxSlippageBps(i32),
25465                }
25466            }
25467            pub mod trigger {
25468                #[allow(unused_imports)]
25469                use super::*;
25470                #[derive(Clone, Debug)]
25471                pub enum Configuration<'a> {
25472                    StopLoss(
25473                        ::buffa::alloc::boxed::Box<
25474                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25475                                'a,
25476                            >,
25477                        >,
25478                    ),
25479                    TakeProfit(
25480                        ::buffa::alloc::boxed::Box<
25481                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25482                                'a,
25483                            >,
25484                        >,
25485                    ),
25486                    TrailingStop(
25487                        ::buffa::alloc::boxed::Box<
25488                            super::super::super::super::__buffa::view::TrailingStopTriggerView<
25489                                'a,
25490                            >,
25491                        >,
25492                    ),
25493                    Twap(
25494                        ::buffa::alloc::boxed::Box<
25495                            super::super::super::super::__buffa::view::TwapTriggerView<
25496                                'a,
25497                            >,
25498                        >,
25499                    ),
25500                    Ladder(
25501                        ::buffa::alloc::boxed::Box<
25502                            super::super::super::super::__buffa::view::LadderTriggerView<
25503                                'a,
25504                            >,
25505                        >,
25506                    ),
25507                }
25508                #[derive(Clone, Debug)]
25509                pub enum RuntimeDetails<'a> {
25510                    Stop(
25511                        ::buffa::alloc::boxed::Box<
25512                            super::super::super::super::__buffa::view::StopDetailsView<
25513                                'a,
25514                            >,
25515                        >,
25516                    ),
25517                    Trailing(
25518                        ::buffa::alloc::boxed::Box<
25519                            super::super::super::super::__buffa::view::TrailingDetailsView<
25520                                'a,
25521                            >,
25522                        >,
25523                    ),
25524                    TwapState(
25525                        ::buffa::alloc::boxed::Box<
25526                            super::super::super::super::__buffa::view::TwapDetailsView<
25527                                'a,
25528                            >,
25529                        >,
25530                    ),
25531                    LadderState(
25532                        ::buffa::alloc::boxed::Box<
25533                            super::super::super::super::__buffa::view::LadderDetailsView<
25534                                'a,
25535                            >,
25536                        >,
25537                    ),
25538                }
25539            }
25540        }
25541    }
25542    pub mod oneof {
25543        #[allow(unused_imports)]
25544        use super::*;
25545        pub mod conditional_child_execution {
25546            #[allow(unused_imports)]
25547            use super::*;
25548            #[derive(Clone, PartialEq, Debug)]
25549            pub enum Execution {
25550                MarketIoc(
25551                    ::buffa::alloc::boxed::Box<super::super::super::TriggerMarketIoc>,
25552                ),
25553                LimitGtc(
25554                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitGtc>,
25555                ),
25556                LimitIoc(
25557                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitIoc>,
25558                ),
25559                LimitFok(
25560                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitFok>,
25561                ),
25562            }
25563            impl ::buffa::Oneof for Execution {}
25564            impl From<super::super::super::TriggerMarketIoc> for Execution {
25565                fn from(v: super::super::super::TriggerMarketIoc) -> Self {
25566                    Self::MarketIoc(::buffa::alloc::boxed::Box::new(v))
25567                }
25568            }
25569            impl From<super::super::super::TriggerMarketIoc>
25570            for ::core::option::Option<Execution> {
25571                fn from(v: super::super::super::TriggerMarketIoc) -> Self {
25572                    Self::Some(Execution::from(v))
25573                }
25574            }
25575            impl From<super::super::super::TriggerLimitGtc> for Execution {
25576                fn from(v: super::super::super::TriggerLimitGtc) -> Self {
25577                    Self::LimitGtc(::buffa::alloc::boxed::Box::new(v))
25578                }
25579            }
25580            impl From<super::super::super::TriggerLimitGtc>
25581            for ::core::option::Option<Execution> {
25582                fn from(v: super::super::super::TriggerLimitGtc) -> Self {
25583                    Self::Some(Execution::from(v))
25584                }
25585            }
25586            impl From<super::super::super::TriggerLimitIoc> for Execution {
25587                fn from(v: super::super::super::TriggerLimitIoc) -> Self {
25588                    Self::LimitIoc(::buffa::alloc::boxed::Box::new(v))
25589                }
25590            }
25591            impl From<super::super::super::TriggerLimitIoc>
25592            for ::core::option::Option<Execution> {
25593                fn from(v: super::super::super::TriggerLimitIoc) -> Self {
25594                    Self::Some(Execution::from(v))
25595                }
25596            }
25597            impl From<super::super::super::TriggerLimitFok> for Execution {
25598                fn from(v: super::super::super::TriggerLimitFok) -> Self {
25599                    Self::LimitFok(::buffa::alloc::boxed::Box::new(v))
25600                }
25601            }
25602            impl From<super::super::super::TriggerLimitFok>
25603            for ::core::option::Option<Execution> {
25604                fn from(v: super::super::super::TriggerLimitFok) -> Self {
25605                    Self::Some(Execution::from(v))
25606                }
25607            }
25608            impl serde::Serialize for Execution {
25609                fn serialize<S: serde::Serializer>(
25610                    &self,
25611                    s: S,
25612                ) -> ::core::result::Result<S::Ok, S::Error> {
25613                    use serde::ser::SerializeMap;
25614                    let mut map = s.serialize_map(Some(1))?;
25615                    match self {
25616                        Self::MarketIoc(v) => {
25617                            map.serialize_entry("marketIoc", v)?;
25618                        }
25619                        Self::LimitGtc(v) => {
25620                            map.serialize_entry("limitGtc", v)?;
25621                        }
25622                        Self::LimitIoc(v) => {
25623                            map.serialize_entry("limitIoc", v)?;
25624                        }
25625                        Self::LimitFok(v) => {
25626                            map.serialize_entry("limitFok", v)?;
25627                        }
25628                    }
25629                    map.end()
25630                }
25631            }
25632        }
25633        pub mod trailing_stop_trigger {
25634            #[allow(unused_imports)]
25635            use super::*;
25636            /// Required trailing distance.
25637            #[derive(Clone, PartialEq, Debug)]
25638            pub enum TrailingDistance {
25639                TrailingDistanceTicks(i64),
25640                TrailingDistanceBps(i32),
25641            }
25642            impl ::buffa::Oneof for TrailingDistance {}
25643            impl serde::Serialize for TrailingDistance {
25644                fn serialize<S: serde::Serializer>(
25645                    &self,
25646                    s: S,
25647                ) -> ::core::result::Result<S::Ok, S::Error> {
25648                    use serde::ser::SerializeMap;
25649                    let mut map = s.serialize_map(Some(1))?;
25650                    match self {
25651                        Self::TrailingDistanceTicks(v) => {
25652                            map.serialize_entry(
25653                                "trailingDistanceTicks",
25654                                &::buffa::json_helpers::ProtoJson(v),
25655                            )?;
25656                        }
25657                        Self::TrailingDistanceBps(v) => {
25658                            map.serialize_entry(
25659                                "trailingDistanceBps",
25660                                &::buffa::json_helpers::ProtoJson(v),
25661                            )?;
25662                        }
25663                    }
25664                    map.end()
25665                }
25666            }
25667            /// Optional protection applied when the market child fires.
25668            #[derive(Clone, PartialEq, Debug)]
25669            pub enum MaxSlippage {
25670                MaxSlippageTicks(i32),
25671                MaxSlippageBps(i32),
25672            }
25673            impl ::buffa::Oneof for MaxSlippage {}
25674            impl serde::Serialize for MaxSlippage {
25675                fn serialize<S: serde::Serializer>(
25676                    &self,
25677                    s: S,
25678                ) -> ::core::result::Result<S::Ok, S::Error> {
25679                    use serde::ser::SerializeMap;
25680                    let mut map = s.serialize_map(Some(1))?;
25681                    match self {
25682                        Self::MaxSlippageTicks(v) => {
25683                            map.serialize_entry(
25684                                "maxSlippageTicks",
25685                                &::buffa::json_helpers::ProtoJson(v),
25686                            )?;
25687                        }
25688                        Self::MaxSlippageBps(v) => {
25689                            map.serialize_entry(
25690                                "maxSlippageBps",
25691                                &::buffa::json_helpers::ProtoJson(v),
25692                            )?;
25693                        }
25694                    }
25695                    map.end()
25696                }
25697            }
25698        }
25699        pub mod twap_trigger {
25700            #[allow(unused_imports)]
25701            use super::*;
25702            /// Proven slice execution behavior.
25703            #[derive(Clone, PartialEq, Debug)]
25704            pub enum Execution {
25705                MarketIoc(
25706                    ::buffa::alloc::boxed::Box<super::super::super::TwapMarketIoc>,
25707                ),
25708                LimitGtc(::buffa::alloc::boxed::Box<super::super::super::TwapLimitGtc>),
25709            }
25710            impl ::buffa::Oneof for Execution {}
25711            impl From<super::super::super::TwapMarketIoc> for Execution {
25712                fn from(v: super::super::super::TwapMarketIoc) -> Self {
25713                    Self::MarketIoc(::buffa::alloc::boxed::Box::new(v))
25714                }
25715            }
25716            impl From<super::super::super::TwapMarketIoc>
25717            for ::core::option::Option<Execution> {
25718                fn from(v: super::super::super::TwapMarketIoc) -> Self {
25719                    Self::Some(Execution::from(v))
25720                }
25721            }
25722            impl From<super::super::super::TwapLimitGtc> for Execution {
25723                fn from(v: super::super::super::TwapLimitGtc) -> Self {
25724                    Self::LimitGtc(::buffa::alloc::boxed::Box::new(v))
25725                }
25726            }
25727            impl From<super::super::super::TwapLimitGtc>
25728            for ::core::option::Option<Execution> {
25729                fn from(v: super::super::super::TwapLimitGtc) -> Self {
25730                    Self::Some(Execution::from(v))
25731                }
25732            }
25733            impl serde::Serialize for Execution {
25734                fn serialize<S: serde::Serializer>(
25735                    &self,
25736                    s: S,
25737                ) -> ::core::result::Result<S::Ok, S::Error> {
25738                    use serde::ser::SerializeMap;
25739                    let mut map = s.serialize_map(Some(1))?;
25740                    match self {
25741                        Self::MarketIoc(v) => {
25742                            map.serialize_entry("marketIoc", v)?;
25743                        }
25744                        Self::LimitGtc(v) => {
25745                            map.serialize_entry("limitGtc", v)?;
25746                        }
25747                    }
25748                    map.end()
25749                }
25750            }
25751        }
25752        pub mod trigger_intent {
25753            #[allow(unused_imports)]
25754            use super::*;
25755            /// Required trigger strategy.
25756            #[derive(Clone, PartialEq, Debug)]
25757            pub enum Strategy {
25758                StopLoss(
25759                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25760                ),
25761                TakeProfit(
25762                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25763                ),
25764                TrailingStop(
25765                    ::buffa::alloc::boxed::Box<super::super::super::TrailingStopTrigger>,
25766                ),
25767                Twap(::buffa::alloc::boxed::Box<super::super::super::TwapTrigger>),
25768                Ladder(::buffa::alloc::boxed::Box<super::super::super::LadderTrigger>),
25769            }
25770            impl ::buffa::Oneof for Strategy {}
25771            impl From<super::super::super::TrailingStopTrigger> for Strategy {
25772                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25773                    Self::TrailingStop(::buffa::alloc::boxed::Box::new(v))
25774                }
25775            }
25776            impl From<super::super::super::TrailingStopTrigger>
25777            for ::core::option::Option<Strategy> {
25778                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25779                    Self::Some(Strategy::from(v))
25780                }
25781            }
25782            impl From<super::super::super::TwapTrigger> for Strategy {
25783                fn from(v: super::super::super::TwapTrigger) -> Self {
25784                    Self::Twap(::buffa::alloc::boxed::Box::new(v))
25785                }
25786            }
25787            impl From<super::super::super::TwapTrigger>
25788            for ::core::option::Option<Strategy> {
25789                fn from(v: super::super::super::TwapTrigger) -> Self {
25790                    Self::Some(Strategy::from(v))
25791                }
25792            }
25793            impl From<super::super::super::LadderTrigger> for Strategy {
25794                fn from(v: super::super::super::LadderTrigger) -> Self {
25795                    Self::Ladder(::buffa::alloc::boxed::Box::new(v))
25796                }
25797            }
25798            impl From<super::super::super::LadderTrigger>
25799            for ::core::option::Option<Strategy> {
25800                fn from(v: super::super::super::LadderTrigger) -> Self {
25801                    Self::Some(Strategy::from(v))
25802                }
25803            }
25804            impl serde::Serialize for Strategy {
25805                fn serialize<S: serde::Serializer>(
25806                    &self,
25807                    s: S,
25808                ) -> ::core::result::Result<S::Ok, S::Error> {
25809                    use serde::ser::SerializeMap;
25810                    let mut map = s.serialize_map(Some(1))?;
25811                    match self {
25812                        Self::StopLoss(v) => {
25813                            map.serialize_entry("stopLoss", v)?;
25814                        }
25815                        Self::TakeProfit(v) => {
25816                            map.serialize_entry("takeProfit", v)?;
25817                        }
25818                        Self::TrailingStop(v) => {
25819                            map.serialize_entry("trailingStop", v)?;
25820                        }
25821                        Self::Twap(v) => {
25822                            map.serialize_entry("twap", v)?;
25823                        }
25824                        Self::Ladder(v) => {
25825                            map.serialize_entry("ladder", v)?;
25826                        }
25827                    }
25828                    map.end()
25829                }
25830            }
25831        }
25832        pub mod modify_trigger_request {
25833            #[allow(unused_imports)]
25834            use super::*;
25835            /// For trailing stop:
25836            #[derive(Clone, PartialEq, Debug)]
25837            pub enum TrailingDistance {
25838                TrailingDistanceTicks(i64),
25839                TrailingDistanceBps(i32),
25840            }
25841            impl ::buffa::Oneof for TrailingDistance {}
25842            impl serde::Serialize for TrailingDistance {
25843                fn serialize<S: serde::Serializer>(
25844                    &self,
25845                    s: S,
25846                ) -> ::core::result::Result<S::Ok, S::Error> {
25847                    use serde::ser::SerializeMap;
25848                    let mut map = s.serialize_map(Some(1))?;
25849                    match self {
25850                        Self::TrailingDistanceTicks(v) => {
25851                            map.serialize_entry(
25852                                "trailingDistanceTicks",
25853                                &::buffa::json_helpers::ProtoJson(v),
25854                            )?;
25855                        }
25856                        Self::TrailingDistanceBps(v) => {
25857                            map.serialize_entry(
25858                                "trailingDistanceBps",
25859                                &::buffa::json_helpers::ProtoJson(v),
25860                            )?;
25861                        }
25862                    }
25863                    map.end()
25864                }
25865            }
25866            /// Optional price protection.
25867            #[derive(Clone, PartialEq, Debug)]
25868            pub enum MaxSlippage {
25869                MaxSlippageTicks(i32),
25870                MaxSlippageBps(i32),
25871            }
25872            impl ::buffa::Oneof for MaxSlippage {}
25873            impl serde::Serialize for MaxSlippage {
25874                fn serialize<S: serde::Serializer>(
25875                    &self,
25876                    s: S,
25877                ) -> ::core::result::Result<S::Ok, S::Error> {
25878                    use serde::ser::SerializeMap;
25879                    let mut map = s.serialize_map(Some(1))?;
25880                    match self {
25881                        Self::MaxSlippageTicks(v) => {
25882                            map.serialize_entry(
25883                                "maxSlippageTicks",
25884                                &::buffa::json_helpers::ProtoJson(v),
25885                            )?;
25886                        }
25887                        Self::MaxSlippageBps(v) => {
25888                            map.serialize_entry(
25889                                "maxSlippageBps",
25890                                &::buffa::json_helpers::ProtoJson(v),
25891                            )?;
25892                        }
25893                    }
25894                    map.end()
25895                }
25896            }
25897        }
25898        pub mod trigger {
25899            #[allow(unused_imports)]
25900            use super::*;
25901            /// Immutable strategy configuration. The selected variant is the trigger
25902            /// category and uses the same shape accepted by CreateTrigger.
25903            #[derive(Clone, PartialEq, Debug)]
25904            pub enum Configuration {
25905                StopLoss(
25906                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25907                ),
25908                TakeProfit(
25909                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25910                ),
25911                TrailingStop(
25912                    ::buffa::alloc::boxed::Box<super::super::super::TrailingStopTrigger>,
25913                ),
25914                Twap(::buffa::alloc::boxed::Box<super::super::super::TwapTrigger>),
25915                Ladder(::buffa::alloc::boxed::Box<super::super::super::LadderTrigger>),
25916            }
25917            impl ::buffa::Oneof for Configuration {}
25918            impl From<super::super::super::TrailingStopTrigger> for Configuration {
25919                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25920                    Self::TrailingStop(::buffa::alloc::boxed::Box::new(v))
25921                }
25922            }
25923            impl From<super::super::super::TrailingStopTrigger>
25924            for ::core::option::Option<Configuration> {
25925                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25926                    Self::Some(Configuration::from(v))
25927                }
25928            }
25929            impl From<super::super::super::TwapTrigger> for Configuration {
25930                fn from(v: super::super::super::TwapTrigger) -> Self {
25931                    Self::Twap(::buffa::alloc::boxed::Box::new(v))
25932                }
25933            }
25934            impl From<super::super::super::TwapTrigger>
25935            for ::core::option::Option<Configuration> {
25936                fn from(v: super::super::super::TwapTrigger) -> Self {
25937                    Self::Some(Configuration::from(v))
25938                }
25939            }
25940            impl From<super::super::super::LadderTrigger> for Configuration {
25941                fn from(v: super::super::super::LadderTrigger) -> Self {
25942                    Self::Ladder(::buffa::alloc::boxed::Box::new(v))
25943                }
25944            }
25945            impl From<super::super::super::LadderTrigger>
25946            for ::core::option::Option<Configuration> {
25947                fn from(v: super::super::super::LadderTrigger) -> Self {
25948                    Self::Some(Configuration::from(v))
25949                }
25950            }
25951            impl serde::Serialize for Configuration {
25952                fn serialize<S: serde::Serializer>(
25953                    &self,
25954                    s: S,
25955                ) -> ::core::result::Result<S::Ok, S::Error> {
25956                    use serde::ser::SerializeMap;
25957                    let mut map = s.serialize_map(Some(1))?;
25958                    match self {
25959                        Self::StopLoss(v) => {
25960                            map.serialize_entry("stopLoss", v)?;
25961                        }
25962                        Self::TakeProfit(v) => {
25963                            map.serialize_entry("takeProfit", v)?;
25964                        }
25965                        Self::TrailingStop(v) => {
25966                            map.serialize_entry("trailingStop", v)?;
25967                        }
25968                        Self::Twap(v) => {
25969                            map.serialize_entry("twap", v)?;
25970                        }
25971                        Self::Ladder(v) => {
25972                            map.serialize_entry("ladder", v)?;
25973                        }
25974                    }
25975                    map.end()
25976                }
25977            }
25978            /// Type-specific runtime state.
25979            #[derive(Clone, PartialEq, Debug)]
25980            pub enum RuntimeDetails {
25981                Stop(::buffa::alloc::boxed::Box<super::super::super::StopDetails>),
25982                Trailing(
25983                    ::buffa::alloc::boxed::Box<super::super::super::TrailingDetails>,
25984                ),
25985                TwapState(::buffa::alloc::boxed::Box<super::super::super::TwapDetails>),
25986                LadderState(
25987                    ::buffa::alloc::boxed::Box<super::super::super::LadderDetails>,
25988                ),
25989            }
25990            impl ::buffa::Oneof for RuntimeDetails {}
25991            impl From<super::super::super::StopDetails> for RuntimeDetails {
25992                fn from(v: super::super::super::StopDetails) -> Self {
25993                    Self::Stop(::buffa::alloc::boxed::Box::new(v))
25994                }
25995            }
25996            impl From<super::super::super::StopDetails>
25997            for ::core::option::Option<RuntimeDetails> {
25998                fn from(v: super::super::super::StopDetails) -> Self {
25999                    Self::Some(RuntimeDetails::from(v))
26000                }
26001            }
26002            impl From<super::super::super::TrailingDetails> for RuntimeDetails {
26003                fn from(v: super::super::super::TrailingDetails) -> Self {
26004                    Self::Trailing(::buffa::alloc::boxed::Box::new(v))
26005                }
26006            }
26007            impl From<super::super::super::TrailingDetails>
26008            for ::core::option::Option<RuntimeDetails> {
26009                fn from(v: super::super::super::TrailingDetails) -> Self {
26010                    Self::Some(RuntimeDetails::from(v))
26011                }
26012            }
26013            impl From<super::super::super::TwapDetails> for RuntimeDetails {
26014                fn from(v: super::super::super::TwapDetails) -> Self {
26015                    Self::TwapState(::buffa::alloc::boxed::Box::new(v))
26016                }
26017            }
26018            impl From<super::super::super::TwapDetails>
26019            for ::core::option::Option<RuntimeDetails> {
26020                fn from(v: super::super::super::TwapDetails) -> Self {
26021                    Self::Some(RuntimeDetails::from(v))
26022                }
26023            }
26024            impl From<super::super::super::LadderDetails> for RuntimeDetails {
26025                fn from(v: super::super::super::LadderDetails) -> Self {
26026                    Self::LadderState(::buffa::alloc::boxed::Box::new(v))
26027                }
26028            }
26029            impl From<super::super::super::LadderDetails>
26030            for ::core::option::Option<RuntimeDetails> {
26031                fn from(v: super::super::super::LadderDetails) -> Self {
26032                    Self::Some(RuntimeDetails::from(v))
26033                }
26034            }
26035            impl serde::Serialize for RuntimeDetails {
26036                fn serialize<S: serde::Serializer>(
26037                    &self,
26038                    s: S,
26039                ) -> ::core::result::Result<S::Ok, S::Error> {
26040                    use serde::ser::SerializeMap;
26041                    let mut map = s.serialize_map(Some(1))?;
26042                    match self {
26043                        Self::Stop(v) => {
26044                            map.serialize_entry("stop", v)?;
26045                        }
26046                        Self::Trailing(v) => {
26047                            map.serialize_entry("trailing", v)?;
26048                        }
26049                        Self::TwapState(v) => {
26050                            map.serialize_entry("twapState", v)?;
26051                        }
26052                        Self::LadderState(v) => {
26053                            map.serialize_entry("ladderState", v)?;
26054                        }
26055                    }
26056                    map.end()
26057                }
26058            }
26059        }
26060    }
26061    /// Register this package's `Any` type entries and extension entries.
26062    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
26063        reg.register_json_any(super::__TRIGGER_MARKET_IOC_JSON_ANY);
26064        reg.register_json_any(super::__TRIGGER_LIMIT_GTC_JSON_ANY);
26065        reg.register_json_any(super::__TRIGGER_LIMIT_IOC_JSON_ANY);
26066        reg.register_json_any(super::__TRIGGER_LIMIT_FOK_JSON_ANY);
26067        reg.register_json_any(super::__CONDITIONAL_CHILD_EXECUTION_JSON_ANY);
26068        reg.register_json_any(super::__CONDITIONAL_TRIGGER_JSON_ANY);
26069        reg.register_json_any(super::__TRAILING_STOP_TRIGGER_JSON_ANY);
26070        reg.register_json_any(super::__TWAP_MARKET_IOC_JSON_ANY);
26071        reg.register_json_any(super::__TWAP_LIMIT_GTC_JSON_ANY);
26072        reg.register_json_any(super::__TWAP_TRIGGER_JSON_ANY);
26073        reg.register_json_any(super::__LADDER_TRIGGER_JSON_ANY);
26074        reg.register_json_any(super::__TRIGGER_INTENT_JSON_ANY);
26075        reg.register_json_any(super::__CREATE_TRIGGER_REQUEST_JSON_ANY);
26076        reg.register_json_any(super::__CREATE_TRIGGER_RESPONSE_JSON_ANY);
26077        reg.register_json_any(super::__GET_TRIGGER_REQUEST_JSON_ANY);
26078        reg.register_json_any(super::__GET_TRIGGER_RESPONSE_JSON_ANY);
26079        reg.register_json_any(super::__LIST_TRIGGERS_REQUEST_JSON_ANY);
26080        reg.register_json_any(super::__LIST_TRIGGERS_RESPONSE_JSON_ANY);
26081        reg.register_json_any(super::__LIST_TRIGGER_EVENTS_REQUEST_JSON_ANY);
26082        reg.register_json_any(super::__TRIGGER_EVENT_JSON_ANY);
26083        reg.register_json_any(super::__LIST_TRIGGER_EVENTS_RESPONSE_JSON_ANY);
26084        reg.register_json_any(super::__CANCEL_TRIGGER_REQUEST_JSON_ANY);
26085        reg.register_json_any(super::__CANCEL_TRIGGER_RESPONSE_JSON_ANY);
26086        reg.register_json_any(super::__MODIFY_TRIGGER_REQUEST_JSON_ANY);
26087        reg.register_json_any(super::__MODIFY_TRIGGER_RESPONSE_JSON_ANY);
26088        reg.register_json_any(super::__PAUSE_TRIGGER_REQUEST_JSON_ANY);
26089        reg.register_json_any(super::__PAUSE_TRIGGER_RESPONSE_JSON_ANY);
26090        reg.register_json_any(super::__RESUME_TRIGGER_REQUEST_JSON_ANY);
26091        reg.register_json_any(super::__RESUME_TRIGGER_RESPONSE_JSON_ANY);
26092        reg.register_json_any(super::__STOP_DETAILS_JSON_ANY);
26093        reg.register_json_any(super::__TRAILING_DETAILS_JSON_ANY);
26094        reg.register_json_any(super::__TWAP_DETAILS_JSON_ANY);
26095        reg.register_json_any(super::__LADDER_DETAILS_JSON_ANY);
26096        reg.register_json_any(super::__TRIGGER_JSON_ANY);
26097    }
26098}
26099#[doc(inline)]
26100pub use self::__buffa::view::TriggerMarketIocView;
26101#[doc(inline)]
26102pub use self::__buffa::view::TriggerMarketIocOwnedView;
26103#[doc(inline)]
26104pub use self::__buffa::view::TriggerLimitGtcView;
26105#[doc(inline)]
26106pub use self::__buffa::view::TriggerLimitGtcOwnedView;
26107#[doc(inline)]
26108pub use self::__buffa::view::TriggerLimitIocView;
26109#[doc(inline)]
26110pub use self::__buffa::view::TriggerLimitIocOwnedView;
26111#[doc(inline)]
26112pub use self::__buffa::view::TriggerLimitFokView;
26113#[doc(inline)]
26114pub use self::__buffa::view::TriggerLimitFokOwnedView;
26115#[doc(inline)]
26116pub use self::__buffa::view::ConditionalChildExecutionView;
26117#[doc(inline)]
26118pub use self::__buffa::view::ConditionalChildExecutionOwnedView;
26119#[doc(inline)]
26120pub use self::__buffa::view::ConditionalTriggerView;
26121#[doc(inline)]
26122pub use self::__buffa::view::ConditionalTriggerOwnedView;
26123#[doc(inline)]
26124pub use self::__buffa::view::TrailingStopTriggerView;
26125#[doc(inline)]
26126pub use self::__buffa::view::TrailingStopTriggerOwnedView;
26127#[doc(inline)]
26128pub use self::__buffa::view::TwapMarketIocView;
26129#[doc(inline)]
26130pub use self::__buffa::view::TwapMarketIocOwnedView;
26131#[doc(inline)]
26132pub use self::__buffa::view::TwapLimitGtcView;
26133#[doc(inline)]
26134pub use self::__buffa::view::TwapLimitGtcOwnedView;
26135#[doc(inline)]
26136pub use self::__buffa::view::TwapTriggerView;
26137#[doc(inline)]
26138pub use self::__buffa::view::TwapTriggerOwnedView;
26139#[doc(inline)]
26140pub use self::__buffa::view::LadderTriggerView;
26141#[doc(inline)]
26142pub use self::__buffa::view::LadderTriggerOwnedView;
26143#[doc(inline)]
26144pub use self::__buffa::view::TriggerIntentView;
26145#[doc(inline)]
26146pub use self::__buffa::view::TriggerIntentOwnedView;
26147#[doc(inline)]
26148pub use self::__buffa::view::CreateTriggerRequestView;
26149#[doc(inline)]
26150pub use self::__buffa::view::CreateTriggerRequestOwnedView;
26151#[doc(inline)]
26152pub use self::__buffa::view::CreateTriggerResponseView;
26153#[doc(inline)]
26154pub use self::__buffa::view::CreateTriggerResponseOwnedView;
26155#[doc(inline)]
26156pub use self::__buffa::view::GetTriggerRequestView;
26157#[doc(inline)]
26158pub use self::__buffa::view::GetTriggerRequestOwnedView;
26159#[doc(inline)]
26160pub use self::__buffa::view::GetTriggerResponseView;
26161#[doc(inline)]
26162pub use self::__buffa::view::GetTriggerResponseOwnedView;
26163#[doc(inline)]
26164pub use self::__buffa::view::ListTriggersRequestView;
26165#[doc(inline)]
26166pub use self::__buffa::view::ListTriggersRequestOwnedView;
26167#[doc(inline)]
26168pub use self::__buffa::view::ListTriggersResponseView;
26169#[doc(inline)]
26170pub use self::__buffa::view::ListTriggersResponseOwnedView;
26171#[doc(inline)]
26172pub use self::__buffa::view::ListTriggerEventsRequestView;
26173#[doc(inline)]
26174pub use self::__buffa::view::ListTriggerEventsRequestOwnedView;
26175#[doc(inline)]
26176pub use self::__buffa::view::TriggerEventView;
26177#[doc(inline)]
26178pub use self::__buffa::view::TriggerEventOwnedView;
26179#[doc(inline)]
26180pub use self::__buffa::view::ListTriggerEventsResponseView;
26181#[doc(inline)]
26182pub use self::__buffa::view::ListTriggerEventsResponseOwnedView;
26183#[doc(inline)]
26184pub use self::__buffa::view::CancelTriggerRequestView;
26185#[doc(inline)]
26186pub use self::__buffa::view::CancelTriggerRequestOwnedView;
26187#[doc(inline)]
26188pub use self::__buffa::view::CancelTriggerResponseView;
26189#[doc(inline)]
26190pub use self::__buffa::view::CancelTriggerResponseOwnedView;
26191#[doc(inline)]
26192pub use self::__buffa::view::ModifyTriggerRequestView;
26193#[doc(inline)]
26194pub use self::__buffa::view::ModifyTriggerRequestOwnedView;
26195#[doc(inline)]
26196pub use self::__buffa::view::ModifyTriggerResponseView;
26197#[doc(inline)]
26198pub use self::__buffa::view::ModifyTriggerResponseOwnedView;
26199#[doc(inline)]
26200pub use self::__buffa::view::PauseTriggerRequestView;
26201#[doc(inline)]
26202pub use self::__buffa::view::PauseTriggerRequestOwnedView;
26203#[doc(inline)]
26204pub use self::__buffa::view::PauseTriggerResponseView;
26205#[doc(inline)]
26206pub use self::__buffa::view::PauseTriggerResponseOwnedView;
26207#[doc(inline)]
26208pub use self::__buffa::view::ResumeTriggerRequestView;
26209#[doc(inline)]
26210pub use self::__buffa::view::ResumeTriggerRequestOwnedView;
26211#[doc(inline)]
26212pub use self::__buffa::view::ResumeTriggerResponseView;
26213#[doc(inline)]
26214pub use self::__buffa::view::ResumeTriggerResponseOwnedView;
26215#[doc(inline)]
26216pub use self::__buffa::view::StopDetailsView;
26217#[doc(inline)]
26218pub use self::__buffa::view::StopDetailsOwnedView;
26219#[doc(inline)]
26220pub use self::__buffa::view::TrailingDetailsView;
26221#[doc(inline)]
26222pub use self::__buffa::view::TrailingDetailsOwnedView;
26223#[doc(inline)]
26224pub use self::__buffa::view::TwapDetailsView;
26225#[doc(inline)]
26226pub use self::__buffa::view::TwapDetailsOwnedView;
26227#[doc(inline)]
26228pub use self::__buffa::view::LadderDetailsView;
26229#[doc(inline)]
26230pub use self::__buffa::view::LadderDetailsOwnedView;
26231#[doc(inline)]
26232pub use self::__buffa::view::TriggerView;
26233#[doc(inline)]
26234pub use self::__buffa::view::TriggerOwnedView;
26235#[doc(inline)]
26236pub use self::__buffa::register_types;