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    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
5166    /// bound to the authenticated account, trigger, sub-account scope, and newest
5167    /// first sort order.
5168    ///
5169    /// Field 5: `page_token`
5170    #[serde(
5171        rename = "pageToken",
5172        alias = "page_token",
5173        with = "::buffa::json_helpers::proto_string",
5174        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5175    )]
5176    pub page_token: ::buffa::alloc::string::String,
5177    #[serde(skip)]
5178    #[doc(hidden)]
5179    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5180}
5181impl ::core::fmt::Debug for ListTriggerEventsRequest {
5182    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5183        f.debug_struct("ListTriggerEventsRequest")
5184            .field("trigger_id", &self.trigger_id)
5185            .field("subaccount_id", &self.subaccount_id)
5186            .field("limit", &self.limit)
5187            .field("page_token", &self.page_token)
5188            .finish()
5189    }
5190}
5191impl ListTriggerEventsRequest {
5192    /// Protobuf type URL for this message, for use with `Any::pack` and
5193    /// `Any::unpack_if`.
5194    ///
5195    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5196    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
5197}
5198impl ListTriggerEventsRequest {
5199    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5200    #[inline]
5201    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
5202    pub fn with_subaccount_id(mut self, value: u64) -> Self {
5203        self.subaccount_id = Some(value);
5204        self
5205    }
5206}
5207::buffa::impl_default_instance!(ListTriggerEventsRequest);
5208impl ::buffa::MessageName for ListTriggerEventsRequest {
5209    const PACKAGE: &'static str = "triggers.v1";
5210    const NAME: &'static str = "ListTriggerEventsRequest";
5211    const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsRequest";
5212    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
5213}
5214impl ::buffa::Message for ListTriggerEventsRequest {
5215    /// Returns the total encoded size in bytes.
5216    ///
5217    /// The result is a `u32`; the protobuf specification requires all
5218    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5219    /// compliant message will never overflow this type.
5220    #[allow(clippy::let_and_return)]
5221    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5222        #[allow(unused_imports)]
5223        use ::buffa::Enumeration as _;
5224        let mut size = 0u32;
5225        if self.trigger_id != 0u64 {
5226            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5227        }
5228        if self.subaccount_id.is_some() {
5229            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5230        }
5231        if self.limit != 0u32 {
5232            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
5233        }
5234        if !self.page_token.is_empty() {
5235            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
5236        }
5237        size += self.__buffa_unknown_fields.encoded_len() as u32;
5238        size
5239    }
5240    fn write_to(
5241        &self,
5242        _cache: &mut ::buffa::SizeCache,
5243        buf: &mut impl ::buffa::bytes::BufMut,
5244    ) {
5245        #[allow(unused_imports)]
5246        use ::buffa::Enumeration as _;
5247        if self.trigger_id != 0u64 {
5248            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5249        }
5250        if let Some(v) = self.subaccount_id {
5251            ::buffa::types::put_fixed64_field(2u32, v, buf);
5252        }
5253        if self.limit != 0u32 {
5254            ::buffa::types::put_uint32_field(3u32, self.limit, buf);
5255        }
5256        if !self.page_token.is_empty() {
5257            ::buffa::types::put_string_field(5u32, &self.page_token, buf);
5258        }
5259        self.__buffa_unknown_fields.write_to(buf);
5260    }
5261    fn merge_field(
5262        &mut self,
5263        tag: ::buffa::encoding::Tag,
5264        buf: &mut impl ::buffa::bytes::Buf,
5265        ctx: ::buffa::DecodeContext<'_>,
5266    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5267        #[allow(unused_imports)]
5268        use ::buffa::bytes::Buf as _;
5269        #[allow(unused_imports)]
5270        use ::buffa::Enumeration as _;
5271        match tag.field_number() {
5272            1u32 => {
5273                ::buffa::encoding::check_wire_type(
5274                    tag,
5275                    ::buffa::encoding::WireType::Fixed64,
5276                )?;
5277                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5278            }
5279            2u32 => {
5280                ::buffa::encoding::check_wire_type(
5281                    tag,
5282                    ::buffa::encoding::WireType::Fixed64,
5283                )?;
5284                self.subaccount_id = ::core::option::Option::Some(
5285                    ::buffa::types::decode_fixed64(buf)?,
5286                );
5287            }
5288            3u32 => {
5289                ::buffa::encoding::check_wire_type(
5290                    tag,
5291                    ::buffa::encoding::WireType::Varint,
5292                )?;
5293                self.limit = ::buffa::types::decode_uint32(buf)?;
5294            }
5295            5u32 => {
5296                ::buffa::encoding::check_wire_type(
5297                    tag,
5298                    ::buffa::encoding::WireType::LengthDelimited,
5299                )?;
5300                ::buffa::types::merge_string(&mut self.page_token, buf)?;
5301            }
5302            _ => {
5303                self.__buffa_unknown_fields
5304                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5305            }
5306        }
5307        ::core::result::Result::Ok(())
5308    }
5309    fn clear(&mut self) {
5310        self.trigger_id = 0u64;
5311        self.subaccount_id = ::core::option::Option::None;
5312        self.limit = 0u32;
5313        self.page_token.clear();
5314        self.__buffa_unknown_fields.clear();
5315    }
5316}
5317impl ::buffa::ExtensionSet for ListTriggerEventsRequest {
5318    const PROTO_FQN: &'static str = "triggers.v1.ListTriggerEventsRequest";
5319    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5320        &self.__buffa_unknown_fields
5321    }
5322    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5323        &mut self.__buffa_unknown_fields
5324    }
5325}
5326impl ::buffa::json_helpers::ProtoElemJson for ListTriggerEventsRequest {
5327    fn serialize_proto_json<S: ::serde::Serializer>(
5328        v: &Self,
5329        s: S,
5330    ) -> ::core::result::Result<S::Ok, S::Error> {
5331        ::serde::Serialize::serialize(v, s)
5332    }
5333    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5334        d: D,
5335    ) -> ::core::result::Result<Self, D::Error> {
5336        <Self as ::serde::Deserialize>::deserialize(d)
5337    }
5338}
5339#[doc(hidden)]
5340pub const __LIST_TRIGGER_EVENTS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5341    type_url: "type.googleapis.com/triggers.v1.ListTriggerEventsRequest",
5342    to_json: ::buffa::type_registry::any_to_json::<ListTriggerEventsRequest>,
5343    from_json: ::buffa::type_registry::any_from_json::<ListTriggerEventsRequest>,
5344    is_wkt: false,
5345};
5346/// TriggerEvent describes one historical trigger lifecycle event.
5347#[derive(Clone, PartialEq, Default)]
5348#[derive(::serde::Serialize, ::serde::Deserialize)]
5349#[serde(default)]
5350pub struct TriggerEvent {
5351    /// Trigger ID associated with the event.
5352    ///
5353    /// Field 1: `trigger_id`
5354    #[serde(
5355        rename = "triggerId",
5356        alias = "trigger_id",
5357        with = "::buffa::json_helpers::uint64",
5358        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5359    )]
5360    pub trigger_id: u64,
5361    /// Public account or sub-account ID associated with the trigger.
5362    ///
5363    /// Field 2: `subaccount_id`
5364    #[serde(
5365        rename = "subaccountId",
5366        alias = "subaccount_id",
5367        with = "::buffa::json_helpers::uint64",
5368        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5369    )]
5370    pub subaccount_id: u64,
5371    /// Trading symbol numeric identifier.
5372    ///
5373    /// Field 3: `symbol_id`
5374    #[serde(
5375        rename = "symbolId",
5376        alias = "symbol_id",
5377        with = "::buffa::json_helpers::uint32",
5378        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5379    )]
5380    pub symbol_id: u32,
5381    /// Trigger type at the time of the event.
5382    ///
5383    /// Field 4: `trigger_type`
5384    #[serde(
5385        rename = "triggerType",
5386        alias = "trigger_type",
5387        with = "::buffa::json_helpers::proto_enum",
5388        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5389    )]
5390    pub trigger_type: ::buffa::EnumValue<TriggerType>,
5391    /// Event category.
5392    ///
5393    /// Field 5: `event_type`
5394    #[serde(
5395        rename = "eventType",
5396        alias = "event_type",
5397        with = "::buffa::json_helpers::proto_enum",
5398        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5399    )]
5400    pub event_type: ::buffa::EnumValue<TriggerEventType>,
5401    /// Event timestamp in nanoseconds since epoch (UTC).
5402    ///
5403    /// Field 10: `ts_ns`
5404    #[serde(
5405        rename = "tsNs",
5406        alias = "ts_ns",
5407        with = "::buffa::json_helpers::uint64",
5408        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5409    )]
5410    pub ts_ns: u64,
5411    /// Child sequence number for multi-child trigger strategies.
5412    ///
5413    /// Field 11: `child_seq`
5414    #[serde(
5415        rename = "childSeq",
5416        alias = "child_seq",
5417        with = "::buffa::json_helpers::int32",
5418        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
5419    )]
5420    pub child_seq: i32,
5421    /// Child order ID created by this event, if any.
5422    ///
5423    /// Field 12: `child_order_id`
5424    #[serde(
5425        rename = "childOrderId",
5426        alias = "child_order_id",
5427        with = "::buffa::json_helpers::uint64",
5428        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5429    )]
5430    pub child_order_id: u64,
5431    /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
5432    /// when not applicable.
5433    ///
5434    /// Field 13: `fire_price_ticks`
5435    #[serde(
5436        rename = "firePriceTicks",
5437        alias = "fire_price_ticks",
5438        with = "::buffa::json_helpers::int64",
5439        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5440    )]
5441    pub fire_price_ticks: i64,
5442    /// Optional cancel reason.
5443    ///
5444    /// Field 20: `reason`
5445    #[serde(
5446        rename = "reason",
5447        with = "::buffa::json_helpers::proto_string",
5448        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5449    )]
5450    pub reason: ::buffa::alloc::string::String,
5451    #[serde(skip)]
5452    #[doc(hidden)]
5453    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5454}
5455impl ::core::fmt::Debug for TriggerEvent {
5456    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5457        f.debug_struct("TriggerEvent")
5458            .field("trigger_id", &self.trigger_id)
5459            .field("subaccount_id", &self.subaccount_id)
5460            .field("symbol_id", &self.symbol_id)
5461            .field("trigger_type", &self.trigger_type)
5462            .field("event_type", &self.event_type)
5463            .field("ts_ns", &self.ts_ns)
5464            .field("child_seq", &self.child_seq)
5465            .field("child_order_id", &self.child_order_id)
5466            .field("fire_price_ticks", &self.fire_price_ticks)
5467            .field("reason", &self.reason)
5468            .finish()
5469    }
5470}
5471impl TriggerEvent {
5472    /// Protobuf type URL for this message, for use with `Any::pack` and
5473    /// `Any::unpack_if`.
5474    ///
5475    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5476    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
5477}
5478::buffa::impl_default_instance!(TriggerEvent);
5479impl ::buffa::MessageName for TriggerEvent {
5480    const PACKAGE: &'static str = "triggers.v1";
5481    const NAME: &'static str = "TriggerEvent";
5482    const FULL_NAME: &'static str = "triggers.v1.TriggerEvent";
5483    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
5484}
5485impl ::buffa::Message for TriggerEvent {
5486    /// Returns the total encoded size in bytes.
5487    ///
5488    /// The result is a `u32`; the protobuf specification requires all
5489    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5490    /// compliant message will never overflow this type.
5491    #[allow(clippy::let_and_return)]
5492    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5493        #[allow(unused_imports)]
5494        use ::buffa::Enumeration as _;
5495        let mut size = 0u32;
5496        if self.trigger_id != 0u64 {
5497            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5498        }
5499        if self.subaccount_id != 0u64 {
5500            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5501        }
5502        if self.symbol_id != 0u32 {
5503            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
5504        }
5505        {
5506            let val = self.trigger_type.to_i32();
5507            if val != 0 {
5508                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5509            }
5510        }
5511        {
5512            let val = self.event_type.to_i32();
5513            if val != 0 {
5514                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5515            }
5516        }
5517        if self.ts_ns != 0u64 {
5518            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
5519        }
5520        if self.child_seq != 0i32 {
5521            size += 1u32 + ::buffa::types::int32_encoded_len(self.child_seq) as u32;
5522        }
5523        if self.child_order_id != 0u64 {
5524            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5525        }
5526        if self.fire_price_ticks != 0i64 {
5527            size
5528                += 1u32
5529                    + ::buffa::types::int64_encoded_len(self.fire_price_ticks) as u32;
5530        }
5531        if !self.reason.is_empty() {
5532            size += 2u32 + ::buffa::types::string_encoded_len(&self.reason) as u32;
5533        }
5534        size += self.__buffa_unknown_fields.encoded_len() as u32;
5535        size
5536    }
5537    fn write_to(
5538        &self,
5539        _cache: &mut ::buffa::SizeCache,
5540        buf: &mut impl ::buffa::bytes::BufMut,
5541    ) {
5542        #[allow(unused_imports)]
5543        use ::buffa::Enumeration as _;
5544        if self.trigger_id != 0u64 {
5545            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5546        }
5547        if self.subaccount_id != 0u64 {
5548            ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
5549        }
5550        if self.symbol_id != 0u32 {
5551            ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
5552        }
5553        {
5554            let val = self.trigger_type.to_i32();
5555            if val != 0 {
5556                ::buffa::types::put_int32_field(4u32, val, buf);
5557            }
5558        }
5559        {
5560            let val = self.event_type.to_i32();
5561            if val != 0 {
5562                ::buffa::types::put_int32_field(5u32, val, buf);
5563            }
5564        }
5565        if self.ts_ns != 0u64 {
5566            ::buffa::types::put_uint64_field(10u32, self.ts_ns, buf);
5567        }
5568        if self.child_seq != 0i32 {
5569            ::buffa::types::put_int32_field(11u32, self.child_seq, buf);
5570        }
5571        if self.child_order_id != 0u64 {
5572            ::buffa::types::put_fixed64_field(12u32, self.child_order_id, buf);
5573        }
5574        if self.fire_price_ticks != 0i64 {
5575            ::buffa::types::put_int64_field(13u32, self.fire_price_ticks, buf);
5576        }
5577        if !self.reason.is_empty() {
5578            ::buffa::types::put_string_field(20u32, &self.reason, buf);
5579        }
5580        self.__buffa_unknown_fields.write_to(buf);
5581    }
5582    fn merge_field(
5583        &mut self,
5584        tag: ::buffa::encoding::Tag,
5585        buf: &mut impl ::buffa::bytes::Buf,
5586        ctx: ::buffa::DecodeContext<'_>,
5587    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5588        #[allow(unused_imports)]
5589        use ::buffa::bytes::Buf as _;
5590        #[allow(unused_imports)]
5591        use ::buffa::Enumeration as _;
5592        match tag.field_number() {
5593            1u32 => {
5594                ::buffa::encoding::check_wire_type(
5595                    tag,
5596                    ::buffa::encoding::WireType::Fixed64,
5597                )?;
5598                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5599            }
5600            2u32 => {
5601                ::buffa::encoding::check_wire_type(
5602                    tag,
5603                    ::buffa::encoding::WireType::Fixed64,
5604                )?;
5605                self.subaccount_id = ::buffa::types::decode_fixed64(buf)?;
5606            }
5607            3u32 => {
5608                ::buffa::encoding::check_wire_type(
5609                    tag,
5610                    ::buffa::encoding::WireType::Varint,
5611                )?;
5612                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
5613            }
5614            4u32 => {
5615                ::buffa::encoding::check_wire_type(
5616                    tag,
5617                    ::buffa::encoding::WireType::Varint,
5618                )?;
5619                self.trigger_type = ::buffa::EnumValue::from(
5620                    ::buffa::types::decode_int32(buf)?,
5621                );
5622            }
5623            5u32 => {
5624                ::buffa::encoding::check_wire_type(
5625                    tag,
5626                    ::buffa::encoding::WireType::Varint,
5627                )?;
5628                self.event_type = ::buffa::EnumValue::from(
5629                    ::buffa::types::decode_int32(buf)?,
5630                );
5631            }
5632            10u32 => {
5633                ::buffa::encoding::check_wire_type(
5634                    tag,
5635                    ::buffa::encoding::WireType::Varint,
5636                )?;
5637                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
5638            }
5639            11u32 => {
5640                ::buffa::encoding::check_wire_type(
5641                    tag,
5642                    ::buffa::encoding::WireType::Varint,
5643                )?;
5644                self.child_seq = ::buffa::types::decode_int32(buf)?;
5645            }
5646            12u32 => {
5647                ::buffa::encoding::check_wire_type(
5648                    tag,
5649                    ::buffa::encoding::WireType::Fixed64,
5650                )?;
5651                self.child_order_id = ::buffa::types::decode_fixed64(buf)?;
5652            }
5653            13u32 => {
5654                ::buffa::encoding::check_wire_type(
5655                    tag,
5656                    ::buffa::encoding::WireType::Varint,
5657                )?;
5658                self.fire_price_ticks = ::buffa::types::decode_int64(buf)?;
5659            }
5660            20u32 => {
5661                ::buffa::encoding::check_wire_type(
5662                    tag,
5663                    ::buffa::encoding::WireType::LengthDelimited,
5664                )?;
5665                ::buffa::types::merge_string(&mut self.reason, buf)?;
5666            }
5667            _ => {
5668                self.__buffa_unknown_fields
5669                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5670            }
5671        }
5672        ::core::result::Result::Ok(())
5673    }
5674    fn clear(&mut self) {
5675        self.trigger_id = 0u64;
5676        self.subaccount_id = 0u64;
5677        self.symbol_id = 0u32;
5678        self.trigger_type = ::buffa::EnumValue::from(0);
5679        self.event_type = ::buffa::EnumValue::from(0);
5680        self.ts_ns = 0u64;
5681        self.child_seq = 0i32;
5682        self.child_order_id = 0u64;
5683        self.fire_price_ticks = 0i64;
5684        self.reason.clear();
5685        self.__buffa_unknown_fields.clear();
5686    }
5687}
5688impl ::buffa::ExtensionSet for TriggerEvent {
5689    const PROTO_FQN: &'static str = "triggers.v1.TriggerEvent";
5690    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5691        &self.__buffa_unknown_fields
5692    }
5693    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5694        &mut self.__buffa_unknown_fields
5695    }
5696}
5697impl ::buffa::json_helpers::ProtoElemJson for TriggerEvent {
5698    fn serialize_proto_json<S: ::serde::Serializer>(
5699        v: &Self,
5700        s: S,
5701    ) -> ::core::result::Result<S::Ok, S::Error> {
5702        ::serde::Serialize::serialize(v, s)
5703    }
5704    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5705        d: D,
5706    ) -> ::core::result::Result<Self, D::Error> {
5707        <Self as ::serde::Deserialize>::deserialize(d)
5708    }
5709}
5710#[doc(hidden)]
5711pub const __TRIGGER_EVENT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5712    type_url: "type.googleapis.com/triggers.v1.TriggerEvent",
5713    to_json: ::buffa::type_registry::any_to_json::<TriggerEvent>,
5714    from_json: ::buffa::type_registry::any_from_json::<TriggerEvent>,
5715    is_wkt: false,
5716};
5717/// ListTriggerEventsResponse returns historical events ordered newest-first.
5718#[derive(Clone, PartialEq, Default)]
5719#[derive(::serde::Serialize, ::serde::Deserialize)]
5720#[serde(default)]
5721pub struct ListTriggerEventsResponse {
5722    /// Events ordered by event time descending, child sequence descending, and
5723    /// stable event tie-breakers descending.
5724    ///
5725    /// Field 1: `events`
5726    #[serde(
5727        rename = "events",
5728        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5729        deserialize_with = "::buffa::json_helpers::null_as_default"
5730    )]
5731    pub events: ::buffa::alloc::vec::Vec<TriggerEvent>,
5732    /// Opaque cursor for the next page. Empty when no more results exist.
5733    ///
5734    /// Field 3: `next_page_token`
5735    #[serde(
5736        rename = "nextPageToken",
5737        alias = "next_page_token",
5738        with = "::buffa::json_helpers::proto_string",
5739        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5740    )]
5741    pub next_page_token: ::buffa::alloc::string::String,
5742    #[serde(skip)]
5743    #[doc(hidden)]
5744    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5745}
5746impl ::core::fmt::Debug for ListTriggerEventsResponse {
5747    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5748        f.debug_struct("ListTriggerEventsResponse")
5749            .field("events", &self.events)
5750            .field("next_page_token", &self.next_page_token)
5751            .finish()
5752    }
5753}
5754impl ListTriggerEventsResponse {
5755    /// Protobuf type URL for this message, for use with `Any::pack` and
5756    /// `Any::unpack_if`.
5757    ///
5758    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5759    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
5760}
5761::buffa::impl_default_instance!(ListTriggerEventsResponse);
5762impl ::buffa::MessageName for ListTriggerEventsResponse {
5763    const PACKAGE: &'static str = "triggers.v1";
5764    const NAME: &'static str = "ListTriggerEventsResponse";
5765    const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsResponse";
5766    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
5767}
5768impl ::buffa::Message for ListTriggerEventsResponse {
5769    /// Returns the total encoded size in bytes.
5770    ///
5771    /// The result is a `u32`; the protobuf specification requires all
5772    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5773    /// compliant message will never overflow this type.
5774    #[allow(clippy::let_and_return)]
5775    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5776        #[allow(unused_imports)]
5777        use ::buffa::Enumeration as _;
5778        let mut size = 0u32;
5779        for v in &self.events {
5780            let __slot = __cache.reserve();
5781            let inner_size = v.compute_size(__cache);
5782            __cache.set(__slot, inner_size);
5783            size
5784                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5785                    + inner_size;
5786        }
5787        if !self.next_page_token.is_empty() {
5788            size
5789                += 1u32
5790                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5791        }
5792        size += self.__buffa_unknown_fields.encoded_len() as u32;
5793        size
5794    }
5795    fn write_to(
5796        &self,
5797        __cache: &mut ::buffa::SizeCache,
5798        buf: &mut impl ::buffa::bytes::BufMut,
5799    ) {
5800        #[allow(unused_imports)]
5801        use ::buffa::Enumeration as _;
5802        for v in &self.events {
5803            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
5804            v.write_to(__cache, buf);
5805        }
5806        if !self.next_page_token.is_empty() {
5807            ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
5808        }
5809        self.__buffa_unknown_fields.write_to(buf);
5810    }
5811    fn merge_field(
5812        &mut self,
5813        tag: ::buffa::encoding::Tag,
5814        buf: &mut impl ::buffa::bytes::Buf,
5815        ctx: ::buffa::DecodeContext<'_>,
5816    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5817        #[allow(unused_imports)]
5818        use ::buffa::bytes::Buf as _;
5819        #[allow(unused_imports)]
5820        use ::buffa::Enumeration as _;
5821        match tag.field_number() {
5822            1u32 => {
5823                ::buffa::encoding::check_wire_type(
5824                    tag,
5825                    ::buffa::encoding::WireType::LengthDelimited,
5826                )?;
5827                let mut elem = ::core::default::Default::default();
5828                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5829                self.events.push(elem);
5830            }
5831            3u32 => {
5832                ::buffa::encoding::check_wire_type(
5833                    tag,
5834                    ::buffa::encoding::WireType::LengthDelimited,
5835                )?;
5836                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5837            }
5838            _ => {
5839                self.__buffa_unknown_fields
5840                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5841            }
5842        }
5843        ::core::result::Result::Ok(())
5844    }
5845    fn clear(&mut self) {
5846        self.events.clear();
5847        self.next_page_token.clear();
5848        self.__buffa_unknown_fields.clear();
5849    }
5850}
5851impl ::buffa::ExtensionSet for ListTriggerEventsResponse {
5852    const PROTO_FQN: &'static str = "triggers.v1.ListTriggerEventsResponse";
5853    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5854        &self.__buffa_unknown_fields
5855    }
5856    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5857        &mut self.__buffa_unknown_fields
5858    }
5859}
5860impl ::buffa::json_helpers::ProtoElemJson for ListTriggerEventsResponse {
5861    fn serialize_proto_json<S: ::serde::Serializer>(
5862        v: &Self,
5863        s: S,
5864    ) -> ::core::result::Result<S::Ok, S::Error> {
5865        ::serde::Serialize::serialize(v, s)
5866    }
5867    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5868        d: D,
5869    ) -> ::core::result::Result<Self, D::Error> {
5870        <Self as ::serde::Deserialize>::deserialize(d)
5871    }
5872}
5873#[doc(hidden)]
5874pub const __LIST_TRIGGER_EVENTS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5875    type_url: "type.googleapis.com/triggers.v1.ListTriggerEventsResponse",
5876    to_json: ::buffa::type_registry::any_to_json::<ListTriggerEventsResponse>,
5877    from_json: ::buffa::type_registry::any_from_json::<ListTriggerEventsResponse>,
5878    is_wkt: false,
5879};
5880/// =============================================================================
5881/// Cancel Trigger
5882/// =============================================================================
5883///
5884/// CancelTriggerRequest cancels an active trigger by ID.
5885#[derive(Clone, PartialEq, Default)]
5886#[derive(::serde::Serialize, ::serde::Deserialize)]
5887#[serde(default)]
5888pub struct CancelTriggerRequest {
5889    /// Trigger ID to cancel.
5890    ///
5891    /// Field 1: `trigger_id`
5892    #[serde(
5893        rename = "triggerId",
5894        alias = "trigger_id",
5895        with = "::buffa::json_helpers::uint64",
5896        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5897    )]
5898    pub trigger_id: u64,
5899    /// Optional sub-account for authorization.
5900    ///
5901    /// Field 2: `subaccount_id`
5902    #[serde(
5903        rename = "subaccountId",
5904        alias = "subaccount_id",
5905        with = "::buffa::json_helpers::opt_uint64",
5906        skip_serializing_if = "::core::option::Option::is_none"
5907    )]
5908    pub subaccount_id: ::core::option::Option<u64>,
5909    #[serde(skip)]
5910    #[doc(hidden)]
5911    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5912}
5913impl ::core::fmt::Debug for CancelTriggerRequest {
5914    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5915        f.debug_struct("CancelTriggerRequest")
5916            .field("trigger_id", &self.trigger_id)
5917            .field("subaccount_id", &self.subaccount_id)
5918            .finish()
5919    }
5920}
5921impl CancelTriggerRequest {
5922    /// Protobuf type URL for this message, for use with `Any::pack` and
5923    /// `Any::unpack_if`.
5924    ///
5925    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5926    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
5927}
5928impl CancelTriggerRequest {
5929    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5930    #[inline]
5931    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
5932    pub fn with_subaccount_id(mut self, value: u64) -> Self {
5933        self.subaccount_id = Some(value);
5934        self
5935    }
5936}
5937::buffa::impl_default_instance!(CancelTriggerRequest);
5938impl ::buffa::MessageName for CancelTriggerRequest {
5939    const PACKAGE: &'static str = "triggers.v1";
5940    const NAME: &'static str = "CancelTriggerRequest";
5941    const FULL_NAME: &'static str = "triggers.v1.CancelTriggerRequest";
5942    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
5943}
5944impl ::buffa::Message for CancelTriggerRequest {
5945    /// Returns the total encoded size in bytes.
5946    ///
5947    /// The result is a `u32`; the protobuf specification requires all
5948    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5949    /// compliant message will never overflow this type.
5950    #[allow(clippy::let_and_return)]
5951    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5952        #[allow(unused_imports)]
5953        use ::buffa::Enumeration as _;
5954        let mut size = 0u32;
5955        if self.trigger_id != 0u64 {
5956            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5957        }
5958        if self.subaccount_id.is_some() {
5959            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
5960        }
5961        size += self.__buffa_unknown_fields.encoded_len() as u32;
5962        size
5963    }
5964    fn write_to(
5965        &self,
5966        _cache: &mut ::buffa::SizeCache,
5967        buf: &mut impl ::buffa::bytes::BufMut,
5968    ) {
5969        #[allow(unused_imports)]
5970        use ::buffa::Enumeration as _;
5971        if self.trigger_id != 0u64 {
5972            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
5973        }
5974        if let Some(v) = self.subaccount_id {
5975            ::buffa::types::put_fixed64_field(2u32, v, buf);
5976        }
5977        self.__buffa_unknown_fields.write_to(buf);
5978    }
5979    fn merge_field(
5980        &mut self,
5981        tag: ::buffa::encoding::Tag,
5982        buf: &mut impl ::buffa::bytes::Buf,
5983        ctx: ::buffa::DecodeContext<'_>,
5984    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5985        #[allow(unused_imports)]
5986        use ::buffa::bytes::Buf as _;
5987        #[allow(unused_imports)]
5988        use ::buffa::Enumeration as _;
5989        match tag.field_number() {
5990            1u32 => {
5991                ::buffa::encoding::check_wire_type(
5992                    tag,
5993                    ::buffa::encoding::WireType::Fixed64,
5994                )?;
5995                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
5996            }
5997            2u32 => {
5998                ::buffa::encoding::check_wire_type(
5999                    tag,
6000                    ::buffa::encoding::WireType::Fixed64,
6001                )?;
6002                self.subaccount_id = ::core::option::Option::Some(
6003                    ::buffa::types::decode_fixed64(buf)?,
6004                );
6005            }
6006            _ => {
6007                self.__buffa_unknown_fields
6008                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6009            }
6010        }
6011        ::core::result::Result::Ok(())
6012    }
6013    fn clear(&mut self) {
6014        self.trigger_id = 0u64;
6015        self.subaccount_id = ::core::option::Option::None;
6016        self.__buffa_unknown_fields.clear();
6017    }
6018}
6019impl ::buffa::ExtensionSet for CancelTriggerRequest {
6020    const PROTO_FQN: &'static str = "triggers.v1.CancelTriggerRequest";
6021    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6022        &self.__buffa_unknown_fields
6023    }
6024    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6025        &mut self.__buffa_unknown_fields
6026    }
6027}
6028impl ::buffa::json_helpers::ProtoElemJson for CancelTriggerRequest {
6029    fn serialize_proto_json<S: ::serde::Serializer>(
6030        v: &Self,
6031        s: S,
6032    ) -> ::core::result::Result<S::Ok, S::Error> {
6033        ::serde::Serialize::serialize(v, s)
6034    }
6035    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6036        d: D,
6037    ) -> ::core::result::Result<Self, D::Error> {
6038        <Self as ::serde::Deserialize>::deserialize(d)
6039    }
6040}
6041#[doc(hidden)]
6042pub const __CANCEL_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6043    type_url: "type.googleapis.com/triggers.v1.CancelTriggerRequest",
6044    to_json: ::buffa::type_registry::any_to_json::<CancelTriggerRequest>,
6045    from_json: ::buffa::type_registry::any_from_json::<CancelTriggerRequest>,
6046    is_wkt: false,
6047};
6048/// CancelTriggerResponse returns the final status after cancellation.
6049#[derive(Clone, PartialEq, Default)]
6050#[derive(::serde::Serialize, ::serde::Deserialize)]
6051#[serde(default)]
6052pub struct CancelTriggerResponse {
6053    /// Trigger ID that was canceled.
6054    ///
6055    /// Field 1: `trigger_id`
6056    #[serde(
6057        rename = "triggerId",
6058        alias = "trigger_id",
6059        with = "::buffa::json_helpers::uint64",
6060        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6061    )]
6062    pub trigger_id: u64,
6063    /// Final status (should be STATUS_CANCELED).
6064    ///
6065    /// Field 2: `status`
6066    #[serde(
6067        rename = "status",
6068        with = "::buffa::json_helpers::proto_enum",
6069        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6070    )]
6071    pub status: ::buffa::EnumValue<TriggerStatus>,
6072    /// Server timestamp.
6073    ///
6074    /// Field 3: `ts`
6075    #[serde(
6076        rename = "ts",
6077        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6078    )]
6079    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
6080    /// Server timestamp in nanoseconds since epoch (UTC).
6081    ///
6082    /// Field 4: `ts_ns`
6083    #[serde(
6084        rename = "tsNs",
6085        alias = "ts_ns",
6086        with = "::buffa::json_helpers::uint64",
6087        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6088    )]
6089    pub ts_ns: u64,
6090    #[serde(skip)]
6091    #[doc(hidden)]
6092    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6093}
6094impl ::core::fmt::Debug for CancelTriggerResponse {
6095    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6096        f.debug_struct("CancelTriggerResponse")
6097            .field("trigger_id", &self.trigger_id)
6098            .field("status", &self.status)
6099            .field("ts", &self.ts)
6100            .field("ts_ns", &self.ts_ns)
6101            .finish()
6102    }
6103}
6104impl CancelTriggerResponse {
6105    /// Protobuf type URL for this message, for use with `Any::pack` and
6106    /// `Any::unpack_if`.
6107    ///
6108    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6109    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
6110}
6111::buffa::impl_default_instance!(CancelTriggerResponse);
6112impl ::buffa::MessageName for CancelTriggerResponse {
6113    const PACKAGE: &'static str = "triggers.v1";
6114    const NAME: &'static str = "CancelTriggerResponse";
6115    const FULL_NAME: &'static str = "triggers.v1.CancelTriggerResponse";
6116    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
6117}
6118impl ::buffa::Message for CancelTriggerResponse {
6119    /// Returns the total encoded size in bytes.
6120    ///
6121    /// The result is a `u32`; the protobuf specification requires all
6122    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6123    /// compliant message will never overflow this type.
6124    #[allow(clippy::let_and_return)]
6125    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6126        #[allow(unused_imports)]
6127        use ::buffa::Enumeration as _;
6128        let mut size = 0u32;
6129        if self.trigger_id != 0u64 {
6130            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6131        }
6132        {
6133            let val = self.status.to_i32();
6134            if val != 0 {
6135                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
6136            }
6137        }
6138        if self.ts.is_set() {
6139            let __slot = __cache.reserve();
6140            let inner_size = self.ts.compute_size(__cache);
6141            __cache.set(__slot, inner_size);
6142            size
6143                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6144                    + inner_size;
6145        }
6146        if self.ts_ns != 0u64 {
6147            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
6148        }
6149        size += self.__buffa_unknown_fields.encoded_len() as u32;
6150        size
6151    }
6152    fn write_to(
6153        &self,
6154        __cache: &mut ::buffa::SizeCache,
6155        buf: &mut impl ::buffa::bytes::BufMut,
6156    ) {
6157        #[allow(unused_imports)]
6158        use ::buffa::Enumeration as _;
6159        if self.trigger_id != 0u64 {
6160            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6161        }
6162        {
6163            let val = self.status.to_i32();
6164            if val != 0 {
6165                ::buffa::types::put_int32_field(2u32, val, buf);
6166            }
6167        }
6168        if self.ts.is_set() {
6169            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
6170            self.ts.write_to(__cache, buf);
6171        }
6172        if self.ts_ns != 0u64 {
6173            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
6174        }
6175        self.__buffa_unknown_fields.write_to(buf);
6176    }
6177    fn merge_field(
6178        &mut self,
6179        tag: ::buffa::encoding::Tag,
6180        buf: &mut impl ::buffa::bytes::Buf,
6181        ctx: ::buffa::DecodeContext<'_>,
6182    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6183        #[allow(unused_imports)]
6184        use ::buffa::bytes::Buf as _;
6185        #[allow(unused_imports)]
6186        use ::buffa::Enumeration as _;
6187        match tag.field_number() {
6188            1u32 => {
6189                ::buffa::encoding::check_wire_type(
6190                    tag,
6191                    ::buffa::encoding::WireType::Fixed64,
6192                )?;
6193                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6194            }
6195            2u32 => {
6196                ::buffa::encoding::check_wire_type(
6197                    tag,
6198                    ::buffa::encoding::WireType::Varint,
6199                )?;
6200                self.status = ::buffa::EnumValue::from(
6201                    ::buffa::types::decode_int32(buf)?,
6202                );
6203            }
6204            3u32 => {
6205                ::buffa::encoding::check_wire_type(
6206                    tag,
6207                    ::buffa::encoding::WireType::LengthDelimited,
6208                )?;
6209                ::buffa::Message::merge_length_delimited(
6210                    self.ts.get_or_insert_default(),
6211                    buf,
6212                    ctx,
6213                )?;
6214            }
6215            4u32 => {
6216                ::buffa::encoding::check_wire_type(
6217                    tag,
6218                    ::buffa::encoding::WireType::Varint,
6219                )?;
6220                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
6221            }
6222            _ => {
6223                self.__buffa_unknown_fields
6224                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6225            }
6226        }
6227        ::core::result::Result::Ok(())
6228    }
6229    fn clear(&mut self) {
6230        self.trigger_id = 0u64;
6231        self.status = ::buffa::EnumValue::from(0);
6232        self.ts = ::buffa::MessageField::none();
6233        self.ts_ns = 0u64;
6234        self.__buffa_unknown_fields.clear();
6235    }
6236}
6237impl ::buffa::ExtensionSet for CancelTriggerResponse {
6238    const PROTO_FQN: &'static str = "triggers.v1.CancelTriggerResponse";
6239    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6240        &self.__buffa_unknown_fields
6241    }
6242    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6243        &mut self.__buffa_unknown_fields
6244    }
6245}
6246impl ::buffa::json_helpers::ProtoElemJson for CancelTriggerResponse {
6247    fn serialize_proto_json<S: ::serde::Serializer>(
6248        v: &Self,
6249        s: S,
6250    ) -> ::core::result::Result<S::Ok, S::Error> {
6251        ::serde::Serialize::serialize(v, s)
6252    }
6253    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6254        d: D,
6255    ) -> ::core::result::Result<Self, D::Error> {
6256        <Self as ::serde::Deserialize>::deserialize(d)
6257    }
6258}
6259#[doc(hidden)]
6260pub const __CANCEL_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6261    type_url: "type.googleapis.com/triggers.v1.CancelTriggerResponse",
6262    to_json: ::buffa::type_registry::any_to_json::<CancelTriggerResponse>,
6263    from_json: ::buffa::type_registry::any_from_json::<CancelTriggerResponse>,
6264    is_wkt: false,
6265};
6266/// =============================================================================
6267/// Modify / Pause / Resume Trigger
6268/// =============================================================================
6269///
6270/// ModifyTriggerRequest applies a limited patch to an existing trigger.
6271#[derive(Clone, PartialEq, Default)]
6272#[derive(::serde::Serialize)]
6273#[serde(default)]
6274pub struct ModifyTriggerRequest {
6275    /// Trigger ID to modify.
6276    ///
6277    /// Field 1: `trigger_id`
6278    #[serde(
6279        rename = "triggerId",
6280        alias = "trigger_id",
6281        with = "::buffa::json_helpers::uint64",
6282        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6283    )]
6284    pub trigger_id: u64,
6285    /// Optional sub-account for authorization.
6286    ///
6287    /// Field 2: `subaccount_id`
6288    #[serde(
6289        rename = "subaccountId",
6290        alias = "subaccount_id",
6291        with = "::buffa::json_helpers::opt_uint64",
6292        skip_serializing_if = "::core::option::Option::is_none"
6293    )]
6294    pub subaccount_id: ::core::option::Option<u64>,
6295    /// Patch fields for safe price, trailing-distance, and slippage edits.
6296    /// For stop/take-profit:
6297    /// Updated trigger price in quote units scaled by 1e6.
6298    ///
6299    /// Field 10: `trigger_price_ticks`
6300    #[serde(
6301        rename = "triggerPriceTicks",
6302        alias = "trigger_price_ticks",
6303        with = "::buffa::json_helpers::opt_int64",
6304        skip_serializing_if = "::core::option::Option::is_none"
6305    )]
6306    pub trigger_price_ticks: ::core::option::Option<i64>,
6307    /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
6308    ///
6309    /// Field 11: `limit_price_ticks`
6310    #[serde(
6311        rename = "limitPriceTicks",
6312        alias = "limit_price_ticks",
6313        with = "::buffa::json_helpers::opt_int64",
6314        skip_serializing_if = "::core::option::Option::is_none"
6315    )]
6316    pub limit_price_ticks: ::core::option::Option<i64>,
6317    /// Updated activation price in quote units scaled by 1e6.
6318    ///
6319    /// Field 14: `activation_price_ticks`
6320    #[serde(
6321        rename = "activationPriceTicks",
6322        alias = "activation_price_ticks",
6323        with = "::buffa::json_helpers::opt_int64",
6324        skip_serializing_if = "::core::option::Option::is_none"
6325    )]
6326    pub activation_price_ticks: ::core::option::Option<i64>,
6327    #[serde(flatten)]
6328    pub trailing_distance: ::core::option::Option<
6329        __buffa::oneof::modify_trigger_request::TrailingDistance,
6330    >,
6331    #[serde(flatten)]
6332    pub max_slippage: ::core::option::Option<
6333        __buffa::oneof::modify_trigger_request::MaxSlippage,
6334    >,
6335    #[serde(skip)]
6336    #[doc(hidden)]
6337    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6338}
6339impl ::core::fmt::Debug for ModifyTriggerRequest {
6340    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6341        f.debug_struct("ModifyTriggerRequest")
6342            .field("trigger_id", &self.trigger_id)
6343            .field("subaccount_id", &self.subaccount_id)
6344            .field("trigger_price_ticks", &self.trigger_price_ticks)
6345            .field("limit_price_ticks", &self.limit_price_ticks)
6346            .field("activation_price_ticks", &self.activation_price_ticks)
6347            .field("trailing_distance", &self.trailing_distance)
6348            .field("max_slippage", &self.max_slippage)
6349            .finish()
6350    }
6351}
6352impl ModifyTriggerRequest {
6353    /// Protobuf type URL for this message, for use with `Any::pack` and
6354    /// `Any::unpack_if`.
6355    ///
6356    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6357    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
6358}
6359impl ModifyTriggerRequest {
6360    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6361    #[inline]
6362    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
6363    pub fn with_subaccount_id(mut self, value: u64) -> Self {
6364        self.subaccount_id = Some(value);
6365        self
6366    }
6367    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6368    #[inline]
6369    ///Sets [`Self::trigger_price_ticks`] to `Some(value)`, consuming and returning `self`.
6370    pub fn with_trigger_price_ticks(mut self, value: i64) -> Self {
6371        self.trigger_price_ticks = Some(value);
6372        self
6373    }
6374    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6375    #[inline]
6376    ///Sets [`Self::limit_price_ticks`] to `Some(value)`, consuming and returning `self`.
6377    pub fn with_limit_price_ticks(mut self, value: i64) -> Self {
6378        self.limit_price_ticks = Some(value);
6379        self
6380    }
6381    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6382    #[inline]
6383    ///Sets [`Self::activation_price_ticks`] to `Some(value)`, consuming and returning `self`.
6384    pub fn with_activation_price_ticks(mut self, value: i64) -> Self {
6385        self.activation_price_ticks = Some(value);
6386        self
6387    }
6388}
6389::buffa::impl_default_instance!(ModifyTriggerRequest);
6390impl ::buffa::MessageName for ModifyTriggerRequest {
6391    const PACKAGE: &'static str = "triggers.v1";
6392    const NAME: &'static str = "ModifyTriggerRequest";
6393    const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerRequest";
6394    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
6395}
6396impl ::buffa::Message for ModifyTriggerRequest {
6397    /// Returns the total encoded size in bytes.
6398    ///
6399    /// The result is a `u32`; the protobuf specification requires all
6400    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6401    /// compliant message will never overflow this type.
6402    #[allow(clippy::let_and_return)]
6403    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6404        #[allow(unused_imports)]
6405        use ::buffa::Enumeration as _;
6406        let mut size = 0u32;
6407        if self.trigger_id != 0u64 {
6408            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6409        }
6410        if self.subaccount_id.is_some() {
6411            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
6412        }
6413        if let Some(v) = self.trigger_price_ticks {
6414            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6415        }
6416        if let Some(v) = self.limit_price_ticks {
6417            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6418        }
6419        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
6420            match v {
6421                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6422                    v,
6423                ) => {
6424                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
6425                }
6426                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6427                    v,
6428                ) => {
6429                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6430                }
6431            }
6432        }
6433        if let Some(v) = self.activation_price_ticks {
6434            size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
6435        }
6436        if let ::core::option::Option::Some(ref v) = self.max_slippage {
6437            match v {
6438                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6439                    v,
6440                ) => {
6441                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6442                }
6443                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6444                    v,
6445                ) => {
6446                    size += 2u32 + ::buffa::types::int32_encoded_len(*v) as u32;
6447                }
6448            }
6449        }
6450        size += self.__buffa_unknown_fields.encoded_len() as u32;
6451        size
6452    }
6453    fn write_to(
6454        &self,
6455        _cache: &mut ::buffa::SizeCache,
6456        buf: &mut impl ::buffa::bytes::BufMut,
6457    ) {
6458        #[allow(unused_imports)]
6459        use ::buffa::Enumeration as _;
6460        if self.trigger_id != 0u64 {
6461            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
6462        }
6463        if let Some(v) = self.subaccount_id {
6464            ::buffa::types::put_fixed64_field(2u32, v, buf);
6465        }
6466        if let Some(v) = self.trigger_price_ticks {
6467            ::buffa::types::put_int64_field(10u32, v, buf);
6468        }
6469        if let Some(v) = self.limit_price_ticks {
6470            ::buffa::types::put_int64_field(11u32, v, buf);
6471        }
6472        if let ::core::option::Option::Some(ref v) = self.trailing_distance {
6473            match v {
6474                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6475                    x,
6476                ) => {
6477                    ::buffa::types::put_int64_field(12u32, *x, buf);
6478                }
6479                __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6480                    x,
6481                ) => {
6482                    ::buffa::types::put_int32_field(13u32, *x, buf);
6483                }
6484            }
6485        }
6486        if let Some(v) = self.activation_price_ticks {
6487            ::buffa::types::put_int64_field(14u32, v, buf);
6488        }
6489        if let ::core::option::Option::Some(ref v) = self.max_slippage {
6490            match v {
6491                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6492                    x,
6493                ) => {
6494                    ::buffa::types::put_int32_field(15u32, *x, buf);
6495                }
6496                __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6497                    x,
6498                ) => {
6499                    ::buffa::types::put_int32_field(16u32, *x, buf);
6500                }
6501            }
6502        }
6503        self.__buffa_unknown_fields.write_to(buf);
6504    }
6505    fn merge_field(
6506        &mut self,
6507        tag: ::buffa::encoding::Tag,
6508        buf: &mut impl ::buffa::bytes::Buf,
6509        ctx: ::buffa::DecodeContext<'_>,
6510    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6511        #[allow(unused_imports)]
6512        use ::buffa::bytes::Buf as _;
6513        #[allow(unused_imports)]
6514        use ::buffa::Enumeration as _;
6515        match tag.field_number() {
6516            1u32 => {
6517                ::buffa::encoding::check_wire_type(
6518                    tag,
6519                    ::buffa::encoding::WireType::Fixed64,
6520                )?;
6521                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
6522            }
6523            2u32 => {
6524                ::buffa::encoding::check_wire_type(
6525                    tag,
6526                    ::buffa::encoding::WireType::Fixed64,
6527                )?;
6528                self.subaccount_id = ::core::option::Option::Some(
6529                    ::buffa::types::decode_fixed64(buf)?,
6530                );
6531            }
6532            10u32 => {
6533                ::buffa::encoding::check_wire_type(
6534                    tag,
6535                    ::buffa::encoding::WireType::Varint,
6536                )?;
6537                self.trigger_price_ticks = ::core::option::Option::Some(
6538                    ::buffa::types::decode_int64(buf)?,
6539                );
6540            }
6541            11u32 => {
6542                ::buffa::encoding::check_wire_type(
6543                    tag,
6544                    ::buffa::encoding::WireType::Varint,
6545                )?;
6546                self.limit_price_ticks = ::core::option::Option::Some(
6547                    ::buffa::types::decode_int64(buf)?,
6548                );
6549            }
6550            12u32 => {
6551                ::buffa::encoding::check_wire_type(
6552                    tag,
6553                    ::buffa::encoding::WireType::Varint,
6554                )?;
6555                self.trailing_distance = ::core::option::Option::Some(
6556                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6557                        ::buffa::types::decode_int64(buf)?,
6558                    ),
6559                );
6560            }
6561            13u32 => {
6562                ::buffa::encoding::check_wire_type(
6563                    tag,
6564                    ::buffa::encoding::WireType::Varint,
6565                )?;
6566                self.trailing_distance = ::core::option::Option::Some(
6567                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6568                        ::buffa::types::decode_int32(buf)?,
6569                    ),
6570                );
6571            }
6572            14u32 => {
6573                ::buffa::encoding::check_wire_type(
6574                    tag,
6575                    ::buffa::encoding::WireType::Varint,
6576                )?;
6577                self.activation_price_ticks = ::core::option::Option::Some(
6578                    ::buffa::types::decode_int64(buf)?,
6579                );
6580            }
6581            15u32 => {
6582                ::buffa::encoding::check_wire_type(
6583                    tag,
6584                    ::buffa::encoding::WireType::Varint,
6585                )?;
6586                self.max_slippage = ::core::option::Option::Some(
6587                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6588                        ::buffa::types::decode_int32(buf)?,
6589                    ),
6590                );
6591            }
6592            16u32 => {
6593                ::buffa::encoding::check_wire_type(
6594                    tag,
6595                    ::buffa::encoding::WireType::Varint,
6596                )?;
6597                self.max_slippage = ::core::option::Option::Some(
6598                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6599                        ::buffa::types::decode_int32(buf)?,
6600                    ),
6601                );
6602            }
6603            _ => {
6604                self.__buffa_unknown_fields
6605                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6606            }
6607        }
6608        ::core::result::Result::Ok(())
6609    }
6610    fn clear(&mut self) {
6611        self.trigger_id = 0u64;
6612        self.subaccount_id = ::core::option::Option::None;
6613        self.trigger_price_ticks = ::core::option::Option::None;
6614        self.limit_price_ticks = ::core::option::Option::None;
6615        self.trailing_distance = ::core::option::Option::None;
6616        self.activation_price_ticks = ::core::option::Option::None;
6617        self.max_slippage = ::core::option::Option::None;
6618        self.__buffa_unknown_fields.clear();
6619    }
6620}
6621impl ::buffa::ExtensionSet for ModifyTriggerRequest {
6622    const PROTO_FQN: &'static str = "triggers.v1.ModifyTriggerRequest";
6623    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6624        &self.__buffa_unknown_fields
6625    }
6626    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6627        &mut self.__buffa_unknown_fields
6628    }
6629}
6630impl<'de> serde::Deserialize<'de> for ModifyTriggerRequest {
6631    fn deserialize<D: serde::Deserializer<'de>>(
6632        d: D,
6633    ) -> ::core::result::Result<Self, D::Error> {
6634        struct _V;
6635        impl<'de> serde::de::Visitor<'de> for _V {
6636            type Value = ModifyTriggerRequest;
6637            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
6638                f.write_str("struct ModifyTriggerRequest")
6639            }
6640            #[allow(clippy::field_reassign_with_default)]
6641            fn visit_map<A: serde::de::MapAccess<'de>>(
6642                self,
6643                mut map: A,
6644            ) -> ::core::result::Result<ModifyTriggerRequest, A::Error> {
6645                let mut __f_trigger_id: ::core::option::Option<u64> = None;
6646                let mut __f_subaccount_id: ::core::option::Option<
6647                    ::core::option::Option<u64>,
6648                > = None;
6649                let mut __f_trigger_price_ticks: ::core::option::Option<
6650                    ::core::option::Option<i64>,
6651                > = None;
6652                let mut __f_limit_price_ticks: ::core::option::Option<
6653                    ::core::option::Option<i64>,
6654                > = None;
6655                let mut __f_activation_price_ticks: ::core::option::Option<
6656                    ::core::option::Option<i64>,
6657                > = None;
6658                let mut __oneof_trailing_distance: ::core::option::Option<
6659                    __buffa::oneof::modify_trigger_request::TrailingDistance,
6660                > = None;
6661                let mut __oneof_max_slippage: ::core::option::Option<
6662                    __buffa::oneof::modify_trigger_request::MaxSlippage,
6663                > = None;
6664                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
6665                    match key.as_str() {
6666                        "triggerId" | "trigger_id" => {
6667                            __f_trigger_id = Some({
6668                                struct _S;
6669                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6670                                    type Value = u64;
6671                                    fn deserialize<D: serde::Deserializer<'de>>(
6672                                        self,
6673                                        d: D,
6674                                    ) -> ::core::result::Result<u64, D::Error> {
6675                                        ::buffa::json_helpers::uint64::deserialize(d)
6676                                    }
6677                                }
6678                                map.next_value_seed(_S)?
6679                            });
6680                        }
6681                        "subaccountId" | "subaccount_id" => {
6682                            __f_subaccount_id = Some({
6683                                struct _S;
6684                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6685                                    type Value = ::core::option::Option<u64>;
6686                                    fn deserialize<D: serde::Deserializer<'de>>(
6687                                        self,
6688                                        d: D,
6689                                    ) -> ::core::result::Result<
6690                                        ::core::option::Option<u64>,
6691                                        D::Error,
6692                                    > {
6693                                        ::buffa::json_helpers::opt_uint64::deserialize(d)
6694                                    }
6695                                }
6696                                map.next_value_seed(_S)?
6697                            });
6698                        }
6699                        "triggerPriceTicks" | "trigger_price_ticks" => {
6700                            __f_trigger_price_ticks = Some({
6701                                struct _S;
6702                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6703                                    type Value = ::core::option::Option<i64>;
6704                                    fn deserialize<D: serde::Deserializer<'de>>(
6705                                        self,
6706                                        d: D,
6707                                    ) -> ::core::result::Result<
6708                                        ::core::option::Option<i64>,
6709                                        D::Error,
6710                                    > {
6711                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6712                                    }
6713                                }
6714                                map.next_value_seed(_S)?
6715                            });
6716                        }
6717                        "limitPriceTicks" | "limit_price_ticks" => {
6718                            __f_limit_price_ticks = Some({
6719                                struct _S;
6720                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6721                                    type Value = ::core::option::Option<i64>;
6722                                    fn deserialize<D: serde::Deserializer<'de>>(
6723                                        self,
6724                                        d: D,
6725                                    ) -> ::core::result::Result<
6726                                        ::core::option::Option<i64>,
6727                                        D::Error,
6728                                    > {
6729                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6730                                    }
6731                                }
6732                                map.next_value_seed(_S)?
6733                            });
6734                        }
6735                        "activationPriceTicks" | "activation_price_ticks" => {
6736                            __f_activation_price_ticks = Some({
6737                                struct _S;
6738                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
6739                                    type Value = ::core::option::Option<i64>;
6740                                    fn deserialize<D: serde::Deserializer<'de>>(
6741                                        self,
6742                                        d: D,
6743                                    ) -> ::core::result::Result<
6744                                        ::core::option::Option<i64>,
6745                                        D::Error,
6746                                    > {
6747                                        ::buffa::json_helpers::opt_int64::deserialize(d)
6748                                    }
6749                                }
6750                                map.next_value_seed(_S)?
6751                            });
6752                        }
6753                        "trailingDistanceTicks" | "trailing_distance_ticks" => {
6754                            struct _DeserSeed;
6755                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6756                                type Value = i64;
6757                                fn deserialize<D: serde::Deserializer<'de>>(
6758                                    self,
6759                                    d: D,
6760                                ) -> ::core::result::Result<i64, D::Error> {
6761                                    ::buffa::json_helpers::int64::deserialize(d)
6762                                }
6763                            }
6764                            let v: ::core::option::Option<i64> = map
6765                                .next_value_seed(
6766                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6767                                )?;
6768                            if let Some(v) = v {
6769                                if __oneof_trailing_distance.is_some() {
6770                                    return Err(
6771                                        serde::de::Error::custom(
6772                                            "multiple oneof fields set for 'trailing_distance'",
6773                                        ),
6774                                    );
6775                                }
6776                                __oneof_trailing_distance = Some(
6777                                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
6778                                        v,
6779                                    ),
6780                                );
6781                            }
6782                        }
6783                        "trailingDistanceBps" | "trailing_distance_bps" => {
6784                            struct _DeserSeed;
6785                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6786                                type Value = i32;
6787                                fn deserialize<D: serde::Deserializer<'de>>(
6788                                    self,
6789                                    d: D,
6790                                ) -> ::core::result::Result<i32, D::Error> {
6791                                    ::buffa::json_helpers::int32::deserialize(d)
6792                                }
6793                            }
6794                            let v: ::core::option::Option<i32> = map
6795                                .next_value_seed(
6796                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6797                                )?;
6798                            if let Some(v) = v {
6799                                if __oneof_trailing_distance.is_some() {
6800                                    return Err(
6801                                        serde::de::Error::custom(
6802                                            "multiple oneof fields set for 'trailing_distance'",
6803                                        ),
6804                                    );
6805                                }
6806                                __oneof_trailing_distance = Some(
6807                                    __buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
6808                                        v,
6809                                    ),
6810                                );
6811                            }
6812                        }
6813                        "maxSlippageTicks" | "max_slippage_ticks" => {
6814                            struct _DeserSeed;
6815                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6816                                type Value = i32;
6817                                fn deserialize<D: serde::Deserializer<'de>>(
6818                                    self,
6819                                    d: D,
6820                                ) -> ::core::result::Result<i32, D::Error> {
6821                                    ::buffa::json_helpers::int32::deserialize(d)
6822                                }
6823                            }
6824                            let v: ::core::option::Option<i32> = map
6825                                .next_value_seed(
6826                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6827                                )?;
6828                            if let Some(v) = v {
6829                                if __oneof_max_slippage.is_some() {
6830                                    return Err(
6831                                        serde::de::Error::custom(
6832                                            "multiple oneof fields set for 'max_slippage'",
6833                                        ),
6834                                    );
6835                                }
6836                                __oneof_max_slippage = Some(
6837                                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
6838                                        v,
6839                                    ),
6840                                );
6841                            }
6842                        }
6843                        "maxSlippageBps" | "max_slippage_bps" => {
6844                            struct _DeserSeed;
6845                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
6846                                type Value = i32;
6847                                fn deserialize<D: serde::Deserializer<'de>>(
6848                                    self,
6849                                    d: D,
6850                                ) -> ::core::result::Result<i32, D::Error> {
6851                                    ::buffa::json_helpers::int32::deserialize(d)
6852                                }
6853                            }
6854                            let v: ::core::option::Option<i32> = map
6855                                .next_value_seed(
6856                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
6857                                )?;
6858                            if let Some(v) = v {
6859                                if __oneof_max_slippage.is_some() {
6860                                    return Err(
6861                                        serde::de::Error::custom(
6862                                            "multiple oneof fields set for 'max_slippage'",
6863                                        ),
6864                                    );
6865                                }
6866                                __oneof_max_slippage = Some(
6867                                    __buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
6868                                        v,
6869                                    ),
6870                                );
6871                            }
6872                        }
6873                        _ => {
6874                            map.next_value::<serde::de::IgnoredAny>()?;
6875                        }
6876                    }
6877                }
6878                let mut __r = <ModifyTriggerRequest as ::core::default::Default>::default();
6879                if let ::core::option::Option::Some(v) = __f_trigger_id {
6880                    __r.trigger_id = v;
6881                }
6882                if let ::core::option::Option::Some(v) = __f_subaccount_id {
6883                    __r.subaccount_id = v;
6884                }
6885                if let ::core::option::Option::Some(v) = __f_trigger_price_ticks {
6886                    __r.trigger_price_ticks = v;
6887                }
6888                if let ::core::option::Option::Some(v) = __f_limit_price_ticks {
6889                    __r.limit_price_ticks = v;
6890                }
6891                if let ::core::option::Option::Some(v) = __f_activation_price_ticks {
6892                    __r.activation_price_ticks = v;
6893                }
6894                __r.trailing_distance = __oneof_trailing_distance;
6895                __r.max_slippage = __oneof_max_slippage;
6896                Ok(__r)
6897            }
6898        }
6899        d.deserialize_map(_V)
6900    }
6901}
6902impl ::buffa::json_helpers::ProtoElemJson for ModifyTriggerRequest {
6903    fn serialize_proto_json<S: ::serde::Serializer>(
6904        v: &Self,
6905        s: S,
6906    ) -> ::core::result::Result<S::Ok, S::Error> {
6907        ::serde::Serialize::serialize(v, s)
6908    }
6909    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6910        d: D,
6911    ) -> ::core::result::Result<Self, D::Error> {
6912        <Self as ::serde::Deserialize>::deserialize(d)
6913    }
6914}
6915#[doc(hidden)]
6916pub const __MODIFY_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6917    type_url: "type.googleapis.com/triggers.v1.ModifyTriggerRequest",
6918    to_json: ::buffa::type_registry::any_to_json::<ModifyTriggerRequest>,
6919    from_json: ::buffa::type_registry::any_from_json::<ModifyTriggerRequest>,
6920    is_wkt: false,
6921};
6922pub mod modify_trigger_request {
6923    #[allow(unused_imports)]
6924    use super::*;
6925    #[doc(inline)]
6926    pub use super::__buffa::oneof::modify_trigger_request::TrailingDistance;
6927    #[doc(inline)]
6928    pub use super::__buffa::oneof::modify_trigger_request::MaxSlippage;
6929    #[doc(inline)]
6930    pub use super::__buffa::view::oneof::modify_trigger_request::TrailingDistance as TrailingDistanceView;
6931    #[doc(inline)]
6932    pub use super::__buffa::view::oneof::modify_trigger_request::MaxSlippage as MaxSlippageView;
6933}
6934/// ModifyTriggerResponse returns the trigger status after modification.
6935#[derive(Clone, PartialEq, Default)]
6936#[derive(::serde::Serialize, ::serde::Deserialize)]
6937#[serde(default)]
6938pub struct ModifyTriggerResponse {
6939    /// Modified trigger ID.
6940    ///
6941    /// Field 1: `trigger_id`
6942    #[serde(
6943        rename = "triggerId",
6944        alias = "trigger_id",
6945        with = "::buffa::json_helpers::uint64",
6946        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6947    )]
6948    pub trigger_id: u64,
6949    /// Current trigger status after modification.
6950    ///
6951    /// Field 2: `status`
6952    #[serde(
6953        rename = "status",
6954        with = "::buffa::json_helpers::proto_enum",
6955        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6956    )]
6957    pub status: ::buffa::EnumValue<TriggerStatus>,
6958    /// Server timestamp.
6959    ///
6960    /// Field 3: `ts`
6961    #[serde(
6962        rename = "ts",
6963        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6964    )]
6965    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
6966    /// Server timestamp in nanoseconds since epoch (UTC).
6967    ///
6968    /// Field 4: `ts_ns`
6969    #[serde(
6970        rename = "tsNs",
6971        alias = "ts_ns",
6972        with = "::buffa::json_helpers::uint64",
6973        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6974    )]
6975    pub ts_ns: u64,
6976    #[serde(skip)]
6977    #[doc(hidden)]
6978    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6979}
6980impl ::core::fmt::Debug for ModifyTriggerResponse {
6981    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6982        f.debug_struct("ModifyTriggerResponse")
6983            .field("trigger_id", &self.trigger_id)
6984            .field("status", &self.status)
6985            .field("ts", &self.ts)
6986            .field("ts_ns", &self.ts_ns)
6987            .finish()
6988    }
6989}
6990impl ModifyTriggerResponse {
6991    /// Protobuf type URL for this message, for use with `Any::pack` and
6992    /// `Any::unpack_if`.
6993    ///
6994    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6995    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
6996}
6997::buffa::impl_default_instance!(ModifyTriggerResponse);
6998impl ::buffa::MessageName for ModifyTriggerResponse {
6999    const PACKAGE: &'static str = "triggers.v1";
7000    const NAME: &'static str = "ModifyTriggerResponse";
7001    const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerResponse";
7002    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
7003}
7004impl ::buffa::Message for ModifyTriggerResponse {
7005    /// Returns the total encoded size in bytes.
7006    ///
7007    /// The result is a `u32`; the protobuf specification requires all
7008    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7009    /// compliant message will never overflow this type.
7010    #[allow(clippy::let_and_return)]
7011    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7012        #[allow(unused_imports)]
7013        use ::buffa::Enumeration as _;
7014        let mut size = 0u32;
7015        if self.trigger_id != 0u64 {
7016            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7017        }
7018        {
7019            let val = self.status.to_i32();
7020            if val != 0 {
7021                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7022            }
7023        }
7024        if self.ts.is_set() {
7025            let __slot = __cache.reserve();
7026            let inner_size = self.ts.compute_size(__cache);
7027            __cache.set(__slot, inner_size);
7028            size
7029                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7030                    + inner_size;
7031        }
7032        if self.ts_ns != 0u64 {
7033            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7034        }
7035        size += self.__buffa_unknown_fields.encoded_len() as u32;
7036        size
7037    }
7038    fn write_to(
7039        &self,
7040        __cache: &mut ::buffa::SizeCache,
7041        buf: &mut impl ::buffa::bytes::BufMut,
7042    ) {
7043        #[allow(unused_imports)]
7044        use ::buffa::Enumeration as _;
7045        if self.trigger_id != 0u64 {
7046            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7047        }
7048        {
7049            let val = self.status.to_i32();
7050            if val != 0 {
7051                ::buffa::types::put_int32_field(2u32, val, buf);
7052            }
7053        }
7054        if self.ts.is_set() {
7055            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7056            self.ts.write_to(__cache, buf);
7057        }
7058        if self.ts_ns != 0u64 {
7059            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7060        }
7061        self.__buffa_unknown_fields.write_to(buf);
7062    }
7063    fn merge_field(
7064        &mut self,
7065        tag: ::buffa::encoding::Tag,
7066        buf: &mut impl ::buffa::bytes::Buf,
7067        ctx: ::buffa::DecodeContext<'_>,
7068    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7069        #[allow(unused_imports)]
7070        use ::buffa::bytes::Buf as _;
7071        #[allow(unused_imports)]
7072        use ::buffa::Enumeration as _;
7073        match tag.field_number() {
7074            1u32 => {
7075                ::buffa::encoding::check_wire_type(
7076                    tag,
7077                    ::buffa::encoding::WireType::Fixed64,
7078                )?;
7079                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7080            }
7081            2u32 => {
7082                ::buffa::encoding::check_wire_type(
7083                    tag,
7084                    ::buffa::encoding::WireType::Varint,
7085                )?;
7086                self.status = ::buffa::EnumValue::from(
7087                    ::buffa::types::decode_int32(buf)?,
7088                );
7089            }
7090            3u32 => {
7091                ::buffa::encoding::check_wire_type(
7092                    tag,
7093                    ::buffa::encoding::WireType::LengthDelimited,
7094                )?;
7095                ::buffa::Message::merge_length_delimited(
7096                    self.ts.get_or_insert_default(),
7097                    buf,
7098                    ctx,
7099                )?;
7100            }
7101            4u32 => {
7102                ::buffa::encoding::check_wire_type(
7103                    tag,
7104                    ::buffa::encoding::WireType::Varint,
7105                )?;
7106                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7107            }
7108            _ => {
7109                self.__buffa_unknown_fields
7110                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7111            }
7112        }
7113        ::core::result::Result::Ok(())
7114    }
7115    fn clear(&mut self) {
7116        self.trigger_id = 0u64;
7117        self.status = ::buffa::EnumValue::from(0);
7118        self.ts = ::buffa::MessageField::none();
7119        self.ts_ns = 0u64;
7120        self.__buffa_unknown_fields.clear();
7121    }
7122}
7123impl ::buffa::ExtensionSet for ModifyTriggerResponse {
7124    const PROTO_FQN: &'static str = "triggers.v1.ModifyTriggerResponse";
7125    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7126        &self.__buffa_unknown_fields
7127    }
7128    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7129        &mut self.__buffa_unknown_fields
7130    }
7131}
7132impl ::buffa::json_helpers::ProtoElemJson for ModifyTriggerResponse {
7133    fn serialize_proto_json<S: ::serde::Serializer>(
7134        v: &Self,
7135        s: S,
7136    ) -> ::core::result::Result<S::Ok, S::Error> {
7137        ::serde::Serialize::serialize(v, s)
7138    }
7139    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7140        d: D,
7141    ) -> ::core::result::Result<Self, D::Error> {
7142        <Self as ::serde::Deserialize>::deserialize(d)
7143    }
7144}
7145#[doc(hidden)]
7146pub const __MODIFY_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7147    type_url: "type.googleapis.com/triggers.v1.ModifyTriggerResponse",
7148    to_json: ::buffa::type_registry::any_to_json::<ModifyTriggerResponse>,
7149    from_json: ::buffa::type_registry::any_from_json::<ModifyTriggerResponse>,
7150    is_wkt: false,
7151};
7152/// PauseTriggerRequest pauses an active trigger by ID.
7153#[derive(Clone, PartialEq, Default)]
7154#[derive(::serde::Serialize, ::serde::Deserialize)]
7155#[serde(default)]
7156pub struct PauseTriggerRequest {
7157    /// Trigger ID to pause.
7158    ///
7159    /// Field 1: `trigger_id`
7160    #[serde(
7161        rename = "triggerId",
7162        alias = "trigger_id",
7163        with = "::buffa::json_helpers::uint64",
7164        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7165    )]
7166    pub trigger_id: u64,
7167    /// Optional sub-account for authorization.
7168    ///
7169    /// Field 2: `subaccount_id`
7170    #[serde(
7171        rename = "subaccountId",
7172        alias = "subaccount_id",
7173        with = "::buffa::json_helpers::opt_uint64",
7174        skip_serializing_if = "::core::option::Option::is_none"
7175    )]
7176    pub subaccount_id: ::core::option::Option<u64>,
7177    #[serde(skip)]
7178    #[doc(hidden)]
7179    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7180}
7181impl ::core::fmt::Debug for PauseTriggerRequest {
7182    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7183        f.debug_struct("PauseTriggerRequest")
7184            .field("trigger_id", &self.trigger_id)
7185            .field("subaccount_id", &self.subaccount_id)
7186            .finish()
7187    }
7188}
7189impl PauseTriggerRequest {
7190    /// Protobuf type URL for this message, for use with `Any::pack` and
7191    /// `Any::unpack_if`.
7192    ///
7193    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7194    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
7195}
7196impl PauseTriggerRequest {
7197    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7198    #[inline]
7199    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
7200    pub fn with_subaccount_id(mut self, value: u64) -> Self {
7201        self.subaccount_id = Some(value);
7202        self
7203    }
7204}
7205::buffa::impl_default_instance!(PauseTriggerRequest);
7206impl ::buffa::MessageName for PauseTriggerRequest {
7207    const PACKAGE: &'static str = "triggers.v1";
7208    const NAME: &'static str = "PauseTriggerRequest";
7209    const FULL_NAME: &'static str = "triggers.v1.PauseTriggerRequest";
7210    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
7211}
7212impl ::buffa::Message for PauseTriggerRequest {
7213    /// Returns the total encoded size in bytes.
7214    ///
7215    /// The result is a `u32`; the protobuf specification requires all
7216    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7217    /// compliant message will never overflow this type.
7218    #[allow(clippy::let_and_return)]
7219    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7220        #[allow(unused_imports)]
7221        use ::buffa::Enumeration as _;
7222        let mut size = 0u32;
7223        if self.trigger_id != 0u64 {
7224            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7225        }
7226        if self.subaccount_id.is_some() {
7227            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7228        }
7229        size += self.__buffa_unknown_fields.encoded_len() as u32;
7230        size
7231    }
7232    fn write_to(
7233        &self,
7234        _cache: &mut ::buffa::SizeCache,
7235        buf: &mut impl ::buffa::bytes::BufMut,
7236    ) {
7237        #[allow(unused_imports)]
7238        use ::buffa::Enumeration as _;
7239        if self.trigger_id != 0u64 {
7240            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7241        }
7242        if let Some(v) = self.subaccount_id {
7243            ::buffa::types::put_fixed64_field(2u32, v, buf);
7244        }
7245        self.__buffa_unknown_fields.write_to(buf);
7246    }
7247    fn merge_field(
7248        &mut self,
7249        tag: ::buffa::encoding::Tag,
7250        buf: &mut impl ::buffa::bytes::Buf,
7251        ctx: ::buffa::DecodeContext<'_>,
7252    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7253        #[allow(unused_imports)]
7254        use ::buffa::bytes::Buf as _;
7255        #[allow(unused_imports)]
7256        use ::buffa::Enumeration as _;
7257        match tag.field_number() {
7258            1u32 => {
7259                ::buffa::encoding::check_wire_type(
7260                    tag,
7261                    ::buffa::encoding::WireType::Fixed64,
7262                )?;
7263                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7264            }
7265            2u32 => {
7266                ::buffa::encoding::check_wire_type(
7267                    tag,
7268                    ::buffa::encoding::WireType::Fixed64,
7269                )?;
7270                self.subaccount_id = ::core::option::Option::Some(
7271                    ::buffa::types::decode_fixed64(buf)?,
7272                );
7273            }
7274            _ => {
7275                self.__buffa_unknown_fields
7276                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7277            }
7278        }
7279        ::core::result::Result::Ok(())
7280    }
7281    fn clear(&mut self) {
7282        self.trigger_id = 0u64;
7283        self.subaccount_id = ::core::option::Option::None;
7284        self.__buffa_unknown_fields.clear();
7285    }
7286}
7287impl ::buffa::ExtensionSet for PauseTriggerRequest {
7288    const PROTO_FQN: &'static str = "triggers.v1.PauseTriggerRequest";
7289    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7290        &self.__buffa_unknown_fields
7291    }
7292    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7293        &mut self.__buffa_unknown_fields
7294    }
7295}
7296impl ::buffa::json_helpers::ProtoElemJson for PauseTriggerRequest {
7297    fn serialize_proto_json<S: ::serde::Serializer>(
7298        v: &Self,
7299        s: S,
7300    ) -> ::core::result::Result<S::Ok, S::Error> {
7301        ::serde::Serialize::serialize(v, s)
7302    }
7303    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7304        d: D,
7305    ) -> ::core::result::Result<Self, D::Error> {
7306        <Self as ::serde::Deserialize>::deserialize(d)
7307    }
7308}
7309#[doc(hidden)]
7310pub const __PAUSE_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7311    type_url: "type.googleapis.com/triggers.v1.PauseTriggerRequest",
7312    to_json: ::buffa::type_registry::any_to_json::<PauseTriggerRequest>,
7313    from_json: ::buffa::type_registry::any_from_json::<PauseTriggerRequest>,
7314    is_wkt: false,
7315};
7316/// PauseTriggerResponse returns the trigger status after pausing.
7317#[derive(Clone, PartialEq, Default)]
7318#[derive(::serde::Serialize, ::serde::Deserialize)]
7319#[serde(default)]
7320pub struct PauseTriggerResponse {
7321    /// Paused trigger ID.
7322    ///
7323    /// Field 1: `trigger_id`
7324    #[serde(
7325        rename = "triggerId",
7326        alias = "trigger_id",
7327        with = "::buffa::json_helpers::uint64",
7328        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7329    )]
7330    pub trigger_id: u64,
7331    /// Current trigger status after pausing.
7332    ///
7333    /// Field 2: `status`
7334    #[serde(
7335        rename = "status",
7336        with = "::buffa::json_helpers::proto_enum",
7337        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7338    )]
7339    pub status: ::buffa::EnumValue<TriggerStatus>,
7340    /// Server timestamp.
7341    ///
7342    /// Field 3: `ts`
7343    #[serde(
7344        rename = "ts",
7345        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7346    )]
7347    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7348    /// Server timestamp in nanoseconds since epoch (UTC).
7349    ///
7350    /// Field 4: `ts_ns`
7351    #[serde(
7352        rename = "tsNs",
7353        alias = "ts_ns",
7354        with = "::buffa::json_helpers::uint64",
7355        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7356    )]
7357    pub ts_ns: u64,
7358    #[serde(skip)]
7359    #[doc(hidden)]
7360    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7361}
7362impl ::core::fmt::Debug for PauseTriggerResponse {
7363    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7364        f.debug_struct("PauseTriggerResponse")
7365            .field("trigger_id", &self.trigger_id)
7366            .field("status", &self.status)
7367            .field("ts", &self.ts)
7368            .field("ts_ns", &self.ts_ns)
7369            .finish()
7370    }
7371}
7372impl PauseTriggerResponse {
7373    /// Protobuf type URL for this message, for use with `Any::pack` and
7374    /// `Any::unpack_if`.
7375    ///
7376    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7377    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
7378}
7379::buffa::impl_default_instance!(PauseTriggerResponse);
7380impl ::buffa::MessageName for PauseTriggerResponse {
7381    const PACKAGE: &'static str = "triggers.v1";
7382    const NAME: &'static str = "PauseTriggerResponse";
7383    const FULL_NAME: &'static str = "triggers.v1.PauseTriggerResponse";
7384    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
7385}
7386impl ::buffa::Message for PauseTriggerResponse {
7387    /// Returns the total encoded size in bytes.
7388    ///
7389    /// The result is a `u32`; the protobuf specification requires all
7390    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7391    /// compliant message will never overflow this type.
7392    #[allow(clippy::let_and_return)]
7393    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7394        #[allow(unused_imports)]
7395        use ::buffa::Enumeration as _;
7396        let mut size = 0u32;
7397        if self.trigger_id != 0u64 {
7398            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7399        }
7400        {
7401            let val = self.status.to_i32();
7402            if val != 0 {
7403                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7404            }
7405        }
7406        if self.ts.is_set() {
7407            let __slot = __cache.reserve();
7408            let inner_size = self.ts.compute_size(__cache);
7409            __cache.set(__slot, inner_size);
7410            size
7411                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7412                    + inner_size;
7413        }
7414        if self.ts_ns != 0u64 {
7415            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7416        }
7417        size += self.__buffa_unknown_fields.encoded_len() as u32;
7418        size
7419    }
7420    fn write_to(
7421        &self,
7422        __cache: &mut ::buffa::SizeCache,
7423        buf: &mut impl ::buffa::bytes::BufMut,
7424    ) {
7425        #[allow(unused_imports)]
7426        use ::buffa::Enumeration as _;
7427        if self.trigger_id != 0u64 {
7428            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7429        }
7430        {
7431            let val = self.status.to_i32();
7432            if val != 0 {
7433                ::buffa::types::put_int32_field(2u32, val, buf);
7434            }
7435        }
7436        if self.ts.is_set() {
7437            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7438            self.ts.write_to(__cache, buf);
7439        }
7440        if self.ts_ns != 0u64 {
7441            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7442        }
7443        self.__buffa_unknown_fields.write_to(buf);
7444    }
7445    fn merge_field(
7446        &mut self,
7447        tag: ::buffa::encoding::Tag,
7448        buf: &mut impl ::buffa::bytes::Buf,
7449        ctx: ::buffa::DecodeContext<'_>,
7450    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7451        #[allow(unused_imports)]
7452        use ::buffa::bytes::Buf as _;
7453        #[allow(unused_imports)]
7454        use ::buffa::Enumeration as _;
7455        match tag.field_number() {
7456            1u32 => {
7457                ::buffa::encoding::check_wire_type(
7458                    tag,
7459                    ::buffa::encoding::WireType::Fixed64,
7460                )?;
7461                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7462            }
7463            2u32 => {
7464                ::buffa::encoding::check_wire_type(
7465                    tag,
7466                    ::buffa::encoding::WireType::Varint,
7467                )?;
7468                self.status = ::buffa::EnumValue::from(
7469                    ::buffa::types::decode_int32(buf)?,
7470                );
7471            }
7472            3u32 => {
7473                ::buffa::encoding::check_wire_type(
7474                    tag,
7475                    ::buffa::encoding::WireType::LengthDelimited,
7476                )?;
7477                ::buffa::Message::merge_length_delimited(
7478                    self.ts.get_or_insert_default(),
7479                    buf,
7480                    ctx,
7481                )?;
7482            }
7483            4u32 => {
7484                ::buffa::encoding::check_wire_type(
7485                    tag,
7486                    ::buffa::encoding::WireType::Varint,
7487                )?;
7488                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7489            }
7490            _ => {
7491                self.__buffa_unknown_fields
7492                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7493            }
7494        }
7495        ::core::result::Result::Ok(())
7496    }
7497    fn clear(&mut self) {
7498        self.trigger_id = 0u64;
7499        self.status = ::buffa::EnumValue::from(0);
7500        self.ts = ::buffa::MessageField::none();
7501        self.ts_ns = 0u64;
7502        self.__buffa_unknown_fields.clear();
7503    }
7504}
7505impl ::buffa::ExtensionSet for PauseTriggerResponse {
7506    const PROTO_FQN: &'static str = "triggers.v1.PauseTriggerResponse";
7507    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7508        &self.__buffa_unknown_fields
7509    }
7510    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7511        &mut self.__buffa_unknown_fields
7512    }
7513}
7514impl ::buffa::json_helpers::ProtoElemJson for PauseTriggerResponse {
7515    fn serialize_proto_json<S: ::serde::Serializer>(
7516        v: &Self,
7517        s: S,
7518    ) -> ::core::result::Result<S::Ok, S::Error> {
7519        ::serde::Serialize::serialize(v, s)
7520    }
7521    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7522        d: D,
7523    ) -> ::core::result::Result<Self, D::Error> {
7524        <Self as ::serde::Deserialize>::deserialize(d)
7525    }
7526}
7527#[doc(hidden)]
7528pub const __PAUSE_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7529    type_url: "type.googleapis.com/triggers.v1.PauseTriggerResponse",
7530    to_json: ::buffa::type_registry::any_to_json::<PauseTriggerResponse>,
7531    from_json: ::buffa::type_registry::any_from_json::<PauseTriggerResponse>,
7532    is_wkt: false,
7533};
7534/// ResumeTriggerRequest resumes a paused trigger by ID.
7535#[derive(Clone, PartialEq, Default)]
7536#[derive(::serde::Serialize, ::serde::Deserialize)]
7537#[serde(default)]
7538pub struct ResumeTriggerRequest {
7539    /// Trigger ID to resume.
7540    ///
7541    /// Field 1: `trigger_id`
7542    #[serde(
7543        rename = "triggerId",
7544        alias = "trigger_id",
7545        with = "::buffa::json_helpers::uint64",
7546        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7547    )]
7548    pub trigger_id: u64,
7549    /// Optional sub-account for authorization.
7550    ///
7551    /// Field 2: `subaccount_id`
7552    #[serde(
7553        rename = "subaccountId",
7554        alias = "subaccount_id",
7555        with = "::buffa::json_helpers::opt_uint64",
7556        skip_serializing_if = "::core::option::Option::is_none"
7557    )]
7558    pub subaccount_id: ::core::option::Option<u64>,
7559    #[serde(skip)]
7560    #[doc(hidden)]
7561    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7562}
7563impl ::core::fmt::Debug for ResumeTriggerRequest {
7564    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7565        f.debug_struct("ResumeTriggerRequest")
7566            .field("trigger_id", &self.trigger_id)
7567            .field("subaccount_id", &self.subaccount_id)
7568            .finish()
7569    }
7570}
7571impl ResumeTriggerRequest {
7572    /// Protobuf type URL for this message, for use with `Any::pack` and
7573    /// `Any::unpack_if`.
7574    ///
7575    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7576    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
7577}
7578impl ResumeTriggerRequest {
7579    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7580    #[inline]
7581    ///Sets [`Self::subaccount_id`] to `Some(value)`, consuming and returning `self`.
7582    pub fn with_subaccount_id(mut self, value: u64) -> Self {
7583        self.subaccount_id = Some(value);
7584        self
7585    }
7586}
7587::buffa::impl_default_instance!(ResumeTriggerRequest);
7588impl ::buffa::MessageName for ResumeTriggerRequest {
7589    const PACKAGE: &'static str = "triggers.v1";
7590    const NAME: &'static str = "ResumeTriggerRequest";
7591    const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerRequest";
7592    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
7593}
7594impl ::buffa::Message for ResumeTriggerRequest {
7595    /// Returns the total encoded size in bytes.
7596    ///
7597    /// The result is a `u32`; the protobuf specification requires all
7598    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7599    /// compliant message will never overflow this type.
7600    #[allow(clippy::let_and_return)]
7601    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7602        #[allow(unused_imports)]
7603        use ::buffa::Enumeration as _;
7604        let mut size = 0u32;
7605        if self.trigger_id != 0u64 {
7606            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7607        }
7608        if self.subaccount_id.is_some() {
7609            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7610        }
7611        size += self.__buffa_unknown_fields.encoded_len() as u32;
7612        size
7613    }
7614    fn write_to(
7615        &self,
7616        _cache: &mut ::buffa::SizeCache,
7617        buf: &mut impl ::buffa::bytes::BufMut,
7618    ) {
7619        #[allow(unused_imports)]
7620        use ::buffa::Enumeration as _;
7621        if self.trigger_id != 0u64 {
7622            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7623        }
7624        if let Some(v) = self.subaccount_id {
7625            ::buffa::types::put_fixed64_field(2u32, v, buf);
7626        }
7627        self.__buffa_unknown_fields.write_to(buf);
7628    }
7629    fn merge_field(
7630        &mut self,
7631        tag: ::buffa::encoding::Tag,
7632        buf: &mut impl ::buffa::bytes::Buf,
7633        ctx: ::buffa::DecodeContext<'_>,
7634    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7635        #[allow(unused_imports)]
7636        use ::buffa::bytes::Buf as _;
7637        #[allow(unused_imports)]
7638        use ::buffa::Enumeration as _;
7639        match tag.field_number() {
7640            1u32 => {
7641                ::buffa::encoding::check_wire_type(
7642                    tag,
7643                    ::buffa::encoding::WireType::Fixed64,
7644                )?;
7645                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7646            }
7647            2u32 => {
7648                ::buffa::encoding::check_wire_type(
7649                    tag,
7650                    ::buffa::encoding::WireType::Fixed64,
7651                )?;
7652                self.subaccount_id = ::core::option::Option::Some(
7653                    ::buffa::types::decode_fixed64(buf)?,
7654                );
7655            }
7656            _ => {
7657                self.__buffa_unknown_fields
7658                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7659            }
7660        }
7661        ::core::result::Result::Ok(())
7662    }
7663    fn clear(&mut self) {
7664        self.trigger_id = 0u64;
7665        self.subaccount_id = ::core::option::Option::None;
7666        self.__buffa_unknown_fields.clear();
7667    }
7668}
7669impl ::buffa::ExtensionSet for ResumeTriggerRequest {
7670    const PROTO_FQN: &'static str = "triggers.v1.ResumeTriggerRequest";
7671    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7672        &self.__buffa_unknown_fields
7673    }
7674    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7675        &mut self.__buffa_unknown_fields
7676    }
7677}
7678impl ::buffa::json_helpers::ProtoElemJson for ResumeTriggerRequest {
7679    fn serialize_proto_json<S: ::serde::Serializer>(
7680        v: &Self,
7681        s: S,
7682    ) -> ::core::result::Result<S::Ok, S::Error> {
7683        ::serde::Serialize::serialize(v, s)
7684    }
7685    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7686        d: D,
7687    ) -> ::core::result::Result<Self, D::Error> {
7688        <Self as ::serde::Deserialize>::deserialize(d)
7689    }
7690}
7691#[doc(hidden)]
7692pub const __RESUME_TRIGGER_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7693    type_url: "type.googleapis.com/triggers.v1.ResumeTriggerRequest",
7694    to_json: ::buffa::type_registry::any_to_json::<ResumeTriggerRequest>,
7695    from_json: ::buffa::type_registry::any_from_json::<ResumeTriggerRequest>,
7696    is_wkt: false,
7697};
7698/// ResumeTriggerResponse returns the trigger status after resuming.
7699#[derive(Clone, PartialEq, Default)]
7700#[derive(::serde::Serialize, ::serde::Deserialize)]
7701#[serde(default)]
7702pub struct ResumeTriggerResponse {
7703    /// Resumed trigger ID.
7704    ///
7705    /// Field 1: `trigger_id`
7706    #[serde(
7707        rename = "triggerId",
7708        alias = "trigger_id",
7709        with = "::buffa::json_helpers::uint64",
7710        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7711    )]
7712    pub trigger_id: u64,
7713    /// Current trigger status after resuming.
7714    ///
7715    /// Field 2: `status`
7716    #[serde(
7717        rename = "status",
7718        with = "::buffa::json_helpers::proto_enum",
7719        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7720    )]
7721    pub status: ::buffa::EnumValue<TriggerStatus>,
7722    /// Server timestamp.
7723    ///
7724    /// Field 3: `ts`
7725    #[serde(
7726        rename = "ts",
7727        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7728    )]
7729    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7730    /// Server timestamp in nanoseconds since epoch (UTC).
7731    ///
7732    /// Field 4: `ts_ns`
7733    #[serde(
7734        rename = "tsNs",
7735        alias = "ts_ns",
7736        with = "::buffa::json_helpers::uint64",
7737        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7738    )]
7739    pub ts_ns: u64,
7740    #[serde(skip)]
7741    #[doc(hidden)]
7742    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7743}
7744impl ::core::fmt::Debug for ResumeTriggerResponse {
7745    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7746        f.debug_struct("ResumeTriggerResponse")
7747            .field("trigger_id", &self.trigger_id)
7748            .field("status", &self.status)
7749            .field("ts", &self.ts)
7750            .field("ts_ns", &self.ts_ns)
7751            .finish()
7752    }
7753}
7754impl ResumeTriggerResponse {
7755    /// Protobuf type URL for this message, for use with `Any::pack` and
7756    /// `Any::unpack_if`.
7757    ///
7758    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7759    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
7760}
7761::buffa::impl_default_instance!(ResumeTriggerResponse);
7762impl ::buffa::MessageName for ResumeTriggerResponse {
7763    const PACKAGE: &'static str = "triggers.v1";
7764    const NAME: &'static str = "ResumeTriggerResponse";
7765    const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerResponse";
7766    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
7767}
7768impl ::buffa::Message for ResumeTriggerResponse {
7769    /// Returns the total encoded size in bytes.
7770    ///
7771    /// The result is a `u32`; the protobuf specification requires all
7772    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7773    /// compliant message will never overflow this type.
7774    #[allow(clippy::let_and_return)]
7775    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7776        #[allow(unused_imports)]
7777        use ::buffa::Enumeration as _;
7778        let mut size = 0u32;
7779        if self.trigger_id != 0u64 {
7780            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
7781        }
7782        {
7783            let val = self.status.to_i32();
7784            if val != 0 {
7785                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7786            }
7787        }
7788        if self.ts.is_set() {
7789            let __slot = __cache.reserve();
7790            let inner_size = self.ts.compute_size(__cache);
7791            __cache.set(__slot, inner_size);
7792            size
7793                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7794                    + inner_size;
7795        }
7796        if self.ts_ns != 0u64 {
7797            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
7798        }
7799        size += self.__buffa_unknown_fields.encoded_len() as u32;
7800        size
7801    }
7802    fn write_to(
7803        &self,
7804        __cache: &mut ::buffa::SizeCache,
7805        buf: &mut impl ::buffa::bytes::BufMut,
7806    ) {
7807        #[allow(unused_imports)]
7808        use ::buffa::Enumeration as _;
7809        if self.trigger_id != 0u64 {
7810            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
7811        }
7812        {
7813            let val = self.status.to_i32();
7814            if val != 0 {
7815                ::buffa::types::put_int32_field(2u32, val, buf);
7816            }
7817        }
7818        if self.ts.is_set() {
7819            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
7820            self.ts.write_to(__cache, buf);
7821        }
7822        if self.ts_ns != 0u64 {
7823            ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
7824        }
7825        self.__buffa_unknown_fields.write_to(buf);
7826    }
7827    fn merge_field(
7828        &mut self,
7829        tag: ::buffa::encoding::Tag,
7830        buf: &mut impl ::buffa::bytes::Buf,
7831        ctx: ::buffa::DecodeContext<'_>,
7832    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7833        #[allow(unused_imports)]
7834        use ::buffa::bytes::Buf as _;
7835        #[allow(unused_imports)]
7836        use ::buffa::Enumeration as _;
7837        match tag.field_number() {
7838            1u32 => {
7839                ::buffa::encoding::check_wire_type(
7840                    tag,
7841                    ::buffa::encoding::WireType::Fixed64,
7842                )?;
7843                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
7844            }
7845            2u32 => {
7846                ::buffa::encoding::check_wire_type(
7847                    tag,
7848                    ::buffa::encoding::WireType::Varint,
7849                )?;
7850                self.status = ::buffa::EnumValue::from(
7851                    ::buffa::types::decode_int32(buf)?,
7852                );
7853            }
7854            3u32 => {
7855                ::buffa::encoding::check_wire_type(
7856                    tag,
7857                    ::buffa::encoding::WireType::LengthDelimited,
7858                )?;
7859                ::buffa::Message::merge_length_delimited(
7860                    self.ts.get_or_insert_default(),
7861                    buf,
7862                    ctx,
7863                )?;
7864            }
7865            4u32 => {
7866                ::buffa::encoding::check_wire_type(
7867                    tag,
7868                    ::buffa::encoding::WireType::Varint,
7869                )?;
7870                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
7871            }
7872            _ => {
7873                self.__buffa_unknown_fields
7874                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7875            }
7876        }
7877        ::core::result::Result::Ok(())
7878    }
7879    fn clear(&mut self) {
7880        self.trigger_id = 0u64;
7881        self.status = ::buffa::EnumValue::from(0);
7882        self.ts = ::buffa::MessageField::none();
7883        self.ts_ns = 0u64;
7884        self.__buffa_unknown_fields.clear();
7885    }
7886}
7887impl ::buffa::ExtensionSet for ResumeTriggerResponse {
7888    const PROTO_FQN: &'static str = "triggers.v1.ResumeTriggerResponse";
7889    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7890        &self.__buffa_unknown_fields
7891    }
7892    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7893        &mut self.__buffa_unknown_fields
7894    }
7895}
7896impl ::buffa::json_helpers::ProtoElemJson for ResumeTriggerResponse {
7897    fn serialize_proto_json<S: ::serde::Serializer>(
7898        v: &Self,
7899        s: S,
7900    ) -> ::core::result::Result<S::Ok, S::Error> {
7901        ::serde::Serialize::serialize(v, s)
7902    }
7903    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7904        d: D,
7905    ) -> ::core::result::Result<Self, D::Error> {
7906        <Self as ::serde::Deserialize>::deserialize(d)
7907    }
7908}
7909#[doc(hidden)]
7910pub const __RESUME_TRIGGER_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7911    type_url: "type.googleapis.com/triggers.v1.ResumeTriggerResponse",
7912    to_json: ::buffa::type_registry::any_to_json::<ResumeTriggerResponse>,
7913    from_json: ::buffa::type_registry::any_from_json::<ResumeTriggerResponse>,
7914    is_wkt: false,
7915};
7916/// =============================================================================
7917/// Trigger Model
7918/// =============================================================================
7919///
7920/// StopDetails contains configuration for STOP_LOSS and TAKE_PROFIT triggers.
7921#[derive(Clone, PartialEq, Default)]
7922#[derive(::serde::Serialize, ::serde::Deserialize)]
7923#[serde(default)]
7924pub struct StopDetails {
7925    /// Trigger threshold price in quote units scaled by 1e6.
7926    ///
7927    /// Field 1: `trigger_price_ticks`
7928    #[serde(
7929        rename = "triggerPriceTicks",
7930        alias = "trigger_price_ticks",
7931        with = "::buffa::json_helpers::int64",
7932        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
7933    )]
7934    pub trigger_price_ticks: i64,
7935    /// Price source used for trigger evaluation.
7936    ///
7937    /// Field 2: `trigger_price_source`
7938    #[serde(
7939        rename = "triggerPriceSource",
7940        alias = "trigger_price_source",
7941        with = "::buffa::json_helpers::proto_enum",
7942        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7943    )]
7944    pub trigger_price_source: ::buffa::EnumValue<
7945        super::super::orders::v1::TriggerPriceSource,
7946    >,
7947    /// Direction the price must cross to fire the trigger.
7948    ///
7949    /// Field 3: `trigger_direction`
7950    #[serde(
7951        rename = "triggerDirection",
7952        alias = "trigger_direction",
7953        with = "::buffa::json_helpers::proto_enum",
7954        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7955    )]
7956    pub trigger_direction: ::buffa::EnumValue<
7957        super::super::orders::v1::TriggerDirection,
7958    >,
7959    #[serde(skip)]
7960    #[doc(hidden)]
7961    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7962}
7963impl ::core::fmt::Debug for StopDetails {
7964    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7965        f.debug_struct("StopDetails")
7966            .field("trigger_price_ticks", &self.trigger_price_ticks)
7967            .field("trigger_price_source", &self.trigger_price_source)
7968            .field("trigger_direction", &self.trigger_direction)
7969            .finish()
7970    }
7971}
7972impl StopDetails {
7973    /// Protobuf type URL for this message, for use with `Any::pack` and
7974    /// `Any::unpack_if`.
7975    ///
7976    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7977    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
7978}
7979::buffa::impl_default_instance!(StopDetails);
7980impl ::buffa::MessageName for StopDetails {
7981    const PACKAGE: &'static str = "triggers.v1";
7982    const NAME: &'static str = "StopDetails";
7983    const FULL_NAME: &'static str = "triggers.v1.StopDetails";
7984    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
7985}
7986impl ::buffa::Message for StopDetails {
7987    /// Returns the total encoded size in bytes.
7988    ///
7989    /// The result is a `u32`; the protobuf specification requires all
7990    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7991    /// compliant message will never overflow this type.
7992    #[allow(clippy::let_and_return)]
7993    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7994        #[allow(unused_imports)]
7995        use ::buffa::Enumeration as _;
7996        let mut size = 0u32;
7997        if self.trigger_price_ticks != 0i64 {
7998            size
7999                += 1u32
8000                    + ::buffa::types::int64_encoded_len(self.trigger_price_ticks) as u32;
8001        }
8002        {
8003            let val = self.trigger_price_source.to_i32();
8004            if val != 0 {
8005                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8006            }
8007        }
8008        {
8009            let val = self.trigger_direction.to_i32();
8010            if val != 0 {
8011                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8012            }
8013        }
8014        size += self.__buffa_unknown_fields.encoded_len() as u32;
8015        size
8016    }
8017    fn write_to(
8018        &self,
8019        _cache: &mut ::buffa::SizeCache,
8020        buf: &mut impl ::buffa::bytes::BufMut,
8021    ) {
8022        #[allow(unused_imports)]
8023        use ::buffa::Enumeration as _;
8024        if self.trigger_price_ticks != 0i64 {
8025            ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
8026        }
8027        {
8028            let val = self.trigger_price_source.to_i32();
8029            if val != 0 {
8030                ::buffa::types::put_int32_field(2u32, val, buf);
8031            }
8032        }
8033        {
8034            let val = self.trigger_direction.to_i32();
8035            if val != 0 {
8036                ::buffa::types::put_int32_field(3u32, val, buf);
8037            }
8038        }
8039        self.__buffa_unknown_fields.write_to(buf);
8040    }
8041    fn merge_field(
8042        &mut self,
8043        tag: ::buffa::encoding::Tag,
8044        buf: &mut impl ::buffa::bytes::Buf,
8045        ctx: ::buffa::DecodeContext<'_>,
8046    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8047        #[allow(unused_imports)]
8048        use ::buffa::bytes::Buf as _;
8049        #[allow(unused_imports)]
8050        use ::buffa::Enumeration as _;
8051        match tag.field_number() {
8052            1u32 => {
8053                ::buffa::encoding::check_wire_type(
8054                    tag,
8055                    ::buffa::encoding::WireType::Varint,
8056                )?;
8057                self.trigger_price_ticks = ::buffa::types::decode_int64(buf)?;
8058            }
8059            2u32 => {
8060                ::buffa::encoding::check_wire_type(
8061                    tag,
8062                    ::buffa::encoding::WireType::Varint,
8063                )?;
8064                self.trigger_price_source = ::buffa::EnumValue::from(
8065                    ::buffa::types::decode_int32(buf)?,
8066                );
8067            }
8068            3u32 => {
8069                ::buffa::encoding::check_wire_type(
8070                    tag,
8071                    ::buffa::encoding::WireType::Varint,
8072                )?;
8073                self.trigger_direction = ::buffa::EnumValue::from(
8074                    ::buffa::types::decode_int32(buf)?,
8075                );
8076            }
8077            _ => {
8078                self.__buffa_unknown_fields
8079                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8080            }
8081        }
8082        ::core::result::Result::Ok(())
8083    }
8084    fn clear(&mut self) {
8085        self.trigger_price_ticks = 0i64;
8086        self.trigger_price_source = ::buffa::EnumValue::from(0);
8087        self.trigger_direction = ::buffa::EnumValue::from(0);
8088        self.__buffa_unknown_fields.clear();
8089    }
8090}
8091impl ::buffa::ExtensionSet for StopDetails {
8092    const PROTO_FQN: &'static str = "triggers.v1.StopDetails";
8093    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8094        &self.__buffa_unknown_fields
8095    }
8096    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8097        &mut self.__buffa_unknown_fields
8098    }
8099}
8100impl ::buffa::json_helpers::ProtoElemJson for StopDetails {
8101    fn serialize_proto_json<S: ::serde::Serializer>(
8102        v: &Self,
8103        s: S,
8104    ) -> ::core::result::Result<S::Ok, S::Error> {
8105        ::serde::Serialize::serialize(v, s)
8106    }
8107    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8108        d: D,
8109    ) -> ::core::result::Result<Self, D::Error> {
8110        <Self as ::serde::Deserialize>::deserialize(d)
8111    }
8112}
8113#[doc(hidden)]
8114pub const __STOP_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8115    type_url: "type.googleapis.com/triggers.v1.StopDetails",
8116    to_json: ::buffa::type_registry::any_to_json::<StopDetails>,
8117    from_json: ::buffa::type_registry::any_from_json::<StopDetails>,
8118    is_wkt: false,
8119};
8120/// TrailingDetails contains configuration and runtime state for TRAILING_STOP
8121/// triggers.
8122#[derive(Clone, PartialEq, Default)]
8123#[derive(::serde::Serialize, ::serde::Deserialize)]
8124#[serde(default)]
8125pub struct TrailingDetails {
8126    /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
8127    ///
8128    /// Field 1: `trailing_distance_ticks`
8129    #[serde(
8130        rename = "trailingDistanceTicks",
8131        alias = "trailing_distance_ticks",
8132        with = "::buffa::json_helpers::int64",
8133        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8134    )]
8135    pub trailing_distance_ticks: i64,
8136    /// Optional activation price: trailing only starts after this price is
8137    /// reached. Expressed in quote units scaled by 1e6.
8138    ///
8139    /// Field 2: `activation_price_ticks`
8140    #[serde(
8141        rename = "activationPriceTicks",
8142        alias = "activation_price_ticks",
8143        with = "::buffa::json_helpers::int64",
8144        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8145    )]
8146    pub activation_price_ticks: i64,
8147    /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
8148    ///
8149    /// Field 3: `peak_price_ticks`
8150    #[serde(
8151        rename = "peakPriceTicks",
8152        alias = "peak_price_ticks",
8153        with = "::buffa::json_helpers::int64",
8154        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8155    )]
8156    pub peak_price_ticks: i64,
8157    /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
8158    ///
8159    /// Field 4: `trough_price_ticks`
8160    #[serde(
8161        rename = "troughPriceTicks",
8162        alias = "trough_price_ticks",
8163        with = "::buffa::json_helpers::int64",
8164        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8165    )]
8166    pub trough_price_ticks: i64,
8167    /// Trailing distance in basis points (1 bp = 0.01%).
8168    ///
8169    /// Field 5: `trailing_distance_bps`
8170    #[serde(
8171        rename = "trailingDistanceBps",
8172        alias = "trailing_distance_bps",
8173        with = "::buffa::json_helpers::int32",
8174        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8175    )]
8176    pub trailing_distance_bps: i32,
8177    /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
8178    ///
8179    /// Field 6: `max_slippage_ticks`
8180    #[serde(
8181        rename = "maxSlippageTicks",
8182        alias = "max_slippage_ticks",
8183        with = "::buffa::json_helpers::int32",
8184        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8185    )]
8186    pub max_slippage_ticks: i32,
8187    /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
8188    ///
8189    /// Field 7: `max_slippage_bps`
8190    #[serde(
8191        rename = "maxSlippageBps",
8192        alias = "max_slippage_bps",
8193        with = "::buffa::json_helpers::int32",
8194        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8195    )]
8196    pub max_slippage_bps: i32,
8197    /// Price source used for trigger evaluation. Fixed for the lifetime of the
8198    /// trigger and exposed for completeness.
8199    ///
8200    /// Field 8: `trigger_price_source`
8201    #[serde(
8202        rename = "triggerPriceSource",
8203        alias = "trigger_price_source",
8204        with = "::buffa::json_helpers::proto_enum",
8205        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8206    )]
8207    pub trigger_price_source: ::buffa::EnumValue<
8208        super::super::orders::v1::TriggerPriceSource,
8209    >,
8210    /// Direction the price must cross to fire the trigger. Fixed for the lifetime
8211    /// of the trigger and exposed for completeness.
8212    ///
8213    /// Field 9: `trigger_direction`
8214    #[serde(
8215        rename = "triggerDirection",
8216        alias = "trigger_direction",
8217        with = "::buffa::json_helpers::proto_enum",
8218        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8219    )]
8220    pub trigger_direction: ::buffa::EnumValue<
8221        super::super::orders::v1::TriggerDirection,
8222    >,
8223    #[serde(skip)]
8224    #[doc(hidden)]
8225    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8226}
8227impl ::core::fmt::Debug for TrailingDetails {
8228    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8229        f.debug_struct("TrailingDetails")
8230            .field("trailing_distance_ticks", &self.trailing_distance_ticks)
8231            .field("activation_price_ticks", &self.activation_price_ticks)
8232            .field("peak_price_ticks", &self.peak_price_ticks)
8233            .field("trough_price_ticks", &self.trough_price_ticks)
8234            .field("trailing_distance_bps", &self.trailing_distance_bps)
8235            .field("max_slippage_ticks", &self.max_slippage_ticks)
8236            .field("max_slippage_bps", &self.max_slippage_bps)
8237            .field("trigger_price_source", &self.trigger_price_source)
8238            .field("trigger_direction", &self.trigger_direction)
8239            .finish()
8240    }
8241}
8242impl TrailingDetails {
8243    /// Protobuf type URL for this message, for use with `Any::pack` and
8244    /// `Any::unpack_if`.
8245    ///
8246    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8247    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
8248}
8249::buffa::impl_default_instance!(TrailingDetails);
8250impl ::buffa::MessageName for TrailingDetails {
8251    const PACKAGE: &'static str = "triggers.v1";
8252    const NAME: &'static str = "TrailingDetails";
8253    const FULL_NAME: &'static str = "triggers.v1.TrailingDetails";
8254    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
8255}
8256impl ::buffa::Message for TrailingDetails {
8257    /// Returns the total encoded size in bytes.
8258    ///
8259    /// The result is a `u32`; the protobuf specification requires all
8260    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8261    /// compliant message will never overflow this type.
8262    #[allow(clippy::let_and_return)]
8263    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8264        #[allow(unused_imports)]
8265        use ::buffa::Enumeration as _;
8266        let mut size = 0u32;
8267        if self.trailing_distance_ticks != 0i64 {
8268            size
8269                += 1u32
8270                    + ::buffa::types::int64_encoded_len(self.trailing_distance_ticks)
8271                        as u32;
8272        }
8273        if self.activation_price_ticks != 0i64 {
8274            size
8275                += 1u32
8276                    + ::buffa::types::int64_encoded_len(self.activation_price_ticks)
8277                        as u32;
8278        }
8279        if self.peak_price_ticks != 0i64 {
8280            size
8281                += 1u32
8282                    + ::buffa::types::int64_encoded_len(self.peak_price_ticks) as u32;
8283        }
8284        if self.trough_price_ticks != 0i64 {
8285            size
8286                += 1u32
8287                    + ::buffa::types::int64_encoded_len(self.trough_price_ticks) as u32;
8288        }
8289        if self.trailing_distance_bps != 0i32 {
8290            size
8291                += 1u32
8292                    + ::buffa::types::int32_encoded_len(self.trailing_distance_bps)
8293                        as u32;
8294        }
8295        if self.max_slippage_ticks != 0i32 {
8296            size
8297                += 1u32
8298                    + ::buffa::types::int32_encoded_len(self.max_slippage_ticks) as u32;
8299        }
8300        if self.max_slippage_bps != 0i32 {
8301            size
8302                += 1u32
8303                    + ::buffa::types::int32_encoded_len(self.max_slippage_bps) as u32;
8304        }
8305        {
8306            let val = self.trigger_price_source.to_i32();
8307            if val != 0 {
8308                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8309            }
8310        }
8311        {
8312            let val = self.trigger_direction.to_i32();
8313            if val != 0 {
8314                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8315            }
8316        }
8317        size += self.__buffa_unknown_fields.encoded_len() as u32;
8318        size
8319    }
8320    fn write_to(
8321        &self,
8322        _cache: &mut ::buffa::SizeCache,
8323        buf: &mut impl ::buffa::bytes::BufMut,
8324    ) {
8325        #[allow(unused_imports)]
8326        use ::buffa::Enumeration as _;
8327        if self.trailing_distance_ticks != 0i64 {
8328            ::buffa::types::put_int64_field(1u32, self.trailing_distance_ticks, buf);
8329        }
8330        if self.activation_price_ticks != 0i64 {
8331            ::buffa::types::put_int64_field(2u32, self.activation_price_ticks, buf);
8332        }
8333        if self.peak_price_ticks != 0i64 {
8334            ::buffa::types::put_int64_field(3u32, self.peak_price_ticks, buf);
8335        }
8336        if self.trough_price_ticks != 0i64 {
8337            ::buffa::types::put_int64_field(4u32, self.trough_price_ticks, buf);
8338        }
8339        if self.trailing_distance_bps != 0i32 {
8340            ::buffa::types::put_int32_field(5u32, self.trailing_distance_bps, buf);
8341        }
8342        if self.max_slippage_ticks != 0i32 {
8343            ::buffa::types::put_int32_field(6u32, self.max_slippage_ticks, buf);
8344        }
8345        if self.max_slippage_bps != 0i32 {
8346            ::buffa::types::put_int32_field(7u32, self.max_slippage_bps, buf);
8347        }
8348        {
8349            let val = self.trigger_price_source.to_i32();
8350            if val != 0 {
8351                ::buffa::types::put_int32_field(8u32, val, buf);
8352            }
8353        }
8354        {
8355            let val = self.trigger_direction.to_i32();
8356            if val != 0 {
8357                ::buffa::types::put_int32_field(9u32, val, buf);
8358            }
8359        }
8360        self.__buffa_unknown_fields.write_to(buf);
8361    }
8362    fn merge_field(
8363        &mut self,
8364        tag: ::buffa::encoding::Tag,
8365        buf: &mut impl ::buffa::bytes::Buf,
8366        ctx: ::buffa::DecodeContext<'_>,
8367    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8368        #[allow(unused_imports)]
8369        use ::buffa::bytes::Buf as _;
8370        #[allow(unused_imports)]
8371        use ::buffa::Enumeration as _;
8372        match tag.field_number() {
8373            1u32 => {
8374                ::buffa::encoding::check_wire_type(
8375                    tag,
8376                    ::buffa::encoding::WireType::Varint,
8377                )?;
8378                self.trailing_distance_ticks = ::buffa::types::decode_int64(buf)?;
8379            }
8380            2u32 => {
8381                ::buffa::encoding::check_wire_type(
8382                    tag,
8383                    ::buffa::encoding::WireType::Varint,
8384                )?;
8385                self.activation_price_ticks = ::buffa::types::decode_int64(buf)?;
8386            }
8387            3u32 => {
8388                ::buffa::encoding::check_wire_type(
8389                    tag,
8390                    ::buffa::encoding::WireType::Varint,
8391                )?;
8392                self.peak_price_ticks = ::buffa::types::decode_int64(buf)?;
8393            }
8394            4u32 => {
8395                ::buffa::encoding::check_wire_type(
8396                    tag,
8397                    ::buffa::encoding::WireType::Varint,
8398                )?;
8399                self.trough_price_ticks = ::buffa::types::decode_int64(buf)?;
8400            }
8401            5u32 => {
8402                ::buffa::encoding::check_wire_type(
8403                    tag,
8404                    ::buffa::encoding::WireType::Varint,
8405                )?;
8406                self.trailing_distance_bps = ::buffa::types::decode_int32(buf)?;
8407            }
8408            6u32 => {
8409                ::buffa::encoding::check_wire_type(
8410                    tag,
8411                    ::buffa::encoding::WireType::Varint,
8412                )?;
8413                self.max_slippage_ticks = ::buffa::types::decode_int32(buf)?;
8414            }
8415            7u32 => {
8416                ::buffa::encoding::check_wire_type(
8417                    tag,
8418                    ::buffa::encoding::WireType::Varint,
8419                )?;
8420                self.max_slippage_bps = ::buffa::types::decode_int32(buf)?;
8421            }
8422            8u32 => {
8423                ::buffa::encoding::check_wire_type(
8424                    tag,
8425                    ::buffa::encoding::WireType::Varint,
8426                )?;
8427                self.trigger_price_source = ::buffa::EnumValue::from(
8428                    ::buffa::types::decode_int32(buf)?,
8429                );
8430            }
8431            9u32 => {
8432                ::buffa::encoding::check_wire_type(
8433                    tag,
8434                    ::buffa::encoding::WireType::Varint,
8435                )?;
8436                self.trigger_direction = ::buffa::EnumValue::from(
8437                    ::buffa::types::decode_int32(buf)?,
8438                );
8439            }
8440            _ => {
8441                self.__buffa_unknown_fields
8442                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8443            }
8444        }
8445        ::core::result::Result::Ok(())
8446    }
8447    fn clear(&mut self) {
8448        self.trailing_distance_ticks = 0i64;
8449        self.activation_price_ticks = 0i64;
8450        self.peak_price_ticks = 0i64;
8451        self.trough_price_ticks = 0i64;
8452        self.trailing_distance_bps = 0i32;
8453        self.max_slippage_ticks = 0i32;
8454        self.max_slippage_bps = 0i32;
8455        self.trigger_price_source = ::buffa::EnumValue::from(0);
8456        self.trigger_direction = ::buffa::EnumValue::from(0);
8457        self.__buffa_unknown_fields.clear();
8458    }
8459}
8460impl ::buffa::ExtensionSet for TrailingDetails {
8461    const PROTO_FQN: &'static str = "triggers.v1.TrailingDetails";
8462    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8463        &self.__buffa_unknown_fields
8464    }
8465    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8466        &mut self.__buffa_unknown_fields
8467    }
8468}
8469impl ::buffa::json_helpers::ProtoElemJson for TrailingDetails {
8470    fn serialize_proto_json<S: ::serde::Serializer>(
8471        v: &Self,
8472        s: S,
8473    ) -> ::core::result::Result<S::Ok, S::Error> {
8474        ::serde::Serialize::serialize(v, s)
8475    }
8476    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8477        d: D,
8478    ) -> ::core::result::Result<Self, D::Error> {
8479        <Self as ::serde::Deserialize>::deserialize(d)
8480    }
8481}
8482#[doc(hidden)]
8483pub const __TRAILING_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8484    type_url: "type.googleapis.com/triggers.v1.TrailingDetails",
8485    to_json: ::buffa::type_registry::any_to_json::<TrailingDetails>,
8486    from_json: ::buffa::type_registry::any_from_json::<TrailingDetails>,
8487    is_wkt: false,
8488};
8489/// TwapDetails contains configuration and runtime state for TWAP triggers.
8490#[derive(Clone, PartialEq, Default)]
8491#[derive(::serde::Serialize, ::serde::Deserialize)]
8492#[serde(default)]
8493pub struct TwapDetails {
8494    /// Total duration of TWAP execution in milliseconds.
8495    ///
8496    /// Field 1: `twap_duration_ms`
8497    #[serde(
8498        rename = "twapDurationMs",
8499        alias = "twap_duration_ms",
8500        with = "::buffa::json_helpers::int64",
8501        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8502    )]
8503    pub twap_duration_ms: i64,
8504    /// Interval between TWAP slices in milliseconds.
8505    ///
8506    /// Field 2: `twap_slice_interval_ms`
8507    #[serde(
8508        rename = "twapSliceIntervalMs",
8509        alias = "twap_slice_interval_ms",
8510        with = "::buffa::json_helpers::int64",
8511        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8512    )]
8513    pub twap_slice_interval_ms: i64,
8514    /// Current slice index, zero-based.
8515    ///
8516    /// Field 4: `slice_idx`
8517    #[serde(
8518        rename = "sliceIdx",
8519        alias = "slice_idx",
8520        with = "::buffa::json_helpers::int32",
8521        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8522    )]
8523    pub slice_idx: i32,
8524    /// Total number of planned slices.
8525    ///
8526    /// Field 5: `slice_count`
8527    #[serde(
8528        rename = "sliceCount",
8529        alias = "slice_count",
8530        with = "::buffa::json_helpers::int32",
8531        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8532    )]
8533    pub slice_count: i32,
8534    /// Cumulative executed quantity scaled by the pair's base_quantity_scale from
8535    /// GetSpotConfig.
8536    ///
8537    /// Field 6: `executed_qty_scaled`
8538    #[serde(
8539        rename = "executedQtyScaled",
8540        alias = "executed_qty_scaled",
8541        with = "::buffa::json_helpers::int64",
8542        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8543    )]
8544    pub executed_qty_scaled: i64,
8545    #[serde(skip)]
8546    #[doc(hidden)]
8547    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8548}
8549impl ::core::fmt::Debug for TwapDetails {
8550    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8551        f.debug_struct("TwapDetails")
8552            .field("twap_duration_ms", &self.twap_duration_ms)
8553            .field("twap_slice_interval_ms", &self.twap_slice_interval_ms)
8554            .field("slice_idx", &self.slice_idx)
8555            .field("slice_count", &self.slice_count)
8556            .field("executed_qty_scaled", &self.executed_qty_scaled)
8557            .finish()
8558    }
8559}
8560impl TwapDetails {
8561    /// Protobuf type URL for this message, for use with `Any::pack` and
8562    /// `Any::unpack_if`.
8563    ///
8564    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8565    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
8566}
8567::buffa::impl_default_instance!(TwapDetails);
8568impl ::buffa::MessageName for TwapDetails {
8569    const PACKAGE: &'static str = "triggers.v1";
8570    const NAME: &'static str = "TwapDetails";
8571    const FULL_NAME: &'static str = "triggers.v1.TwapDetails";
8572    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
8573}
8574impl ::buffa::Message for TwapDetails {
8575    /// Returns the total encoded size in bytes.
8576    ///
8577    /// The result is a `u32`; the protobuf specification requires all
8578    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8579    /// compliant message will never overflow this type.
8580    #[allow(clippy::let_and_return)]
8581    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8582        #[allow(unused_imports)]
8583        use ::buffa::Enumeration as _;
8584        let mut size = 0u32;
8585        if self.twap_duration_ms != 0i64 {
8586            size
8587                += 1u32
8588                    + ::buffa::types::int64_encoded_len(self.twap_duration_ms) as u32;
8589        }
8590        if self.twap_slice_interval_ms != 0i64 {
8591            size
8592                += 1u32
8593                    + ::buffa::types::int64_encoded_len(self.twap_slice_interval_ms)
8594                        as u32;
8595        }
8596        if self.slice_idx != 0i32 {
8597            size += 1u32 + ::buffa::types::int32_encoded_len(self.slice_idx) as u32;
8598        }
8599        if self.slice_count != 0i32 {
8600            size += 1u32 + ::buffa::types::int32_encoded_len(self.slice_count) as u32;
8601        }
8602        if self.executed_qty_scaled != 0i64 {
8603            size
8604                += 1u32
8605                    + ::buffa::types::int64_encoded_len(self.executed_qty_scaled) as u32;
8606        }
8607        size += self.__buffa_unknown_fields.encoded_len() as u32;
8608        size
8609    }
8610    fn write_to(
8611        &self,
8612        _cache: &mut ::buffa::SizeCache,
8613        buf: &mut impl ::buffa::bytes::BufMut,
8614    ) {
8615        #[allow(unused_imports)]
8616        use ::buffa::Enumeration as _;
8617        if self.twap_duration_ms != 0i64 {
8618            ::buffa::types::put_int64_field(1u32, self.twap_duration_ms, buf);
8619        }
8620        if self.twap_slice_interval_ms != 0i64 {
8621            ::buffa::types::put_int64_field(2u32, self.twap_slice_interval_ms, buf);
8622        }
8623        if self.slice_idx != 0i32 {
8624            ::buffa::types::put_int32_field(4u32, self.slice_idx, buf);
8625        }
8626        if self.slice_count != 0i32 {
8627            ::buffa::types::put_int32_field(5u32, self.slice_count, buf);
8628        }
8629        if self.executed_qty_scaled != 0i64 {
8630            ::buffa::types::put_int64_field(6u32, self.executed_qty_scaled, buf);
8631        }
8632        self.__buffa_unknown_fields.write_to(buf);
8633    }
8634    fn merge_field(
8635        &mut self,
8636        tag: ::buffa::encoding::Tag,
8637        buf: &mut impl ::buffa::bytes::Buf,
8638        ctx: ::buffa::DecodeContext<'_>,
8639    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8640        #[allow(unused_imports)]
8641        use ::buffa::bytes::Buf as _;
8642        #[allow(unused_imports)]
8643        use ::buffa::Enumeration as _;
8644        match tag.field_number() {
8645            1u32 => {
8646                ::buffa::encoding::check_wire_type(
8647                    tag,
8648                    ::buffa::encoding::WireType::Varint,
8649                )?;
8650                self.twap_duration_ms = ::buffa::types::decode_int64(buf)?;
8651            }
8652            2u32 => {
8653                ::buffa::encoding::check_wire_type(
8654                    tag,
8655                    ::buffa::encoding::WireType::Varint,
8656                )?;
8657                self.twap_slice_interval_ms = ::buffa::types::decode_int64(buf)?;
8658            }
8659            4u32 => {
8660                ::buffa::encoding::check_wire_type(
8661                    tag,
8662                    ::buffa::encoding::WireType::Varint,
8663                )?;
8664                self.slice_idx = ::buffa::types::decode_int32(buf)?;
8665            }
8666            5u32 => {
8667                ::buffa::encoding::check_wire_type(
8668                    tag,
8669                    ::buffa::encoding::WireType::Varint,
8670                )?;
8671                self.slice_count = ::buffa::types::decode_int32(buf)?;
8672            }
8673            6u32 => {
8674                ::buffa::encoding::check_wire_type(
8675                    tag,
8676                    ::buffa::encoding::WireType::Varint,
8677                )?;
8678                self.executed_qty_scaled = ::buffa::types::decode_int64(buf)?;
8679            }
8680            _ => {
8681                self.__buffa_unknown_fields
8682                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8683            }
8684        }
8685        ::core::result::Result::Ok(())
8686    }
8687    fn clear(&mut self) {
8688        self.twap_duration_ms = 0i64;
8689        self.twap_slice_interval_ms = 0i64;
8690        self.slice_idx = 0i32;
8691        self.slice_count = 0i32;
8692        self.executed_qty_scaled = 0i64;
8693        self.__buffa_unknown_fields.clear();
8694    }
8695}
8696impl ::buffa::ExtensionSet for TwapDetails {
8697    const PROTO_FQN: &'static str = "triggers.v1.TwapDetails";
8698    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8699        &self.__buffa_unknown_fields
8700    }
8701    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8702        &mut self.__buffa_unknown_fields
8703    }
8704}
8705impl ::buffa::json_helpers::ProtoElemJson for TwapDetails {
8706    fn serialize_proto_json<S: ::serde::Serializer>(
8707        v: &Self,
8708        s: S,
8709    ) -> ::core::result::Result<S::Ok, S::Error> {
8710        ::serde::Serialize::serialize(v, s)
8711    }
8712    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8713        d: D,
8714    ) -> ::core::result::Result<Self, D::Error> {
8715        <Self as ::serde::Deserialize>::deserialize(d)
8716    }
8717}
8718#[doc(hidden)]
8719pub const __TWAP_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8720    type_url: "type.googleapis.com/triggers.v1.TwapDetails",
8721    to_json: ::buffa::type_registry::any_to_json::<TwapDetails>,
8722    from_json: ::buffa::type_registry::any_from_json::<TwapDetails>,
8723    is_wkt: false,
8724};
8725/// LadderDetails contains configuration for LADDER triggers.
8726#[derive(Clone, PartialEq, Default)]
8727#[derive(::serde::Serialize, ::serde::Deserialize)]
8728#[serde(default)]
8729pub struct LadderDetails {
8730    /// Minimum price in quote units scaled by 1e6 for the ladder range.
8731    ///
8732    /// Field 1: `ladder_price_min_ticks`
8733    #[serde(
8734        rename = "ladderPriceMinTicks",
8735        alias = "ladder_price_min_ticks",
8736        with = "::buffa::json_helpers::int64",
8737        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8738    )]
8739    pub ladder_price_min_ticks: i64,
8740    /// Maximum price in quote units scaled by 1e6 for the ladder range.
8741    ///
8742    /// Field 2: `ladder_price_max_ticks`
8743    #[serde(
8744        rename = "ladderPriceMaxTicks",
8745        alias = "ladder_price_max_ticks",
8746        with = "::buffa::json_helpers::int64",
8747        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
8748    )]
8749    pub ladder_price_max_ticks: i64,
8750    /// Number of price levels in the ladder.
8751    ///
8752    /// Field 3: `ladder_levels`
8753    #[serde(
8754        rename = "ladderLevels",
8755        alias = "ladder_levels",
8756        with = "::buffa::json_helpers::int32",
8757        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
8758    )]
8759    pub ladder_levels: i32,
8760    /// Quantity distribution across ladder levels.
8761    ///
8762    /// Field 4: `ladder_distribution`
8763    #[serde(
8764        rename = "ladderDistribution",
8765        alias = "ladder_distribution",
8766        with = "::buffa::json_helpers::proto_enum",
8767        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8768    )]
8769    pub ladder_distribution: ::buffa::EnumValue<LadderDistribution>,
8770    #[serde(skip)]
8771    #[doc(hidden)]
8772    pub __buffa_unknown_fields: ::buffa::UnknownFields,
8773}
8774impl ::core::fmt::Debug for LadderDetails {
8775    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
8776        f.debug_struct("LadderDetails")
8777            .field("ladder_price_min_ticks", &self.ladder_price_min_ticks)
8778            .field("ladder_price_max_ticks", &self.ladder_price_max_ticks)
8779            .field("ladder_levels", &self.ladder_levels)
8780            .field("ladder_distribution", &self.ladder_distribution)
8781            .finish()
8782    }
8783}
8784impl LadderDetails {
8785    /// Protobuf type URL for this message, for use with `Any::pack` and
8786    /// `Any::unpack_if`.
8787    ///
8788    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
8789    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
8790}
8791::buffa::impl_default_instance!(LadderDetails);
8792impl ::buffa::MessageName for LadderDetails {
8793    const PACKAGE: &'static str = "triggers.v1";
8794    const NAME: &'static str = "LadderDetails";
8795    const FULL_NAME: &'static str = "triggers.v1.LadderDetails";
8796    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
8797}
8798impl ::buffa::Message for LadderDetails {
8799    /// Returns the total encoded size in bytes.
8800    ///
8801    /// The result is a `u32`; the protobuf specification requires all
8802    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
8803    /// compliant message will never overflow this type.
8804    #[allow(clippy::let_and_return)]
8805    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
8806        #[allow(unused_imports)]
8807        use ::buffa::Enumeration as _;
8808        let mut size = 0u32;
8809        if self.ladder_price_min_ticks != 0i64 {
8810            size
8811                += 1u32
8812                    + ::buffa::types::int64_encoded_len(self.ladder_price_min_ticks)
8813                        as u32;
8814        }
8815        if self.ladder_price_max_ticks != 0i64 {
8816            size
8817                += 1u32
8818                    + ::buffa::types::int64_encoded_len(self.ladder_price_max_ticks)
8819                        as u32;
8820        }
8821        if self.ladder_levels != 0i32 {
8822            size += 1u32 + ::buffa::types::int32_encoded_len(self.ladder_levels) as u32;
8823        }
8824        {
8825            let val = self.ladder_distribution.to_i32();
8826            if val != 0 {
8827                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8828            }
8829        }
8830        size += self.__buffa_unknown_fields.encoded_len() as u32;
8831        size
8832    }
8833    fn write_to(
8834        &self,
8835        _cache: &mut ::buffa::SizeCache,
8836        buf: &mut impl ::buffa::bytes::BufMut,
8837    ) {
8838        #[allow(unused_imports)]
8839        use ::buffa::Enumeration as _;
8840        if self.ladder_price_min_ticks != 0i64 {
8841            ::buffa::types::put_int64_field(1u32, self.ladder_price_min_ticks, buf);
8842        }
8843        if self.ladder_price_max_ticks != 0i64 {
8844            ::buffa::types::put_int64_field(2u32, self.ladder_price_max_ticks, buf);
8845        }
8846        if self.ladder_levels != 0i32 {
8847            ::buffa::types::put_int32_field(3u32, self.ladder_levels, buf);
8848        }
8849        {
8850            let val = self.ladder_distribution.to_i32();
8851            if val != 0 {
8852                ::buffa::types::put_int32_field(4u32, val, buf);
8853            }
8854        }
8855        self.__buffa_unknown_fields.write_to(buf);
8856    }
8857    fn merge_field(
8858        &mut self,
8859        tag: ::buffa::encoding::Tag,
8860        buf: &mut impl ::buffa::bytes::Buf,
8861        ctx: ::buffa::DecodeContext<'_>,
8862    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8863        #[allow(unused_imports)]
8864        use ::buffa::bytes::Buf as _;
8865        #[allow(unused_imports)]
8866        use ::buffa::Enumeration as _;
8867        match tag.field_number() {
8868            1u32 => {
8869                ::buffa::encoding::check_wire_type(
8870                    tag,
8871                    ::buffa::encoding::WireType::Varint,
8872                )?;
8873                self.ladder_price_min_ticks = ::buffa::types::decode_int64(buf)?;
8874            }
8875            2u32 => {
8876                ::buffa::encoding::check_wire_type(
8877                    tag,
8878                    ::buffa::encoding::WireType::Varint,
8879                )?;
8880                self.ladder_price_max_ticks = ::buffa::types::decode_int64(buf)?;
8881            }
8882            3u32 => {
8883                ::buffa::encoding::check_wire_type(
8884                    tag,
8885                    ::buffa::encoding::WireType::Varint,
8886                )?;
8887                self.ladder_levels = ::buffa::types::decode_int32(buf)?;
8888            }
8889            4u32 => {
8890                ::buffa::encoding::check_wire_type(
8891                    tag,
8892                    ::buffa::encoding::WireType::Varint,
8893                )?;
8894                self.ladder_distribution = ::buffa::EnumValue::from(
8895                    ::buffa::types::decode_int32(buf)?,
8896                );
8897            }
8898            _ => {
8899                self.__buffa_unknown_fields
8900                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8901            }
8902        }
8903        ::core::result::Result::Ok(())
8904    }
8905    fn clear(&mut self) {
8906        self.ladder_price_min_ticks = 0i64;
8907        self.ladder_price_max_ticks = 0i64;
8908        self.ladder_levels = 0i32;
8909        self.ladder_distribution = ::buffa::EnumValue::from(0);
8910        self.__buffa_unknown_fields.clear();
8911    }
8912}
8913impl ::buffa::ExtensionSet for LadderDetails {
8914    const PROTO_FQN: &'static str = "triggers.v1.LadderDetails";
8915    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8916        &self.__buffa_unknown_fields
8917    }
8918    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8919        &mut self.__buffa_unknown_fields
8920    }
8921}
8922impl ::buffa::json_helpers::ProtoElemJson for LadderDetails {
8923    fn serialize_proto_json<S: ::serde::Serializer>(
8924        v: &Self,
8925        s: S,
8926    ) -> ::core::result::Result<S::Ok, S::Error> {
8927        ::serde::Serialize::serialize(v, s)
8928    }
8929    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8930        d: D,
8931    ) -> ::core::result::Result<Self, D::Error> {
8932        <Self as ::serde::Deserialize>::deserialize(d)
8933    }
8934}
8935#[doc(hidden)]
8936pub const __LADDER_DETAILS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8937    type_url: "type.googleapis.com/triggers.v1.LadderDetails",
8938    to_json: ::buffa::type_registry::any_to_json::<LadderDetails>,
8939    from_json: ::buffa::type_registry::any_from_json::<LadderDetails>,
8940    is_wkt: false,
8941};
8942/// Trigger represents a trigger with its full state.
8943#[derive(Clone, PartialEq, Default)]
8944#[derive(::serde::Serialize)]
8945#[serde(default)]
8946pub struct Trigger {
8947    /// Trigger ID.
8948    ///
8949    /// Field 1: `trigger_id`
8950    #[serde(
8951        rename = "triggerId",
8952        alias = "trigger_id",
8953        with = "::buffa::json_helpers::uint64",
8954        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
8955    )]
8956    pub trigger_id: u64,
8957    /// Public account or sub-account ID associated with the trigger.
8958    ///
8959    /// Field 2: `subaccount_id`
8960    #[serde(
8961        rename = "subaccountId",
8962        alias = "subaccount_id",
8963        with = "::buffa::json_helpers::uint64",
8964        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
8965    )]
8966    pub subaccount_id: u64,
8967    /// Trading symbol numeric identifier.
8968    ///
8969    /// Field 3: `symbol_id`
8970    #[serde(
8971        rename = "symbolId",
8972        alias = "symbol_id",
8973        with = "::buffa::json_helpers::uint32",
8974        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
8975    )]
8976    pub symbol_id: u32,
8977    /// Trading symbol, for example "BTC-USDT".
8978    ///
8979    /// Field 4: `symbol`
8980    #[serde(
8981        rename = "symbol",
8982        with = "::buffa::json_helpers::proto_string",
8983        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
8984    )]
8985    pub symbol: ::buffa::alloc::string::String,
8986    /// Current trigger lifecycle status.
8987    ///
8988    /// Field 5: `status`
8989    #[serde(
8990        rename = "status",
8991        with = "::buffa::json_helpers::proto_enum",
8992        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
8993    )]
8994    pub status: ::buffa::EnumValue<TriggerStatus>,
8995    /// Parent order ID for attached-risk triggers; empty for standalone triggers.
8996    ///
8997    /// Field 6: `parent_order_id`
8998    #[serde(
8999        rename = "parentOrderId",
9000        alias = "parent_order_id",
9001        with = "::buffa::json_helpers::opt_uint64",
9002        skip_serializing_if = "::core::option::Option::is_none"
9003    )]
9004    pub parent_order_id: ::core::option::Option<u64>,
9005    /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
9006    ///
9007    /// Field 20: `qty_scaled`
9008    #[serde(
9009        rename = "qtyScaled",
9010        alias = "qty_scaled",
9011        with = "::buffa::json_helpers::int64",
9012        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
9013    )]
9014    pub qty_scaled: i64,
9015    /// Fee asset for BUY child orders.
9016    ///
9017    /// Field 21: `fee_asset`
9018    #[serde(
9019        rename = "feeAsset",
9020        alias = "fee_asset",
9021        with = "::buffa::json_helpers::proto_enum",
9022        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
9023    )]
9024    pub fee_asset: ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
9025    /// Self-trade prevention mode for child orders.
9026    ///
9027    /// Field 22: `self_trade_prevention_mode`
9028    #[serde(
9029        rename = "selfTradePreventionMode",
9030        alias = "self_trade_prevention_mode",
9031        with = "::buffa::json_helpers::proto_enum",
9032        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
9033    )]
9034    pub self_trade_prevention_mode: ::buffa::EnumValue<
9035        super::super::orders::v1::SelfTradePreventionMode,
9036    >,
9037    /// Client-provided trigger ID for idempotency and correlation.
9038    ///
9039    /// Field 60: `client_trigger_id`
9040    #[serde(
9041        rename = "clientTriggerId",
9042        alias = "client_trigger_id",
9043        with = "::buffa::json_helpers::proto_string",
9044        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
9045    )]
9046    pub client_trigger_id: ::buffa::alloc::string::String,
9047    /// Creation timestamp.
9048    ///
9049    /// Field 61: `created_at`
9050    #[serde(
9051        rename = "createdAt",
9052        alias = "created_at",
9053        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9054    )]
9055    pub created_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9056    /// Last update timestamp.
9057    ///
9058    /// Field 62: `updated_at`
9059    #[serde(
9060        rename = "updatedAt",
9061        alias = "updated_at",
9062        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9063    )]
9064    pub updated_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9065    /// Timestamp when the trigger became armed.
9066    ///
9067    /// Field 63: `armed_at`
9068    #[serde(
9069        rename = "armedAt",
9070        alias = "armed_at",
9071        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9072    )]
9073    pub armed_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9074    /// Timestamp when the trigger reached a terminal successful state.
9075    ///
9076    /// Field 64: `completed_at`
9077    #[serde(
9078        rename = "completedAt",
9079        alias = "completed_at",
9080        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9081    )]
9082    pub completed_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9083    /// Child orders spawned by this trigger.
9084    ///
9085    /// Field 70: `child_order_ids`
9086    #[serde(
9087        rename = "childOrderIds",
9088        alias = "child_order_ids",
9089        with = "::buffa::json_helpers::proto_seq",
9090        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
9091    )]
9092    pub child_order_ids: ::buffa::alloc::vec::Vec<u64>,
9093    #[serde(flatten)]
9094    pub configuration: ::core::option::Option<__buffa::oneof::trigger::Configuration>,
9095    #[serde(flatten)]
9096    pub runtime_details: ::core::option::Option<__buffa::oneof::trigger::RuntimeDetails>,
9097    #[serde(skip)]
9098    #[doc(hidden)]
9099    pub __buffa_unknown_fields: ::buffa::UnknownFields,
9100}
9101impl ::core::fmt::Debug for Trigger {
9102    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9103        f.debug_struct("Trigger")
9104            .field("trigger_id", &self.trigger_id)
9105            .field("subaccount_id", &self.subaccount_id)
9106            .field("symbol_id", &self.symbol_id)
9107            .field("symbol", &self.symbol)
9108            .field("status", &self.status)
9109            .field("parent_order_id", &self.parent_order_id)
9110            .field("qty_scaled", &self.qty_scaled)
9111            .field("fee_asset", &self.fee_asset)
9112            .field("self_trade_prevention_mode", &self.self_trade_prevention_mode)
9113            .field("client_trigger_id", &self.client_trigger_id)
9114            .field("created_at", &self.created_at)
9115            .field("updated_at", &self.updated_at)
9116            .field("armed_at", &self.armed_at)
9117            .field("completed_at", &self.completed_at)
9118            .field("child_order_ids", &self.child_order_ids)
9119            .field("configuration", &self.configuration)
9120            .field("runtime_details", &self.runtime_details)
9121            .finish()
9122    }
9123}
9124impl Trigger {
9125    /// Protobuf type URL for this message, for use with `Any::pack` and
9126    /// `Any::unpack_if`.
9127    ///
9128    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
9129    pub const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
9130}
9131impl Trigger {
9132    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9133    #[inline]
9134    ///Sets [`Self::parent_order_id`] to `Some(value)`, consuming and returning `self`.
9135    pub fn with_parent_order_id(mut self, value: u64) -> Self {
9136        self.parent_order_id = Some(value);
9137        self
9138    }
9139}
9140::buffa::impl_default_instance!(Trigger);
9141impl ::buffa::MessageName for Trigger {
9142    const PACKAGE: &'static str = "triggers.v1";
9143    const NAME: &'static str = "Trigger";
9144    const FULL_NAME: &'static str = "triggers.v1.Trigger";
9145    const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
9146}
9147impl ::buffa::Message for Trigger {
9148    /// Returns the total encoded size in bytes.
9149    ///
9150    /// The result is a `u32`; the protobuf specification requires all
9151    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
9152    /// compliant message will never overflow this type.
9153    #[allow(clippy::let_and_return)]
9154    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
9155        #[allow(unused_imports)]
9156        use ::buffa::Enumeration as _;
9157        let mut size = 0u32;
9158        if self.trigger_id != 0u64 {
9159            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9160        }
9161        if self.subaccount_id != 0u64 {
9162            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9163        }
9164        if self.symbol_id != 0u32 {
9165            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
9166        }
9167        if !self.symbol.is_empty() {
9168            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
9169        }
9170        {
9171            let val = self.status.to_i32();
9172            if val != 0 {
9173                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
9174            }
9175        }
9176        if self.parent_order_id.is_some() {
9177            size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
9178        }
9179        if self.qty_scaled != 0i64 {
9180            size += 2u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
9181        }
9182        {
9183            let val = self.fee_asset.to_i32();
9184            if val != 0 {
9185                size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
9186            }
9187        }
9188        {
9189            let val = self.self_trade_prevention_mode.to_i32();
9190            if val != 0 {
9191                size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
9192            }
9193        }
9194        if let ::core::option::Option::Some(ref v) = self.configuration {
9195            match v {
9196                __buffa::oneof::trigger::Configuration::StopLoss(x) => {
9197                    let __slot = __cache.reserve();
9198                    let inner = x.compute_size(__cache);
9199                    __cache.set(__slot, inner);
9200                    size
9201                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9202                            + inner;
9203                }
9204                __buffa::oneof::trigger::Configuration::TakeProfit(x) => {
9205                    let __slot = __cache.reserve();
9206                    let inner = x.compute_size(__cache);
9207                    __cache.set(__slot, inner);
9208                    size
9209                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9210                            + inner;
9211                }
9212                __buffa::oneof::trigger::Configuration::TrailingStop(x) => {
9213                    let __slot = __cache.reserve();
9214                    let inner = x.compute_size(__cache);
9215                    __cache.set(__slot, inner);
9216                    size
9217                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9218                            + inner;
9219                }
9220                __buffa::oneof::trigger::Configuration::Twap(x) => {
9221                    let __slot = __cache.reserve();
9222                    let inner = x.compute_size(__cache);
9223                    __cache.set(__slot, inner);
9224                    size
9225                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9226                            + inner;
9227                }
9228                __buffa::oneof::trigger::Configuration::Ladder(x) => {
9229                    let __slot = __cache.reserve();
9230                    let inner = x.compute_size(__cache);
9231                    __cache.set(__slot, inner);
9232                    size
9233                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9234                            + inner;
9235                }
9236            }
9237        }
9238        if !self.client_trigger_id.is_empty() {
9239            size
9240                += 2u32
9241                    + ::buffa::types::string_encoded_len(&self.client_trigger_id) as u32;
9242        }
9243        if self.created_at.is_set() {
9244            let __slot = __cache.reserve();
9245            let inner_size = self.created_at.compute_size(__cache);
9246            __cache.set(__slot, inner_size);
9247            size
9248                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9249                    + inner_size;
9250        }
9251        if self.updated_at.is_set() {
9252            let __slot = __cache.reserve();
9253            let inner_size = self.updated_at.compute_size(__cache);
9254            __cache.set(__slot, inner_size);
9255            size
9256                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9257                    + inner_size;
9258        }
9259        if self.armed_at.is_set() {
9260            let __slot = __cache.reserve();
9261            let inner_size = self.armed_at.compute_size(__cache);
9262            __cache.set(__slot, inner_size);
9263            size
9264                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9265                    + inner_size;
9266        }
9267        if self.completed_at.is_set() {
9268            let __slot = __cache.reserve();
9269            let inner_size = self.completed_at.compute_size(__cache);
9270            __cache.set(__slot, inner_size);
9271            size
9272                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9273                    + inner_size;
9274        }
9275        if !self.child_order_ids.is_empty() {
9276            let payload: u32 = self.child_order_ids.len() as u32
9277                * ::buffa::types::FIXED64_ENCODED_LEN as u32;
9278            size
9279                += 2u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
9280        }
9281        if let ::core::option::Option::Some(ref v) = self.runtime_details {
9282            match v {
9283                __buffa::oneof::trigger::RuntimeDetails::Stop(x) => {
9284                    let __slot = __cache.reserve();
9285                    let inner = x.compute_size(__cache);
9286                    __cache.set(__slot, inner);
9287                    size
9288                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9289                            + inner;
9290                }
9291                __buffa::oneof::trigger::RuntimeDetails::Trailing(x) => {
9292                    let __slot = __cache.reserve();
9293                    let inner = x.compute_size(__cache);
9294                    __cache.set(__slot, inner);
9295                    size
9296                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9297                            + inner;
9298                }
9299                __buffa::oneof::trigger::RuntimeDetails::TwapState(x) => {
9300                    let __slot = __cache.reserve();
9301                    let inner = x.compute_size(__cache);
9302                    __cache.set(__slot, inner);
9303                    size
9304                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9305                            + inner;
9306                }
9307                __buffa::oneof::trigger::RuntimeDetails::LadderState(x) => {
9308                    let __slot = __cache.reserve();
9309                    let inner = x.compute_size(__cache);
9310                    __cache.set(__slot, inner);
9311                    size
9312                        += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
9313                            + inner;
9314                }
9315            }
9316        }
9317        size += self.__buffa_unknown_fields.encoded_len() as u32;
9318        size
9319    }
9320    fn write_to(
9321        &self,
9322        __cache: &mut ::buffa::SizeCache,
9323        buf: &mut impl ::buffa::bytes::BufMut,
9324    ) {
9325        #[allow(unused_imports)]
9326        use ::buffa::Enumeration as _;
9327        if self.trigger_id != 0u64 {
9328            ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
9329        }
9330        if self.subaccount_id != 0u64 {
9331            ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
9332        }
9333        if self.symbol_id != 0u32 {
9334            ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
9335        }
9336        if !self.symbol.is_empty() {
9337            ::buffa::types::put_string_field(4u32, &self.symbol, buf);
9338        }
9339        {
9340            let val = self.status.to_i32();
9341            if val != 0 {
9342                ::buffa::types::put_int32_field(5u32, val, buf);
9343            }
9344        }
9345        if let Some(v) = self.parent_order_id {
9346            ::buffa::types::put_fixed64_field(6u32, v, buf);
9347        }
9348        if self.qty_scaled != 0i64 {
9349            ::buffa::types::put_int64_field(20u32, self.qty_scaled, buf);
9350        }
9351        {
9352            let val = self.fee_asset.to_i32();
9353            if val != 0 {
9354                ::buffa::types::put_int32_field(21u32, val, buf);
9355            }
9356        }
9357        {
9358            let val = self.self_trade_prevention_mode.to_i32();
9359            if val != 0 {
9360                ::buffa::types::put_int32_field(22u32, val, buf);
9361            }
9362        }
9363        if let ::core::option::Option::Some(ref v) = self.configuration {
9364            match v {
9365                __buffa::oneof::trigger::Configuration::StopLoss(x) => {
9366                    ::buffa::types::put_len_delimited_header(
9367                        30u32,
9368                        __cache.consume_next(),
9369                        buf,
9370                    );
9371                    x.write_to(__cache, buf);
9372                }
9373                __buffa::oneof::trigger::Configuration::TakeProfit(x) => {
9374                    ::buffa::types::put_len_delimited_header(
9375                        31u32,
9376                        __cache.consume_next(),
9377                        buf,
9378                    );
9379                    x.write_to(__cache, buf);
9380                }
9381                __buffa::oneof::trigger::Configuration::TrailingStop(x) => {
9382                    ::buffa::types::put_len_delimited_header(
9383                        32u32,
9384                        __cache.consume_next(),
9385                        buf,
9386                    );
9387                    x.write_to(__cache, buf);
9388                }
9389                __buffa::oneof::trigger::Configuration::Twap(x) => {
9390                    ::buffa::types::put_len_delimited_header(
9391                        33u32,
9392                        __cache.consume_next(),
9393                        buf,
9394                    );
9395                    x.write_to(__cache, buf);
9396                }
9397                __buffa::oneof::trigger::Configuration::Ladder(x) => {
9398                    ::buffa::types::put_len_delimited_header(
9399                        34u32,
9400                        __cache.consume_next(),
9401                        buf,
9402                    );
9403                    x.write_to(__cache, buf);
9404                }
9405            }
9406        }
9407        if !self.client_trigger_id.is_empty() {
9408            ::buffa::types::put_string_field(60u32, &self.client_trigger_id, buf);
9409        }
9410        if self.created_at.is_set() {
9411            ::buffa::types::put_len_delimited_header(61u32, __cache.consume_next(), buf);
9412            self.created_at.write_to(__cache, buf);
9413        }
9414        if self.updated_at.is_set() {
9415            ::buffa::types::put_len_delimited_header(62u32, __cache.consume_next(), buf);
9416            self.updated_at.write_to(__cache, buf);
9417        }
9418        if self.armed_at.is_set() {
9419            ::buffa::types::put_len_delimited_header(63u32, __cache.consume_next(), buf);
9420            self.armed_at.write_to(__cache, buf);
9421        }
9422        if self.completed_at.is_set() {
9423            ::buffa::types::put_len_delimited_header(64u32, __cache.consume_next(), buf);
9424            self.completed_at.write_to(__cache, buf);
9425        }
9426        if !self.child_order_ids.is_empty() {
9427            let payload: u32 = self.child_order_ids.len() as u32
9428                * ::buffa::types::FIXED64_ENCODED_LEN as u32;
9429            ::buffa::types::put_len_delimited_header(70u32, payload, buf);
9430            for &v in &self.child_order_ids {
9431                ::buffa::types::encode_fixed64(v, buf);
9432            }
9433        }
9434        if let ::core::option::Option::Some(ref v) = self.runtime_details {
9435            match v {
9436                __buffa::oneof::trigger::RuntimeDetails::Stop(x) => {
9437                    ::buffa::types::put_len_delimited_header(
9438                        100u32,
9439                        __cache.consume_next(),
9440                        buf,
9441                    );
9442                    x.write_to(__cache, buf);
9443                }
9444                __buffa::oneof::trigger::RuntimeDetails::Trailing(x) => {
9445                    ::buffa::types::put_len_delimited_header(
9446                        101u32,
9447                        __cache.consume_next(),
9448                        buf,
9449                    );
9450                    x.write_to(__cache, buf);
9451                }
9452                __buffa::oneof::trigger::RuntimeDetails::TwapState(x) => {
9453                    ::buffa::types::put_len_delimited_header(
9454                        102u32,
9455                        __cache.consume_next(),
9456                        buf,
9457                    );
9458                    x.write_to(__cache, buf);
9459                }
9460                __buffa::oneof::trigger::RuntimeDetails::LadderState(x) => {
9461                    ::buffa::types::put_len_delimited_header(
9462                        103u32,
9463                        __cache.consume_next(),
9464                        buf,
9465                    );
9466                    x.write_to(__cache, buf);
9467                }
9468            }
9469        }
9470        self.__buffa_unknown_fields.write_to(buf);
9471    }
9472    fn merge_field(
9473        &mut self,
9474        tag: ::buffa::encoding::Tag,
9475        buf: &mut impl ::buffa::bytes::Buf,
9476        ctx: ::buffa::DecodeContext<'_>,
9477    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
9478        #[allow(unused_imports)]
9479        use ::buffa::bytes::Buf as _;
9480        #[allow(unused_imports)]
9481        use ::buffa::Enumeration as _;
9482        match tag.field_number() {
9483            1u32 => {
9484                ::buffa::encoding::check_wire_type(
9485                    tag,
9486                    ::buffa::encoding::WireType::Fixed64,
9487                )?;
9488                self.trigger_id = ::buffa::types::decode_fixed64(buf)?;
9489            }
9490            2u32 => {
9491                ::buffa::encoding::check_wire_type(
9492                    tag,
9493                    ::buffa::encoding::WireType::Fixed64,
9494                )?;
9495                self.subaccount_id = ::buffa::types::decode_fixed64(buf)?;
9496            }
9497            3u32 => {
9498                ::buffa::encoding::check_wire_type(
9499                    tag,
9500                    ::buffa::encoding::WireType::Varint,
9501                )?;
9502                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
9503            }
9504            4u32 => {
9505                ::buffa::encoding::check_wire_type(
9506                    tag,
9507                    ::buffa::encoding::WireType::LengthDelimited,
9508                )?;
9509                ::buffa::types::merge_string(&mut self.symbol, buf)?;
9510            }
9511            5u32 => {
9512                ::buffa::encoding::check_wire_type(
9513                    tag,
9514                    ::buffa::encoding::WireType::Varint,
9515                )?;
9516                self.status = ::buffa::EnumValue::from(
9517                    ::buffa::types::decode_int32(buf)?,
9518                );
9519            }
9520            6u32 => {
9521                ::buffa::encoding::check_wire_type(
9522                    tag,
9523                    ::buffa::encoding::WireType::Fixed64,
9524                )?;
9525                self.parent_order_id = ::core::option::Option::Some(
9526                    ::buffa::types::decode_fixed64(buf)?,
9527                );
9528            }
9529            20u32 => {
9530                ::buffa::encoding::check_wire_type(
9531                    tag,
9532                    ::buffa::encoding::WireType::Varint,
9533                )?;
9534                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
9535            }
9536            21u32 => {
9537                ::buffa::encoding::check_wire_type(
9538                    tag,
9539                    ::buffa::encoding::WireType::Varint,
9540                )?;
9541                self.fee_asset = ::buffa::EnumValue::from(
9542                    ::buffa::types::decode_int32(buf)?,
9543                );
9544            }
9545            22u32 => {
9546                ::buffa::encoding::check_wire_type(
9547                    tag,
9548                    ::buffa::encoding::WireType::Varint,
9549                )?;
9550                self.self_trade_prevention_mode = ::buffa::EnumValue::from(
9551                    ::buffa::types::decode_int32(buf)?,
9552                );
9553            }
9554            30u32 => {
9555                ::buffa::encoding::check_wire_type(
9556                    tag,
9557                    ::buffa::encoding::WireType::LengthDelimited,
9558                )?;
9559                if let ::core::option::Option::Some(
9560                    __buffa::oneof::trigger::Configuration::StopLoss(ref mut existing),
9561                ) = self.configuration
9562                {
9563                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9564                } else {
9565                    let mut val = ::core::default::Default::default();
9566                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9567                    self.configuration = ::core::option::Option::Some(
9568                        __buffa::oneof::trigger::Configuration::StopLoss(
9569                            ::buffa::alloc::boxed::Box::new(val),
9570                        ),
9571                    );
9572                }
9573            }
9574            31u32 => {
9575                ::buffa::encoding::check_wire_type(
9576                    tag,
9577                    ::buffa::encoding::WireType::LengthDelimited,
9578                )?;
9579                if let ::core::option::Option::Some(
9580                    __buffa::oneof::trigger::Configuration::TakeProfit(ref mut existing),
9581                ) = self.configuration
9582                {
9583                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9584                } else {
9585                    let mut val = ::core::default::Default::default();
9586                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9587                    self.configuration = ::core::option::Option::Some(
9588                        __buffa::oneof::trigger::Configuration::TakeProfit(
9589                            ::buffa::alloc::boxed::Box::new(val),
9590                        ),
9591                    );
9592                }
9593            }
9594            32u32 => {
9595                ::buffa::encoding::check_wire_type(
9596                    tag,
9597                    ::buffa::encoding::WireType::LengthDelimited,
9598                )?;
9599                if let ::core::option::Option::Some(
9600                    __buffa::oneof::trigger::Configuration::TrailingStop(
9601                        ref mut existing,
9602                    ),
9603                ) = self.configuration
9604                {
9605                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9606                } else {
9607                    let mut val = ::core::default::Default::default();
9608                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9609                    self.configuration = ::core::option::Option::Some(
9610                        __buffa::oneof::trigger::Configuration::TrailingStop(
9611                            ::buffa::alloc::boxed::Box::new(val),
9612                        ),
9613                    );
9614                }
9615            }
9616            33u32 => {
9617                ::buffa::encoding::check_wire_type(
9618                    tag,
9619                    ::buffa::encoding::WireType::LengthDelimited,
9620                )?;
9621                if let ::core::option::Option::Some(
9622                    __buffa::oneof::trigger::Configuration::Twap(ref mut existing),
9623                ) = self.configuration
9624                {
9625                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9626                } else {
9627                    let mut val = ::core::default::Default::default();
9628                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9629                    self.configuration = ::core::option::Option::Some(
9630                        __buffa::oneof::trigger::Configuration::Twap(
9631                            ::buffa::alloc::boxed::Box::new(val),
9632                        ),
9633                    );
9634                }
9635            }
9636            34u32 => {
9637                ::buffa::encoding::check_wire_type(
9638                    tag,
9639                    ::buffa::encoding::WireType::LengthDelimited,
9640                )?;
9641                if let ::core::option::Option::Some(
9642                    __buffa::oneof::trigger::Configuration::Ladder(ref mut existing),
9643                ) = self.configuration
9644                {
9645                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9646                } else {
9647                    let mut val = ::core::default::Default::default();
9648                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9649                    self.configuration = ::core::option::Option::Some(
9650                        __buffa::oneof::trigger::Configuration::Ladder(
9651                            ::buffa::alloc::boxed::Box::new(val),
9652                        ),
9653                    );
9654                }
9655            }
9656            60u32 => {
9657                ::buffa::encoding::check_wire_type(
9658                    tag,
9659                    ::buffa::encoding::WireType::LengthDelimited,
9660                )?;
9661                ::buffa::types::merge_string(&mut self.client_trigger_id, buf)?;
9662            }
9663            61u32 => {
9664                ::buffa::encoding::check_wire_type(
9665                    tag,
9666                    ::buffa::encoding::WireType::LengthDelimited,
9667                )?;
9668                ::buffa::Message::merge_length_delimited(
9669                    self.created_at.get_or_insert_default(),
9670                    buf,
9671                    ctx,
9672                )?;
9673            }
9674            62u32 => {
9675                ::buffa::encoding::check_wire_type(
9676                    tag,
9677                    ::buffa::encoding::WireType::LengthDelimited,
9678                )?;
9679                ::buffa::Message::merge_length_delimited(
9680                    self.updated_at.get_or_insert_default(),
9681                    buf,
9682                    ctx,
9683                )?;
9684            }
9685            63u32 => {
9686                ::buffa::encoding::check_wire_type(
9687                    tag,
9688                    ::buffa::encoding::WireType::LengthDelimited,
9689                )?;
9690                ::buffa::Message::merge_length_delimited(
9691                    self.armed_at.get_or_insert_default(),
9692                    buf,
9693                    ctx,
9694                )?;
9695            }
9696            64u32 => {
9697                ::buffa::encoding::check_wire_type(
9698                    tag,
9699                    ::buffa::encoding::WireType::LengthDelimited,
9700                )?;
9701                ::buffa::Message::merge_length_delimited(
9702                    self.completed_at.get_or_insert_default(),
9703                    buf,
9704                    ctx,
9705                )?;
9706            }
9707            70u32 => {
9708                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
9709                    let len = ::buffa::encoding::decode_varint(buf)?;
9710                    let len = usize::try_from(len)
9711                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
9712                    if buf.remaining() < len {
9713                        return ::core::result::Result::Err(
9714                            ::buffa::DecodeError::UnexpectedEof,
9715                        );
9716                    }
9717                    self.child_order_ids.reserve(len / 8usize);
9718                    let mut limited = buf.take(len);
9719                    while limited.has_remaining() {
9720                        self.child_order_ids
9721                            .push(::buffa::types::decode_fixed64(&mut limited)?);
9722                    }
9723                    let leftover = limited.remaining();
9724                    if leftover > 0 {
9725                        limited.advance(leftover);
9726                    }
9727                } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 {
9728                    self.child_order_ids.push(::buffa::types::decode_fixed64(buf)?);
9729                } else {
9730                    return ::core::result::Result::Err(
9731                        ::buffa::encoding::wire_type_mismatch(
9732                            tag,
9733                            ::buffa::encoding::WireType::LengthDelimited,
9734                        ),
9735                    );
9736                }
9737            }
9738            100u32 => {
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::Stop(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::Stop(
9753                            ::buffa::alloc::boxed::Box::new(val),
9754                        ),
9755                    );
9756                }
9757            }
9758            101u32 => {
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::Trailing(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::Trailing(
9773                            ::buffa::alloc::boxed::Box::new(val),
9774                        ),
9775                    );
9776                }
9777            }
9778            102u32 => {
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::TwapState(ref mut existing),
9785                ) = self.runtime_details
9786                {
9787                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9788                } else {
9789                    let mut val = ::core::default::Default::default();
9790                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9791                    self.runtime_details = ::core::option::Option::Some(
9792                        __buffa::oneof::trigger::RuntimeDetails::TwapState(
9793                            ::buffa::alloc::boxed::Box::new(val),
9794                        ),
9795                    );
9796                }
9797            }
9798            103u32 => {
9799                ::buffa::encoding::check_wire_type(
9800                    tag,
9801                    ::buffa::encoding::WireType::LengthDelimited,
9802                )?;
9803                if let ::core::option::Option::Some(
9804                    __buffa::oneof::trigger::RuntimeDetails::LadderState(
9805                        ref mut existing,
9806                    ),
9807                ) = self.runtime_details
9808                {
9809                    ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
9810                } else {
9811                    let mut val = ::core::default::Default::default();
9812                    ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
9813                    self.runtime_details = ::core::option::Option::Some(
9814                        __buffa::oneof::trigger::RuntimeDetails::LadderState(
9815                            ::buffa::alloc::boxed::Box::new(val),
9816                        ),
9817                    );
9818                }
9819            }
9820            _ => {
9821                self.__buffa_unknown_fields
9822                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
9823            }
9824        }
9825        ::core::result::Result::Ok(())
9826    }
9827    fn clear(&mut self) {
9828        self.trigger_id = 0u64;
9829        self.subaccount_id = 0u64;
9830        self.symbol_id = 0u32;
9831        self.symbol.clear();
9832        self.status = ::buffa::EnumValue::from(0);
9833        self.parent_order_id = ::core::option::Option::None;
9834        self.qty_scaled = 0i64;
9835        self.fee_asset = ::buffa::EnumValue::from(0);
9836        self.self_trade_prevention_mode = ::buffa::EnumValue::from(0);
9837        self.configuration = ::core::option::Option::None;
9838        self.client_trigger_id.clear();
9839        self.created_at = ::buffa::MessageField::none();
9840        self.updated_at = ::buffa::MessageField::none();
9841        self.armed_at = ::buffa::MessageField::none();
9842        self.completed_at = ::buffa::MessageField::none();
9843        self.child_order_ids.clear();
9844        self.runtime_details = ::core::option::Option::None;
9845        self.__buffa_unknown_fields.clear();
9846    }
9847}
9848impl ::buffa::ExtensionSet for Trigger {
9849    const PROTO_FQN: &'static str = "triggers.v1.Trigger";
9850    fn unknown_fields(&self) -> &::buffa::UnknownFields {
9851        &self.__buffa_unknown_fields
9852    }
9853    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
9854        &mut self.__buffa_unknown_fields
9855    }
9856}
9857impl<'de> serde::Deserialize<'de> for Trigger {
9858    fn deserialize<D: serde::Deserializer<'de>>(
9859        d: D,
9860    ) -> ::core::result::Result<Self, D::Error> {
9861        struct _V;
9862        impl<'de> serde::de::Visitor<'de> for _V {
9863            type Value = Trigger;
9864            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9865                f.write_str("struct Trigger")
9866            }
9867            #[allow(clippy::field_reassign_with_default)]
9868            fn visit_map<A: serde::de::MapAccess<'de>>(
9869                self,
9870                mut map: A,
9871            ) -> ::core::result::Result<Trigger, A::Error> {
9872                let mut __f_trigger_id: ::core::option::Option<u64> = None;
9873                let mut __f_subaccount_id: ::core::option::Option<u64> = None;
9874                let mut __f_symbol_id: ::core::option::Option<u32> = None;
9875                let mut __f_symbol: ::core::option::Option<
9876                    ::buffa::alloc::string::String,
9877                > = None;
9878                let mut __f_status: ::core::option::Option<
9879                    ::buffa::EnumValue<TriggerStatus>,
9880                > = None;
9881                let mut __f_parent_order_id: ::core::option::Option<
9882                    ::core::option::Option<u64>,
9883                > = None;
9884                let mut __f_qty_scaled: ::core::option::Option<i64> = None;
9885                let mut __f_fee_asset: ::core::option::Option<
9886                    ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
9887                > = None;
9888                let mut __f_self_trade_prevention_mode: ::core::option::Option<
9889                    ::buffa::EnumValue<super::super::orders::v1::SelfTradePreventionMode>,
9890                > = None;
9891                let mut __f_client_trigger_id: ::core::option::Option<
9892                    ::buffa::alloc::string::String,
9893                > = None;
9894                let mut __f_created_at: ::core::option::Option<
9895                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9896                > = None;
9897                let mut __f_updated_at: ::core::option::Option<
9898                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9899                > = None;
9900                let mut __f_armed_at: ::core::option::Option<
9901                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9902                > = None;
9903                let mut __f_completed_at: ::core::option::Option<
9904                    ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
9905                > = None;
9906                let mut __f_child_order_ids: ::core::option::Option<
9907                    ::buffa::alloc::vec::Vec<u64>,
9908                > = None;
9909                let mut __oneof_configuration: ::core::option::Option<
9910                    __buffa::oneof::trigger::Configuration,
9911                > = None;
9912                let mut __oneof_runtime_details: ::core::option::Option<
9913                    __buffa::oneof::trigger::RuntimeDetails,
9914                > = None;
9915                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
9916                    match key.as_str() {
9917                        "triggerId" | "trigger_id" => {
9918                            __f_trigger_id = Some({
9919                                struct _S;
9920                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9921                                    type Value = u64;
9922                                    fn deserialize<D: serde::Deserializer<'de>>(
9923                                        self,
9924                                        d: D,
9925                                    ) -> ::core::result::Result<u64, D::Error> {
9926                                        ::buffa::json_helpers::uint64::deserialize(d)
9927                                    }
9928                                }
9929                                map.next_value_seed(_S)?
9930                            });
9931                        }
9932                        "subaccountId" | "subaccount_id" => {
9933                            __f_subaccount_id = Some({
9934                                struct _S;
9935                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9936                                    type Value = u64;
9937                                    fn deserialize<D: serde::Deserializer<'de>>(
9938                                        self,
9939                                        d: D,
9940                                    ) -> ::core::result::Result<u64, D::Error> {
9941                                        ::buffa::json_helpers::uint64::deserialize(d)
9942                                    }
9943                                }
9944                                map.next_value_seed(_S)?
9945                            });
9946                        }
9947                        "symbolId" | "symbol_id" => {
9948                            __f_symbol_id = Some({
9949                                struct _S;
9950                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9951                                    type Value = u32;
9952                                    fn deserialize<D: serde::Deserializer<'de>>(
9953                                        self,
9954                                        d: D,
9955                                    ) -> ::core::result::Result<u32, D::Error> {
9956                                        ::buffa::json_helpers::uint32::deserialize(d)
9957                                    }
9958                                }
9959                                map.next_value_seed(_S)?
9960                            });
9961                        }
9962                        "symbol" => {
9963                            __f_symbol = Some({
9964                                struct _S;
9965                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9966                                    type Value = ::buffa::alloc::string::String;
9967                                    fn deserialize<D: serde::Deserializer<'de>>(
9968                                        self,
9969                                        d: D,
9970                                    ) -> ::core::result::Result<
9971                                        ::buffa::alloc::string::String,
9972                                        D::Error,
9973                                    > {
9974                                        ::buffa::json_helpers::proto_string::deserialize(d)
9975                                    }
9976                                }
9977                                map.next_value_seed(_S)?
9978                            });
9979                        }
9980                        "status" => {
9981                            __f_status = Some({
9982                                struct _S;
9983                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
9984                                    type Value = ::buffa::EnumValue<TriggerStatus>;
9985                                    fn deserialize<D: serde::Deserializer<'de>>(
9986                                        self,
9987                                        d: D,
9988                                    ) -> ::core::result::Result<
9989                                        ::buffa::EnumValue<TriggerStatus>,
9990                                        D::Error,
9991                                    > {
9992                                        ::buffa::json_helpers::proto_enum::deserialize(d)
9993                                    }
9994                                }
9995                                map.next_value_seed(_S)?
9996                            });
9997                        }
9998                        "parentOrderId" | "parent_order_id" => {
9999                            __f_parent_order_id = Some({
10000                                struct _S;
10001                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10002                                    type Value = ::core::option::Option<u64>;
10003                                    fn deserialize<D: serde::Deserializer<'de>>(
10004                                        self,
10005                                        d: D,
10006                                    ) -> ::core::result::Result<
10007                                        ::core::option::Option<u64>,
10008                                        D::Error,
10009                                    > {
10010                                        ::buffa::json_helpers::opt_uint64::deserialize(d)
10011                                    }
10012                                }
10013                                map.next_value_seed(_S)?
10014                            });
10015                        }
10016                        "qtyScaled" | "qty_scaled" => {
10017                            __f_qty_scaled = Some({
10018                                struct _S;
10019                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10020                                    type Value = i64;
10021                                    fn deserialize<D: serde::Deserializer<'de>>(
10022                                        self,
10023                                        d: D,
10024                                    ) -> ::core::result::Result<i64, D::Error> {
10025                                        ::buffa::json_helpers::int64::deserialize(d)
10026                                    }
10027                                }
10028                                map.next_value_seed(_S)?
10029                            });
10030                        }
10031                        "feeAsset" | "fee_asset" => {
10032                            __f_fee_asset = Some({
10033                                struct _S;
10034                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10035                                    type Value = ::buffa::EnumValue<
10036                                        super::super::orders::v1::FeeAsset,
10037                                    >;
10038                                    fn deserialize<D: serde::Deserializer<'de>>(
10039                                        self,
10040                                        d: D,
10041                                    ) -> ::core::result::Result<
10042                                        ::buffa::EnumValue<super::super::orders::v1::FeeAsset>,
10043                                        D::Error,
10044                                    > {
10045                                        ::buffa::json_helpers::proto_enum::deserialize(d)
10046                                    }
10047                                }
10048                                map.next_value_seed(_S)?
10049                            });
10050                        }
10051                        "selfTradePreventionMode" | "self_trade_prevention_mode" => {
10052                            __f_self_trade_prevention_mode = Some({
10053                                struct _S;
10054                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10055                                    type Value = ::buffa::EnumValue<
10056                                        super::super::orders::v1::SelfTradePreventionMode,
10057                                    >;
10058                                    fn deserialize<D: serde::Deserializer<'de>>(
10059                                        self,
10060                                        d: D,
10061                                    ) -> ::core::result::Result<
10062                                        ::buffa::EnumValue<
10063                                            super::super::orders::v1::SelfTradePreventionMode,
10064                                        >,
10065                                        D::Error,
10066                                    > {
10067                                        ::buffa::json_helpers::proto_enum::deserialize(d)
10068                                    }
10069                                }
10070                                map.next_value_seed(_S)?
10071                            });
10072                        }
10073                        "clientTriggerId" | "client_trigger_id" => {
10074                            __f_client_trigger_id = Some({
10075                                struct _S;
10076                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10077                                    type Value = ::buffa::alloc::string::String;
10078                                    fn deserialize<D: serde::Deserializer<'de>>(
10079                                        self,
10080                                        d: D,
10081                                    ) -> ::core::result::Result<
10082                                        ::buffa::alloc::string::String,
10083                                        D::Error,
10084                                    > {
10085                                        ::buffa::json_helpers::proto_string::deserialize(d)
10086                                    }
10087                                }
10088                                map.next_value_seed(_S)?
10089                            });
10090                        }
10091                        "createdAt" | "created_at" => {
10092                            __f_created_at = Some(
10093                                map
10094                                    .next_value::<
10095                                        ::buffa::MessageField<
10096                                            ::buffa_types::google::protobuf::Timestamp,
10097                                        >,
10098                                    >()?,
10099                            );
10100                        }
10101                        "updatedAt" | "updated_at" => {
10102                            __f_updated_at = Some(
10103                                map
10104                                    .next_value::<
10105                                        ::buffa::MessageField<
10106                                            ::buffa_types::google::protobuf::Timestamp,
10107                                        >,
10108                                    >()?,
10109                            );
10110                        }
10111                        "armedAt" | "armed_at" => {
10112                            __f_armed_at = Some(
10113                                map
10114                                    .next_value::<
10115                                        ::buffa::MessageField<
10116                                            ::buffa_types::google::protobuf::Timestamp,
10117                                        >,
10118                                    >()?,
10119                            );
10120                        }
10121                        "completedAt" | "completed_at" => {
10122                            __f_completed_at = Some(
10123                                map
10124                                    .next_value::<
10125                                        ::buffa::MessageField<
10126                                            ::buffa_types::google::protobuf::Timestamp,
10127                                        >,
10128                                    >()?,
10129                            );
10130                        }
10131                        "childOrderIds" | "child_order_ids" => {
10132                            __f_child_order_ids = Some({
10133                                struct _S;
10134                                impl<'de> serde::de::DeserializeSeed<'de> for _S {
10135                                    type Value = ::buffa::alloc::vec::Vec<u64>;
10136                                    fn deserialize<D: serde::Deserializer<'de>>(
10137                                        self,
10138                                        d: D,
10139                                    ) -> ::core::result::Result<
10140                                        ::buffa::alloc::vec::Vec<u64>,
10141                                        D::Error,
10142                                    > {
10143                                        ::buffa::json_helpers::proto_seq::deserialize(d)
10144                                    }
10145                                }
10146                                map.next_value_seed(_S)?
10147                            });
10148                        }
10149                        "stopLoss" | "stop_loss" => {
10150                            let v: ::core::option::Option<ConditionalTrigger> = map
10151                                .next_value_seed(
10152                                    ::buffa::json_helpers::NullableDeserializeSeed(
10153                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10154                                            ConditionalTrigger,
10155                                        >::new(),
10156                                    ),
10157                                )?;
10158                            if let Some(v) = v {
10159                                if __oneof_configuration.is_some() {
10160                                    return Err(
10161                                        serde::de::Error::custom(
10162                                            "multiple oneof fields set for 'configuration'",
10163                                        ),
10164                                    );
10165                                }
10166                                __oneof_configuration = Some(
10167                                    __buffa::oneof::trigger::Configuration::StopLoss(
10168                                        ::buffa::alloc::boxed::Box::new(v),
10169                                    ),
10170                                );
10171                            }
10172                        }
10173                        "takeProfit" | "take_profit" => {
10174                            let v: ::core::option::Option<ConditionalTrigger> = map
10175                                .next_value_seed(
10176                                    ::buffa::json_helpers::NullableDeserializeSeed(
10177                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10178                                            ConditionalTrigger,
10179                                        >::new(),
10180                                    ),
10181                                )?;
10182                            if let Some(v) = v {
10183                                if __oneof_configuration.is_some() {
10184                                    return Err(
10185                                        serde::de::Error::custom(
10186                                            "multiple oneof fields set for 'configuration'",
10187                                        ),
10188                                    );
10189                                }
10190                                __oneof_configuration = Some(
10191                                    __buffa::oneof::trigger::Configuration::TakeProfit(
10192                                        ::buffa::alloc::boxed::Box::new(v),
10193                                    ),
10194                                );
10195                            }
10196                        }
10197                        "trailingStop" | "trailing_stop" => {
10198                            let v: ::core::option::Option<TrailingStopTrigger> = map
10199                                .next_value_seed(
10200                                    ::buffa::json_helpers::NullableDeserializeSeed(
10201                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10202                                            TrailingStopTrigger,
10203                                        >::new(),
10204                                    ),
10205                                )?;
10206                            if let Some(v) = v {
10207                                if __oneof_configuration.is_some() {
10208                                    return Err(
10209                                        serde::de::Error::custom(
10210                                            "multiple oneof fields set for 'configuration'",
10211                                        ),
10212                                    );
10213                                }
10214                                __oneof_configuration = Some(
10215                                    __buffa::oneof::trigger::Configuration::TrailingStop(
10216                                        ::buffa::alloc::boxed::Box::new(v),
10217                                    ),
10218                                );
10219                            }
10220                        }
10221                        "twap" => {
10222                            let v: ::core::option::Option<TwapTrigger> = map
10223                                .next_value_seed(
10224                                    ::buffa::json_helpers::NullableDeserializeSeed(
10225                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10226                                            TwapTrigger,
10227                                        >::new(),
10228                                    ),
10229                                )?;
10230                            if let Some(v) = v {
10231                                if __oneof_configuration.is_some() {
10232                                    return Err(
10233                                        serde::de::Error::custom(
10234                                            "multiple oneof fields set for 'configuration'",
10235                                        ),
10236                                    );
10237                                }
10238                                __oneof_configuration = Some(
10239                                    __buffa::oneof::trigger::Configuration::Twap(
10240                                        ::buffa::alloc::boxed::Box::new(v),
10241                                    ),
10242                                );
10243                            }
10244                        }
10245                        "ladder" => {
10246                            let v: ::core::option::Option<LadderTrigger> = map
10247                                .next_value_seed(
10248                                    ::buffa::json_helpers::NullableDeserializeSeed(
10249                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10250                                            LadderTrigger,
10251                                        >::new(),
10252                                    ),
10253                                )?;
10254                            if let Some(v) = v {
10255                                if __oneof_configuration.is_some() {
10256                                    return Err(
10257                                        serde::de::Error::custom(
10258                                            "multiple oneof fields set for 'configuration'",
10259                                        ),
10260                                    );
10261                                }
10262                                __oneof_configuration = Some(
10263                                    __buffa::oneof::trigger::Configuration::Ladder(
10264                                        ::buffa::alloc::boxed::Box::new(v),
10265                                    ),
10266                                );
10267                            }
10268                        }
10269                        "stop" => {
10270                            let v: ::core::option::Option<StopDetails> = map
10271                                .next_value_seed(
10272                                    ::buffa::json_helpers::NullableDeserializeSeed(
10273                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10274                                            StopDetails,
10275                                        >::new(),
10276                                    ),
10277                                )?;
10278                            if let Some(v) = v {
10279                                if __oneof_runtime_details.is_some() {
10280                                    return Err(
10281                                        serde::de::Error::custom(
10282                                            "multiple oneof fields set for 'runtime_details'",
10283                                        ),
10284                                    );
10285                                }
10286                                __oneof_runtime_details = Some(
10287                                    __buffa::oneof::trigger::RuntimeDetails::Stop(
10288                                        ::buffa::alloc::boxed::Box::new(v),
10289                                    ),
10290                                );
10291                            }
10292                        }
10293                        "trailing" => {
10294                            let v: ::core::option::Option<TrailingDetails> = map
10295                                .next_value_seed(
10296                                    ::buffa::json_helpers::NullableDeserializeSeed(
10297                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10298                                            TrailingDetails,
10299                                        >::new(),
10300                                    ),
10301                                )?;
10302                            if let Some(v) = v {
10303                                if __oneof_runtime_details.is_some() {
10304                                    return Err(
10305                                        serde::de::Error::custom(
10306                                            "multiple oneof fields set for 'runtime_details'",
10307                                        ),
10308                                    );
10309                                }
10310                                __oneof_runtime_details = Some(
10311                                    __buffa::oneof::trigger::RuntimeDetails::Trailing(
10312                                        ::buffa::alloc::boxed::Box::new(v),
10313                                    ),
10314                                );
10315                            }
10316                        }
10317                        "twapState" | "twap_state" => {
10318                            let v: ::core::option::Option<TwapDetails> = map
10319                                .next_value_seed(
10320                                    ::buffa::json_helpers::NullableDeserializeSeed(
10321                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10322                                            TwapDetails,
10323                                        >::new(),
10324                                    ),
10325                                )?;
10326                            if let Some(v) = v {
10327                                if __oneof_runtime_details.is_some() {
10328                                    return Err(
10329                                        serde::de::Error::custom(
10330                                            "multiple oneof fields set for 'runtime_details'",
10331                                        ),
10332                                    );
10333                                }
10334                                __oneof_runtime_details = Some(
10335                                    __buffa::oneof::trigger::RuntimeDetails::TwapState(
10336                                        ::buffa::alloc::boxed::Box::new(v),
10337                                    ),
10338                                );
10339                            }
10340                        }
10341                        "ladderState" | "ladder_state" => {
10342                            let v: ::core::option::Option<LadderDetails> = map
10343                                .next_value_seed(
10344                                    ::buffa::json_helpers::NullableDeserializeSeed(
10345                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
10346                                            LadderDetails,
10347                                        >::new(),
10348                                    ),
10349                                )?;
10350                            if let Some(v) = v {
10351                                if __oneof_runtime_details.is_some() {
10352                                    return Err(
10353                                        serde::de::Error::custom(
10354                                            "multiple oneof fields set for 'runtime_details'",
10355                                        ),
10356                                    );
10357                                }
10358                                __oneof_runtime_details = Some(
10359                                    __buffa::oneof::trigger::RuntimeDetails::LadderState(
10360                                        ::buffa::alloc::boxed::Box::new(v),
10361                                    ),
10362                                );
10363                            }
10364                        }
10365                        _ => {
10366                            map.next_value::<serde::de::IgnoredAny>()?;
10367                        }
10368                    }
10369                }
10370                let mut __r = <Trigger as ::core::default::Default>::default();
10371                if let ::core::option::Option::Some(v) = __f_trigger_id {
10372                    __r.trigger_id = v;
10373                }
10374                if let ::core::option::Option::Some(v) = __f_subaccount_id {
10375                    __r.subaccount_id = v;
10376                }
10377                if let ::core::option::Option::Some(v) = __f_symbol_id {
10378                    __r.symbol_id = v;
10379                }
10380                if let ::core::option::Option::Some(v) = __f_symbol {
10381                    __r.symbol = v;
10382                }
10383                if let ::core::option::Option::Some(v) = __f_status {
10384                    __r.status = v;
10385                }
10386                if let ::core::option::Option::Some(v) = __f_parent_order_id {
10387                    __r.parent_order_id = v;
10388                }
10389                if let ::core::option::Option::Some(v) = __f_qty_scaled {
10390                    __r.qty_scaled = v;
10391                }
10392                if let ::core::option::Option::Some(v) = __f_fee_asset {
10393                    __r.fee_asset = v;
10394                }
10395                if let ::core::option::Option::Some(v) = __f_self_trade_prevention_mode {
10396                    __r.self_trade_prevention_mode = v;
10397                }
10398                if let ::core::option::Option::Some(v) = __f_client_trigger_id {
10399                    __r.client_trigger_id = v;
10400                }
10401                if let ::core::option::Option::Some(v) = __f_created_at {
10402                    __r.created_at = v;
10403                }
10404                if let ::core::option::Option::Some(v) = __f_updated_at {
10405                    __r.updated_at = v;
10406                }
10407                if let ::core::option::Option::Some(v) = __f_armed_at {
10408                    __r.armed_at = v;
10409                }
10410                if let ::core::option::Option::Some(v) = __f_completed_at {
10411                    __r.completed_at = v;
10412                }
10413                if let ::core::option::Option::Some(v) = __f_child_order_ids {
10414                    __r.child_order_ids = v;
10415                }
10416                __r.configuration = __oneof_configuration;
10417                __r.runtime_details = __oneof_runtime_details;
10418                Ok(__r)
10419            }
10420        }
10421        d.deserialize_map(_V)
10422    }
10423}
10424impl ::buffa::json_helpers::ProtoElemJson for Trigger {
10425    fn serialize_proto_json<S: ::serde::Serializer>(
10426        v: &Self,
10427        s: S,
10428    ) -> ::core::result::Result<S::Ok, S::Error> {
10429        ::serde::Serialize::serialize(v, s)
10430    }
10431    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
10432        d: D,
10433    ) -> ::core::result::Result<Self, D::Error> {
10434        <Self as ::serde::Deserialize>::deserialize(d)
10435    }
10436}
10437#[doc(hidden)]
10438pub const __TRIGGER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
10439    type_url: "type.googleapis.com/triggers.v1.Trigger",
10440    to_json: ::buffa::type_registry::any_to_json::<Trigger>,
10441    from_json: ::buffa::type_registry::any_from_json::<Trigger>,
10442    is_wkt: false,
10443};
10444pub mod trigger {
10445    #[allow(unused_imports)]
10446    use super::*;
10447    #[doc(inline)]
10448    pub use super::__buffa::oneof::trigger::Configuration;
10449    #[doc(inline)]
10450    pub use super::__buffa::oneof::trigger::RuntimeDetails;
10451    #[doc(inline)]
10452    pub use super::__buffa::view::oneof::trigger::Configuration as ConfigurationView;
10453    #[doc(inline)]
10454    pub use super::__buffa::view::oneof::trigger::RuntimeDetails as RuntimeDetailsView;
10455}
10456#[allow(
10457    non_camel_case_types,
10458    dead_code,
10459    unused_imports,
10460    unused_qualifications,
10461    clippy::derivable_impls,
10462    clippy::match_single_binding,
10463    clippy::uninlined_format_args,
10464    clippy::doc_lazy_continuation,
10465    clippy::module_inception
10466)]
10467pub mod __buffa {
10468    #[allow(unused_imports)]
10469    use super::*;
10470    pub mod view {
10471        #[allow(unused_imports)]
10472        use super::*;
10473        /// =============================================================================
10474        /// Create Trigger Request/Response
10475        /// =============================================================================
10476        ///
10477        /// TriggerMarketIoc configures an immediate market child.
10478        #[derive(Clone, Debug, Default)]
10479        pub struct TriggerMarketIocView<'a> {
10480            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10481        }
10482        impl<'a> ::buffa::MessageView<'a> for TriggerMarketIocView<'a> {
10483            type Owned = super::super::TriggerMarketIoc;
10484            fn decode_view(
10485                buf: &'a [u8],
10486            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10487                let __limit = ::core::cell::Cell::new(
10488                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10489                );
10490                <Self as ::buffa::MessageView>::decode_view_ctx(
10491                    buf,
10492                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10493                )
10494            }
10495            fn decode_view_with_ctx(
10496                buf: &'a [u8],
10497                ctx: ::buffa::DecodeContext<'_>,
10498            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10499                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10500            }
10501            fn merge_view_field(
10502                &mut self,
10503                tag: ::buffa::encoding::Tag,
10504                cur: &'a [u8],
10505                before_tag: &'a [u8],
10506                ctx: ::buffa::DecodeContext<'_>,
10507            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10508                let _ = ctx;
10509                #[allow(unused_variables)]
10510                let view = self;
10511                let mut cur = cur;
10512                match tag.field_number() {
10513                    _ => {
10514                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10515                        let span_len = before_tag.len() - cur.len();
10516                        view.__buffa_unknown_fields
10517                            .push_record(before_tag, span_len, ctx)?;
10518                    }
10519                }
10520                ::core::result::Result::Ok(cur)
10521            }
10522            fn to_owned_message(
10523                &self,
10524            ) -> ::core::result::Result<
10525                super::super::TriggerMarketIoc,
10526                ::buffa::DecodeError,
10527            > {
10528                self.to_owned_from_source(None)
10529            }
10530            #[allow(clippy::useless_conversion, clippy::needless_update)]
10531            fn to_owned_from_source(
10532                &self,
10533                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10534            ) -> ::core::result::Result<
10535                super::super::TriggerMarketIoc,
10536                ::buffa::DecodeError,
10537            > {
10538                #[allow(unused_imports)]
10539                use ::buffa::alloc::string::ToString as _;
10540                let _ = __buffa_src;
10541                ::core::result::Result::Ok(super::super::TriggerMarketIoc {
10542                    __buffa_unknown_fields: self
10543                        .__buffa_unknown_fields
10544                        .to_owned()?
10545                        .into(),
10546                    ..::core::default::Default::default()
10547                })
10548            }
10549        }
10550        impl<'a> ::buffa::ViewEncode<'a> for TriggerMarketIocView<'a> {
10551            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10552            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10553                #[allow(unused_imports)]
10554                use ::buffa::Enumeration as _;
10555                let mut size = 0u32;
10556                size += self.__buffa_unknown_fields.encoded_len() as u32;
10557                size
10558            }
10559            #[allow(clippy::needless_borrow)]
10560            fn write_to(
10561                &self,
10562                _cache: &mut ::buffa::SizeCache,
10563                buf: &mut impl ::buffa::bytes::BufMut,
10564            ) {
10565                #[allow(unused_imports)]
10566                use ::buffa::Enumeration as _;
10567                self.__buffa_unknown_fields.write_to(buf);
10568            }
10569        }
10570        /// Serializes this view as protobuf JSON.
10571        ///
10572        /// Implicit-presence fields with default values are omitted, `required`
10573        /// fields are always emitted, explicit-presence (`optional`) fields are
10574        /// emitted only when set, bytes fields are base64-encoded, and enum
10575        /// values are their proto name strings.
10576        ///
10577        /// This impl uses `serialize_map(None)` because the number of emitted
10578        /// fields depends on default-omission rules; serializers that require
10579        /// known map lengths (e.g. `bincode`) will return a runtime error.
10580        /// Use the owned message type for those formats.
10581        impl<'__a> ::serde::Serialize for TriggerMarketIocView<'__a> {
10582            fn serialize<__S: ::serde::Serializer>(
10583                &self,
10584                __s: __S,
10585            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10586                use ::serde::ser::SerializeMap as _;
10587                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10588                __map.end()
10589            }
10590        }
10591        impl<'a> ::buffa::MessageName for TriggerMarketIocView<'a> {
10592            const PACKAGE: &'static str = "triggers.v1";
10593            const NAME: &'static str = "TriggerMarketIoc";
10594            const FULL_NAME: &'static str = "triggers.v1.TriggerMarketIoc";
10595            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerMarketIoc";
10596        }
10597        ::buffa::impl_default_view_instance!(TriggerMarketIocView);
10598        ::buffa::impl_view_reborrow!(TriggerMarketIocView);
10599        /** Self-contained, `'static` owned view of a `TriggerMarketIoc` message.
10600
10601 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.
10602
10603 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.*/
10604        #[derive(Clone, Debug)]
10605        pub struct TriggerMarketIocOwnedView(
10606            ::buffa::OwnedView<TriggerMarketIocView<'static>>,
10607        );
10608        impl TriggerMarketIocOwnedView {
10609            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10610            ///
10611            /// The view borrows directly from the buffer's data; the buffer is
10612            /// retained inside the returned handle.
10613            ///
10614            /// # Errors
10615            ///
10616            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10617            /// protobuf data.
10618            pub fn decode(
10619                bytes: ::buffa::bytes::Bytes,
10620            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10621                ::core::result::Result::Ok(
10622                    TriggerMarketIocOwnedView(::buffa::OwnedView::decode(bytes)?),
10623                )
10624            }
10625            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10626            /// max message size).
10627            ///
10628            /// # Errors
10629            ///
10630            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10631            /// exceeds the configured limits.
10632            pub fn decode_with_options(
10633                bytes: ::buffa::bytes::Bytes,
10634                opts: &::buffa::DecodeOptions,
10635            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10636                ::core::result::Result::Ok(
10637                    TriggerMarketIocOwnedView(
10638                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10639                    ),
10640                )
10641            }
10642            /// Build from an owned message via an encode → decode round-trip.
10643            ///
10644            /// # Errors
10645            ///
10646            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10647            /// somehow invalid (should not happen for well-formed messages).
10648            pub fn from_owned(
10649                msg: &super::super::TriggerMarketIoc,
10650            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10651                ::core::result::Result::Ok(
10652                    TriggerMarketIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
10653                )
10654            }
10655            /// Borrow the full [`TriggerMarketIocView`] with its lifetime tied to `&self`.
10656            #[must_use]
10657            pub fn view(&self) -> &TriggerMarketIocView<'_> {
10658                self.0.reborrow()
10659            }
10660            /// Convert to the owned message type.
10661            ///
10662            /// # Errors
10663            ///
10664            /// Returns an error if re-materializing preserved unknown fields
10665            /// fails (e.g. the unknown-field limit is exceeded).
10666            pub fn to_owned_message(
10667                &self,
10668            ) -> ::core::result::Result<
10669                super::super::TriggerMarketIoc,
10670                ::buffa::DecodeError,
10671            > {
10672                self.0.to_owned_message()
10673            }
10674            /// The underlying bytes buffer.
10675            #[must_use]
10676            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10677                self.0.bytes()
10678            }
10679            /// Consume the handle, returning the underlying bytes buffer.
10680            #[must_use]
10681            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10682                self.0.into_bytes()
10683            }
10684        }
10685        impl ::core::convert::From<::buffa::OwnedView<TriggerMarketIocView<'static>>>
10686        for TriggerMarketIocOwnedView {
10687            fn from(inner: ::buffa::OwnedView<TriggerMarketIocView<'static>>) -> Self {
10688                TriggerMarketIocOwnedView(inner)
10689            }
10690        }
10691        impl ::core::convert::From<TriggerMarketIocOwnedView>
10692        for ::buffa::OwnedView<TriggerMarketIocView<'static>> {
10693            fn from(wrapper: TriggerMarketIocOwnedView) -> Self {
10694                wrapper.0
10695            }
10696        }
10697        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerMarketIocView<'static>>>
10698        for TriggerMarketIocOwnedView {
10699            fn as_ref(&self) -> &::buffa::OwnedView<TriggerMarketIocView<'static>> {
10700                &self.0
10701            }
10702        }
10703        impl ::buffa::HasMessageView for super::super::TriggerMarketIoc {
10704            type View<'a> = TriggerMarketIocView<'a>;
10705            type ViewHandle = TriggerMarketIocOwnedView;
10706        }
10707        impl ::serde::Serialize for TriggerMarketIocOwnedView {
10708            fn serialize<__S: ::serde::Serializer>(
10709                &self,
10710                __s: __S,
10711            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10712                ::serde::Serialize::serialize(&self.0, __s)
10713            }
10714        }
10715        /// TriggerLimitGtc configures a resting limit child.
10716        #[derive(Clone, Debug, Default)]
10717        pub struct TriggerLimitGtcView<'a> {
10718            /// Limit price in quote units scaled by 1e6.
10719            ///
10720            /// Field 1: `price_ticks`
10721            pub price_ticks: i64,
10722            /// Reject instead of taking liquidity.
10723            ///
10724            /// Field 2: `post_only`
10725            pub post_only: bool,
10726            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10727        }
10728        impl<'a> ::buffa::MessageView<'a> for TriggerLimitGtcView<'a> {
10729            type Owned = super::super::TriggerLimitGtc;
10730            fn decode_view(
10731                buf: &'a [u8],
10732            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10733                let __limit = ::core::cell::Cell::new(
10734                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10735                );
10736                <Self as ::buffa::MessageView>::decode_view_ctx(
10737                    buf,
10738                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10739                )
10740            }
10741            fn decode_view_with_ctx(
10742                buf: &'a [u8],
10743                ctx: ::buffa::DecodeContext<'_>,
10744            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10745                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10746            }
10747            fn merge_view_field(
10748                &mut self,
10749                tag: ::buffa::encoding::Tag,
10750                cur: &'a [u8],
10751                before_tag: &'a [u8],
10752                ctx: ::buffa::DecodeContext<'_>,
10753            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10754                let _ = ctx;
10755                #[allow(unused_variables)]
10756                let view = self;
10757                let mut cur = cur;
10758                match tag.field_number() {
10759                    1u32 => {
10760                        ::buffa::encoding::check_wire_type(
10761                            tag,
10762                            ::buffa::encoding::WireType::Varint,
10763                        )?;
10764                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
10765                    }
10766                    2u32 => {
10767                        ::buffa::encoding::check_wire_type(
10768                            tag,
10769                            ::buffa::encoding::WireType::Varint,
10770                        )?;
10771                        view.post_only = ::buffa::types::decode_bool(&mut cur)?;
10772                    }
10773                    _ => {
10774                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10775                        let span_len = before_tag.len() - cur.len();
10776                        view.__buffa_unknown_fields
10777                            .push_record(before_tag, span_len, ctx)?;
10778                    }
10779                }
10780                ::core::result::Result::Ok(cur)
10781            }
10782            fn to_owned_message(
10783                &self,
10784            ) -> ::core::result::Result<
10785                super::super::TriggerLimitGtc,
10786                ::buffa::DecodeError,
10787            > {
10788                self.to_owned_from_source(None)
10789            }
10790            #[allow(clippy::useless_conversion, clippy::needless_update)]
10791            fn to_owned_from_source(
10792                &self,
10793                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10794            ) -> ::core::result::Result<
10795                super::super::TriggerLimitGtc,
10796                ::buffa::DecodeError,
10797            > {
10798                #[allow(unused_imports)]
10799                use ::buffa::alloc::string::ToString as _;
10800                let _ = __buffa_src;
10801                ::core::result::Result::Ok(super::super::TriggerLimitGtc {
10802                    price_ticks: self.price_ticks,
10803                    post_only: self.post_only,
10804                    __buffa_unknown_fields: self
10805                        .__buffa_unknown_fields
10806                        .to_owned()?
10807                        .into(),
10808                    ..::core::default::Default::default()
10809                })
10810            }
10811        }
10812        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitGtcView<'a> {
10813            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10814            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
10815                #[allow(unused_imports)]
10816                use ::buffa::Enumeration as _;
10817                let mut size = 0u32;
10818                if self.price_ticks != 0i64 {
10819                    size
10820                        += 1u32
10821                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
10822                }
10823                if self.post_only {
10824                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10825                }
10826                size += self.__buffa_unknown_fields.encoded_len() as u32;
10827                size
10828            }
10829            #[allow(clippy::needless_borrow)]
10830            fn write_to(
10831                &self,
10832                _cache: &mut ::buffa::SizeCache,
10833                buf: &mut impl ::buffa::bytes::BufMut,
10834            ) {
10835                #[allow(unused_imports)]
10836                use ::buffa::Enumeration as _;
10837                if self.price_ticks != 0i64 {
10838                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
10839                }
10840                if self.post_only {
10841                    ::buffa::types::put_bool_field(2u32, self.post_only, buf);
10842                }
10843                self.__buffa_unknown_fields.write_to(buf);
10844            }
10845        }
10846        /// Serializes this view as protobuf JSON.
10847        ///
10848        /// Implicit-presence fields with default values are omitted, `required`
10849        /// fields are always emitted, explicit-presence (`optional`) fields are
10850        /// emitted only when set, bytes fields are base64-encoded, and enum
10851        /// values are their proto name strings.
10852        ///
10853        /// This impl uses `serialize_map(None)` because the number of emitted
10854        /// fields depends on default-omission rules; serializers that require
10855        /// known map lengths (e.g. `bincode`) will return a runtime error.
10856        /// Use the owned message type for those formats.
10857        impl<'__a> ::serde::Serialize for TriggerLimitGtcView<'__a> {
10858            fn serialize<__S: ::serde::Serializer>(
10859                &self,
10860                __s: __S,
10861            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10862                use ::serde::ser::SerializeMap as _;
10863                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10864                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
10865                    __map
10866                        .serialize_entry(
10867                            "priceTicks",
10868                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
10869                        )?;
10870                }
10871                if self.post_only {
10872                    __map.serialize_entry("postOnly", &self.post_only)?;
10873                }
10874                __map.end()
10875            }
10876        }
10877        impl<'a> ::buffa::MessageName for TriggerLimitGtcView<'a> {
10878            const PACKAGE: &'static str = "triggers.v1";
10879            const NAME: &'static str = "TriggerLimitGtc";
10880            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitGtc";
10881            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitGtc";
10882        }
10883        ::buffa::impl_default_view_instance!(TriggerLimitGtcView);
10884        ::buffa::impl_view_reborrow!(TriggerLimitGtcView);
10885        /** Self-contained, `'static` owned view of a `TriggerLimitGtc` message.
10886
10887 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.
10888
10889 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.*/
10890        #[derive(Clone, Debug)]
10891        pub struct TriggerLimitGtcOwnedView(
10892            ::buffa::OwnedView<TriggerLimitGtcView<'static>>,
10893        );
10894        impl TriggerLimitGtcOwnedView {
10895            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10896            ///
10897            /// The view borrows directly from the buffer's data; the buffer is
10898            /// retained inside the returned handle.
10899            ///
10900            /// # Errors
10901            ///
10902            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10903            /// protobuf data.
10904            pub fn decode(
10905                bytes: ::buffa::bytes::Bytes,
10906            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10907                ::core::result::Result::Ok(
10908                    TriggerLimitGtcOwnedView(::buffa::OwnedView::decode(bytes)?),
10909                )
10910            }
10911            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10912            /// max message size).
10913            ///
10914            /// # Errors
10915            ///
10916            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10917            /// exceeds the configured limits.
10918            pub fn decode_with_options(
10919                bytes: ::buffa::bytes::Bytes,
10920                opts: &::buffa::DecodeOptions,
10921            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10922                ::core::result::Result::Ok(
10923                    TriggerLimitGtcOwnedView(
10924                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10925                    ),
10926                )
10927            }
10928            /// Build from an owned message via an encode → decode round-trip.
10929            ///
10930            /// # Errors
10931            ///
10932            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10933            /// somehow invalid (should not happen for well-formed messages).
10934            pub fn from_owned(
10935                msg: &super::super::TriggerLimitGtc,
10936            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10937                ::core::result::Result::Ok(
10938                    TriggerLimitGtcOwnedView(::buffa::OwnedView::from_owned(msg)?),
10939                )
10940            }
10941            /// Borrow the full [`TriggerLimitGtcView`] with its lifetime tied to `&self`.
10942            #[must_use]
10943            pub fn view(&self) -> &TriggerLimitGtcView<'_> {
10944                self.0.reborrow()
10945            }
10946            /// Convert to the owned message type.
10947            ///
10948            /// # Errors
10949            ///
10950            /// Returns an error if re-materializing preserved unknown fields
10951            /// fails (e.g. the unknown-field limit is exceeded).
10952            pub fn to_owned_message(
10953                &self,
10954            ) -> ::core::result::Result<
10955                super::super::TriggerLimitGtc,
10956                ::buffa::DecodeError,
10957            > {
10958                self.0.to_owned_message()
10959            }
10960            /// The underlying bytes buffer.
10961            #[must_use]
10962            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10963                self.0.bytes()
10964            }
10965            /// Consume the handle, returning the underlying bytes buffer.
10966            #[must_use]
10967            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10968                self.0.into_bytes()
10969            }
10970            /// Limit price in quote units scaled by 1e6.
10971            ///
10972            /// Field 1: `price_ticks`
10973            #[must_use]
10974            pub fn price_ticks(&self) -> i64 {
10975                self.0.reborrow().price_ticks
10976            }
10977            /// Reject instead of taking liquidity.
10978            ///
10979            /// Field 2: `post_only`
10980            #[must_use]
10981            pub fn post_only(&self) -> bool {
10982                self.0.reborrow().post_only
10983            }
10984        }
10985        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitGtcView<'static>>>
10986        for TriggerLimitGtcOwnedView {
10987            fn from(inner: ::buffa::OwnedView<TriggerLimitGtcView<'static>>) -> Self {
10988                TriggerLimitGtcOwnedView(inner)
10989            }
10990        }
10991        impl ::core::convert::From<TriggerLimitGtcOwnedView>
10992        for ::buffa::OwnedView<TriggerLimitGtcView<'static>> {
10993            fn from(wrapper: TriggerLimitGtcOwnedView) -> Self {
10994                wrapper.0
10995            }
10996        }
10997        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitGtcView<'static>>>
10998        for TriggerLimitGtcOwnedView {
10999            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitGtcView<'static>> {
11000                &self.0
11001            }
11002        }
11003        impl ::buffa::HasMessageView for super::super::TriggerLimitGtc {
11004            type View<'a> = TriggerLimitGtcView<'a>;
11005            type ViewHandle = TriggerLimitGtcOwnedView;
11006        }
11007        impl ::serde::Serialize for TriggerLimitGtcOwnedView {
11008            fn serialize<__S: ::serde::Serializer>(
11009                &self,
11010                __s: __S,
11011            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11012                ::serde::Serialize::serialize(&self.0, __s)
11013            }
11014        }
11015        /// TriggerLimitIoc configures an immediate-or-cancel limit child.
11016        #[derive(Clone, Debug, Default)]
11017        pub struct TriggerLimitIocView<'a> {
11018            /// Limit price in quote units scaled by 1e6.
11019            ///
11020            /// Field 1: `price_ticks`
11021            pub price_ticks: i64,
11022            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11023        }
11024        impl<'a> ::buffa::MessageView<'a> for TriggerLimitIocView<'a> {
11025            type Owned = super::super::TriggerLimitIoc;
11026            fn decode_view(
11027                buf: &'a [u8],
11028            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11029                let __limit = ::core::cell::Cell::new(
11030                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11031                );
11032                <Self as ::buffa::MessageView>::decode_view_ctx(
11033                    buf,
11034                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11035                )
11036            }
11037            fn decode_view_with_ctx(
11038                buf: &'a [u8],
11039                ctx: ::buffa::DecodeContext<'_>,
11040            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11041                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11042            }
11043            fn merge_view_field(
11044                &mut self,
11045                tag: ::buffa::encoding::Tag,
11046                cur: &'a [u8],
11047                before_tag: &'a [u8],
11048                ctx: ::buffa::DecodeContext<'_>,
11049            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11050                let _ = ctx;
11051                #[allow(unused_variables)]
11052                let view = self;
11053                let mut cur = cur;
11054                match tag.field_number() {
11055                    1u32 => {
11056                        ::buffa::encoding::check_wire_type(
11057                            tag,
11058                            ::buffa::encoding::WireType::Varint,
11059                        )?;
11060                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
11061                    }
11062                    _ => {
11063                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11064                        let span_len = before_tag.len() - cur.len();
11065                        view.__buffa_unknown_fields
11066                            .push_record(before_tag, span_len, ctx)?;
11067                    }
11068                }
11069                ::core::result::Result::Ok(cur)
11070            }
11071            fn to_owned_message(
11072                &self,
11073            ) -> ::core::result::Result<
11074                super::super::TriggerLimitIoc,
11075                ::buffa::DecodeError,
11076            > {
11077                self.to_owned_from_source(None)
11078            }
11079            #[allow(clippy::useless_conversion, clippy::needless_update)]
11080            fn to_owned_from_source(
11081                &self,
11082                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11083            ) -> ::core::result::Result<
11084                super::super::TriggerLimitIoc,
11085                ::buffa::DecodeError,
11086            > {
11087                #[allow(unused_imports)]
11088                use ::buffa::alloc::string::ToString as _;
11089                let _ = __buffa_src;
11090                ::core::result::Result::Ok(super::super::TriggerLimitIoc {
11091                    price_ticks: self.price_ticks,
11092                    __buffa_unknown_fields: self
11093                        .__buffa_unknown_fields
11094                        .to_owned()?
11095                        .into(),
11096                    ..::core::default::Default::default()
11097                })
11098            }
11099        }
11100        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitIocView<'a> {
11101            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11102            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11103                #[allow(unused_imports)]
11104                use ::buffa::Enumeration as _;
11105                let mut size = 0u32;
11106                if self.price_ticks != 0i64 {
11107                    size
11108                        += 1u32
11109                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
11110                }
11111                size += self.__buffa_unknown_fields.encoded_len() as u32;
11112                size
11113            }
11114            #[allow(clippy::needless_borrow)]
11115            fn write_to(
11116                &self,
11117                _cache: &mut ::buffa::SizeCache,
11118                buf: &mut impl ::buffa::bytes::BufMut,
11119            ) {
11120                #[allow(unused_imports)]
11121                use ::buffa::Enumeration as _;
11122                if self.price_ticks != 0i64 {
11123                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
11124                }
11125                self.__buffa_unknown_fields.write_to(buf);
11126            }
11127        }
11128        /// Serializes this view as protobuf JSON.
11129        ///
11130        /// Implicit-presence fields with default values are omitted, `required`
11131        /// fields are always emitted, explicit-presence (`optional`) fields are
11132        /// emitted only when set, bytes fields are base64-encoded, and enum
11133        /// values are their proto name strings.
11134        ///
11135        /// This impl uses `serialize_map(None)` because the number of emitted
11136        /// fields depends on default-omission rules; serializers that require
11137        /// known map lengths (e.g. `bincode`) will return a runtime error.
11138        /// Use the owned message type for those formats.
11139        impl<'__a> ::serde::Serialize for TriggerLimitIocView<'__a> {
11140            fn serialize<__S: ::serde::Serializer>(
11141                &self,
11142                __s: __S,
11143            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11144                use ::serde::ser::SerializeMap as _;
11145                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11146                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
11147                    __map
11148                        .serialize_entry(
11149                            "priceTicks",
11150                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
11151                        )?;
11152                }
11153                __map.end()
11154            }
11155        }
11156        impl<'a> ::buffa::MessageName for TriggerLimitIocView<'a> {
11157            const PACKAGE: &'static str = "triggers.v1";
11158            const NAME: &'static str = "TriggerLimitIoc";
11159            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitIoc";
11160            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitIoc";
11161        }
11162        ::buffa::impl_default_view_instance!(TriggerLimitIocView);
11163        ::buffa::impl_view_reborrow!(TriggerLimitIocView);
11164        /** Self-contained, `'static` owned view of a `TriggerLimitIoc` message.
11165
11166 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.
11167
11168 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.*/
11169        #[derive(Clone, Debug)]
11170        pub struct TriggerLimitIocOwnedView(
11171            ::buffa::OwnedView<TriggerLimitIocView<'static>>,
11172        );
11173        impl TriggerLimitIocOwnedView {
11174            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11175            ///
11176            /// The view borrows directly from the buffer's data; the buffer is
11177            /// retained inside the returned handle.
11178            ///
11179            /// # Errors
11180            ///
11181            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11182            /// protobuf data.
11183            pub fn decode(
11184                bytes: ::buffa::bytes::Bytes,
11185            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11186                ::core::result::Result::Ok(
11187                    TriggerLimitIocOwnedView(::buffa::OwnedView::decode(bytes)?),
11188                )
11189            }
11190            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11191            /// max message size).
11192            ///
11193            /// # Errors
11194            ///
11195            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11196            /// exceeds the configured limits.
11197            pub fn decode_with_options(
11198                bytes: ::buffa::bytes::Bytes,
11199                opts: &::buffa::DecodeOptions,
11200            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11201                ::core::result::Result::Ok(
11202                    TriggerLimitIocOwnedView(
11203                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11204                    ),
11205                )
11206            }
11207            /// Build from an owned message via an encode → decode round-trip.
11208            ///
11209            /// # Errors
11210            ///
11211            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11212            /// somehow invalid (should not happen for well-formed messages).
11213            pub fn from_owned(
11214                msg: &super::super::TriggerLimitIoc,
11215            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11216                ::core::result::Result::Ok(
11217                    TriggerLimitIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
11218                )
11219            }
11220            /// Borrow the full [`TriggerLimitIocView`] with its lifetime tied to `&self`.
11221            #[must_use]
11222            pub fn view(&self) -> &TriggerLimitIocView<'_> {
11223                self.0.reborrow()
11224            }
11225            /// Convert to the owned message type.
11226            ///
11227            /// # Errors
11228            ///
11229            /// Returns an error if re-materializing preserved unknown fields
11230            /// fails (e.g. the unknown-field limit is exceeded).
11231            pub fn to_owned_message(
11232                &self,
11233            ) -> ::core::result::Result<
11234                super::super::TriggerLimitIoc,
11235                ::buffa::DecodeError,
11236            > {
11237                self.0.to_owned_message()
11238            }
11239            /// The underlying bytes buffer.
11240            #[must_use]
11241            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11242                self.0.bytes()
11243            }
11244            /// Consume the handle, returning the underlying bytes buffer.
11245            #[must_use]
11246            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11247                self.0.into_bytes()
11248            }
11249            /// Limit price in quote units scaled by 1e6.
11250            ///
11251            /// Field 1: `price_ticks`
11252            #[must_use]
11253            pub fn price_ticks(&self) -> i64 {
11254                self.0.reborrow().price_ticks
11255            }
11256        }
11257        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitIocView<'static>>>
11258        for TriggerLimitIocOwnedView {
11259            fn from(inner: ::buffa::OwnedView<TriggerLimitIocView<'static>>) -> Self {
11260                TriggerLimitIocOwnedView(inner)
11261            }
11262        }
11263        impl ::core::convert::From<TriggerLimitIocOwnedView>
11264        for ::buffa::OwnedView<TriggerLimitIocView<'static>> {
11265            fn from(wrapper: TriggerLimitIocOwnedView) -> Self {
11266                wrapper.0
11267            }
11268        }
11269        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitIocView<'static>>>
11270        for TriggerLimitIocOwnedView {
11271            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitIocView<'static>> {
11272                &self.0
11273            }
11274        }
11275        impl ::buffa::HasMessageView for super::super::TriggerLimitIoc {
11276            type View<'a> = TriggerLimitIocView<'a>;
11277            type ViewHandle = TriggerLimitIocOwnedView;
11278        }
11279        impl ::serde::Serialize for TriggerLimitIocOwnedView {
11280            fn serialize<__S: ::serde::Serializer>(
11281                &self,
11282                __s: __S,
11283            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11284                ::serde::Serialize::serialize(&self.0, __s)
11285            }
11286        }
11287        /// TriggerLimitFok configures a fill-or-kill limit child.
11288        #[derive(Clone, Debug, Default)]
11289        pub struct TriggerLimitFokView<'a> {
11290            /// Limit price in quote units scaled by 1e6.
11291            ///
11292            /// Field 1: `price_ticks`
11293            pub price_ticks: i64,
11294            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11295        }
11296        impl<'a> ::buffa::MessageView<'a> for TriggerLimitFokView<'a> {
11297            type Owned = super::super::TriggerLimitFok;
11298            fn decode_view(
11299                buf: &'a [u8],
11300            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11301                let __limit = ::core::cell::Cell::new(
11302                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11303                );
11304                <Self as ::buffa::MessageView>::decode_view_ctx(
11305                    buf,
11306                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11307                )
11308            }
11309            fn decode_view_with_ctx(
11310                buf: &'a [u8],
11311                ctx: ::buffa::DecodeContext<'_>,
11312            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11313                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11314            }
11315            fn merge_view_field(
11316                &mut self,
11317                tag: ::buffa::encoding::Tag,
11318                cur: &'a [u8],
11319                before_tag: &'a [u8],
11320                ctx: ::buffa::DecodeContext<'_>,
11321            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11322                let _ = ctx;
11323                #[allow(unused_variables)]
11324                let view = self;
11325                let mut cur = cur;
11326                match tag.field_number() {
11327                    1u32 => {
11328                        ::buffa::encoding::check_wire_type(
11329                            tag,
11330                            ::buffa::encoding::WireType::Varint,
11331                        )?;
11332                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
11333                    }
11334                    _ => {
11335                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11336                        let span_len = before_tag.len() - cur.len();
11337                        view.__buffa_unknown_fields
11338                            .push_record(before_tag, span_len, ctx)?;
11339                    }
11340                }
11341                ::core::result::Result::Ok(cur)
11342            }
11343            fn to_owned_message(
11344                &self,
11345            ) -> ::core::result::Result<
11346                super::super::TriggerLimitFok,
11347                ::buffa::DecodeError,
11348            > {
11349                self.to_owned_from_source(None)
11350            }
11351            #[allow(clippy::useless_conversion, clippy::needless_update)]
11352            fn to_owned_from_source(
11353                &self,
11354                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11355            ) -> ::core::result::Result<
11356                super::super::TriggerLimitFok,
11357                ::buffa::DecodeError,
11358            > {
11359                #[allow(unused_imports)]
11360                use ::buffa::alloc::string::ToString as _;
11361                let _ = __buffa_src;
11362                ::core::result::Result::Ok(super::super::TriggerLimitFok {
11363                    price_ticks: self.price_ticks,
11364                    __buffa_unknown_fields: self
11365                        .__buffa_unknown_fields
11366                        .to_owned()?
11367                        .into(),
11368                    ..::core::default::Default::default()
11369                })
11370            }
11371        }
11372        impl<'a> ::buffa::ViewEncode<'a> for TriggerLimitFokView<'a> {
11373            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11374            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11375                #[allow(unused_imports)]
11376                use ::buffa::Enumeration as _;
11377                let mut size = 0u32;
11378                if self.price_ticks != 0i64 {
11379                    size
11380                        += 1u32
11381                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
11382                }
11383                size += self.__buffa_unknown_fields.encoded_len() as u32;
11384                size
11385            }
11386            #[allow(clippy::needless_borrow)]
11387            fn write_to(
11388                &self,
11389                _cache: &mut ::buffa::SizeCache,
11390                buf: &mut impl ::buffa::bytes::BufMut,
11391            ) {
11392                #[allow(unused_imports)]
11393                use ::buffa::Enumeration as _;
11394                if self.price_ticks != 0i64 {
11395                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
11396                }
11397                self.__buffa_unknown_fields.write_to(buf);
11398            }
11399        }
11400        /// Serializes this view as protobuf JSON.
11401        ///
11402        /// Implicit-presence fields with default values are omitted, `required`
11403        /// fields are always emitted, explicit-presence (`optional`) fields are
11404        /// emitted only when set, bytes fields are base64-encoded, and enum
11405        /// values are their proto name strings.
11406        ///
11407        /// This impl uses `serialize_map(None)` because the number of emitted
11408        /// fields depends on default-omission rules; serializers that require
11409        /// known map lengths (e.g. `bincode`) will return a runtime error.
11410        /// Use the owned message type for those formats.
11411        impl<'__a> ::serde::Serialize for TriggerLimitFokView<'__a> {
11412            fn serialize<__S: ::serde::Serializer>(
11413                &self,
11414                __s: __S,
11415            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11416                use ::serde::ser::SerializeMap as _;
11417                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11418                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
11419                    __map
11420                        .serialize_entry(
11421                            "priceTicks",
11422                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
11423                        )?;
11424                }
11425                __map.end()
11426            }
11427        }
11428        impl<'a> ::buffa::MessageName for TriggerLimitFokView<'a> {
11429            const PACKAGE: &'static str = "triggers.v1";
11430            const NAME: &'static str = "TriggerLimitFok";
11431            const FULL_NAME: &'static str = "triggers.v1.TriggerLimitFok";
11432            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerLimitFok";
11433        }
11434        ::buffa::impl_default_view_instance!(TriggerLimitFokView);
11435        ::buffa::impl_view_reborrow!(TriggerLimitFokView);
11436        /** Self-contained, `'static` owned view of a `TriggerLimitFok` message.
11437
11438 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.
11439
11440 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.*/
11441        #[derive(Clone, Debug)]
11442        pub struct TriggerLimitFokOwnedView(
11443            ::buffa::OwnedView<TriggerLimitFokView<'static>>,
11444        );
11445        impl TriggerLimitFokOwnedView {
11446            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11447            ///
11448            /// The view borrows directly from the buffer's data; the buffer is
11449            /// retained inside the returned handle.
11450            ///
11451            /// # Errors
11452            ///
11453            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11454            /// protobuf data.
11455            pub fn decode(
11456                bytes: ::buffa::bytes::Bytes,
11457            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11458                ::core::result::Result::Ok(
11459                    TriggerLimitFokOwnedView(::buffa::OwnedView::decode(bytes)?),
11460                )
11461            }
11462            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11463            /// max message size).
11464            ///
11465            /// # Errors
11466            ///
11467            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11468            /// exceeds the configured limits.
11469            pub fn decode_with_options(
11470                bytes: ::buffa::bytes::Bytes,
11471                opts: &::buffa::DecodeOptions,
11472            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11473                ::core::result::Result::Ok(
11474                    TriggerLimitFokOwnedView(
11475                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11476                    ),
11477                )
11478            }
11479            /// Build from an owned message via an encode → decode round-trip.
11480            ///
11481            /// # Errors
11482            ///
11483            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11484            /// somehow invalid (should not happen for well-formed messages).
11485            pub fn from_owned(
11486                msg: &super::super::TriggerLimitFok,
11487            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11488                ::core::result::Result::Ok(
11489                    TriggerLimitFokOwnedView(::buffa::OwnedView::from_owned(msg)?),
11490                )
11491            }
11492            /// Borrow the full [`TriggerLimitFokView`] with its lifetime tied to `&self`.
11493            #[must_use]
11494            pub fn view(&self) -> &TriggerLimitFokView<'_> {
11495                self.0.reborrow()
11496            }
11497            /// Convert to the owned message type.
11498            ///
11499            /// # Errors
11500            ///
11501            /// Returns an error if re-materializing preserved unknown fields
11502            /// fails (e.g. the unknown-field limit is exceeded).
11503            pub fn to_owned_message(
11504                &self,
11505            ) -> ::core::result::Result<
11506                super::super::TriggerLimitFok,
11507                ::buffa::DecodeError,
11508            > {
11509                self.0.to_owned_message()
11510            }
11511            /// The underlying bytes buffer.
11512            #[must_use]
11513            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11514                self.0.bytes()
11515            }
11516            /// Consume the handle, returning the underlying bytes buffer.
11517            #[must_use]
11518            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11519                self.0.into_bytes()
11520            }
11521            /// Limit price in quote units scaled by 1e6.
11522            ///
11523            /// Field 1: `price_ticks`
11524            #[must_use]
11525            pub fn price_ticks(&self) -> i64 {
11526                self.0.reborrow().price_ticks
11527            }
11528        }
11529        impl ::core::convert::From<::buffa::OwnedView<TriggerLimitFokView<'static>>>
11530        for TriggerLimitFokOwnedView {
11531            fn from(inner: ::buffa::OwnedView<TriggerLimitFokView<'static>>) -> Self {
11532                TriggerLimitFokOwnedView(inner)
11533            }
11534        }
11535        impl ::core::convert::From<TriggerLimitFokOwnedView>
11536        for ::buffa::OwnedView<TriggerLimitFokView<'static>> {
11537            fn from(wrapper: TriggerLimitFokOwnedView) -> Self {
11538                wrapper.0
11539            }
11540        }
11541        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerLimitFokView<'static>>>
11542        for TriggerLimitFokOwnedView {
11543            fn as_ref(&self) -> &::buffa::OwnedView<TriggerLimitFokView<'static>> {
11544                &self.0
11545            }
11546        }
11547        impl ::buffa::HasMessageView for super::super::TriggerLimitFok {
11548            type View<'a> = TriggerLimitFokView<'a>;
11549            type ViewHandle = TriggerLimitFokOwnedView;
11550        }
11551        impl ::serde::Serialize for TriggerLimitFokOwnedView {
11552            fn serialize<__S: ::serde::Serializer>(
11553                &self,
11554                __s: __S,
11555            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11556                ::serde::Serialize::serialize(&self.0, __s)
11557            }
11558        }
11559        /// ConditionalChildExecution selects the child submitted by a stop-loss or
11560        /// take-profit trigger. BUY market children are not supported in spot.
11561        #[derive(Clone, Debug, Default)]
11562        pub struct ConditionalChildExecutionView<'a> {
11563            pub execution: ::core::option::Option<
11564                super::super::__buffa::view::oneof::conditional_child_execution::Execution<
11565                    'a,
11566                >,
11567            >,
11568            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11569        }
11570        impl<'a> ::buffa::MessageView<'a> for ConditionalChildExecutionView<'a> {
11571            type Owned = super::super::ConditionalChildExecution;
11572            fn decode_view(
11573                buf: &'a [u8],
11574            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11575                let __limit = ::core::cell::Cell::new(
11576                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11577                );
11578                <Self as ::buffa::MessageView>::decode_view_ctx(
11579                    buf,
11580                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11581                )
11582            }
11583            fn decode_view_with_ctx(
11584                buf: &'a [u8],
11585                ctx: ::buffa::DecodeContext<'_>,
11586            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11587                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11588            }
11589            fn merge_view_field(
11590                &mut self,
11591                tag: ::buffa::encoding::Tag,
11592                cur: &'a [u8],
11593                before_tag: &'a [u8],
11594                ctx: ::buffa::DecodeContext<'_>,
11595            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11596                let _ = ctx;
11597                #[allow(unused_variables)]
11598                let view = self;
11599                let mut cur = cur;
11600                match tag.field_number() {
11601                    1u32 => {
11602                        ::buffa::encoding::check_wire_type(
11603                            tag,
11604                            ::buffa::encoding::WireType::LengthDelimited,
11605                        )?;
11606                        let __sub_ctx = ctx.descend()?;
11607                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11608                        if let Some(
11609                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11610                                ref mut existing,
11611                            ),
11612                        ) = view.execution
11613                        {
11614                            ::buffa::MessageView::merge_into_view(
11615                                &mut **existing,
11616                                sub,
11617                                __sub_ctx,
11618                            )?;
11619                        } else {
11620                            view.execution = Some(
11621                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11622                                    ::buffa::alloc::boxed::Box::new(
11623                                        <super::super::__buffa::view::TriggerMarketIocView as ::buffa::MessageView>::decode_view_ctx(
11624                                            sub,
11625                                            __sub_ctx,
11626                                        )?,
11627                                    ),
11628                                ),
11629                            );
11630                        }
11631                    }
11632                    2u32 => {
11633                        ::buffa::encoding::check_wire_type(
11634                            tag,
11635                            ::buffa::encoding::WireType::LengthDelimited,
11636                        )?;
11637                        let __sub_ctx = ctx.descend()?;
11638                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11639                        if let Some(
11640                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11641                                ref mut existing,
11642                            ),
11643                        ) = view.execution
11644                        {
11645                            ::buffa::MessageView::merge_into_view(
11646                                &mut **existing,
11647                                sub,
11648                                __sub_ctx,
11649                            )?;
11650                        } else {
11651                            view.execution = Some(
11652                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11653                                    ::buffa::alloc::boxed::Box::new(
11654                                        <super::super::__buffa::view::TriggerLimitGtcView as ::buffa::MessageView>::decode_view_ctx(
11655                                            sub,
11656                                            __sub_ctx,
11657                                        )?,
11658                                    ),
11659                                ),
11660                            );
11661                        }
11662                    }
11663                    3u32 => {
11664                        ::buffa::encoding::check_wire_type(
11665                            tag,
11666                            ::buffa::encoding::WireType::LengthDelimited,
11667                        )?;
11668                        let __sub_ctx = ctx.descend()?;
11669                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11670                        if let Some(
11671                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11672                                ref mut existing,
11673                            ),
11674                        ) = view.execution
11675                        {
11676                            ::buffa::MessageView::merge_into_view(
11677                                &mut **existing,
11678                                sub,
11679                                __sub_ctx,
11680                            )?;
11681                        } else {
11682                            view.execution = Some(
11683                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11684                                    ::buffa::alloc::boxed::Box::new(
11685                                        <super::super::__buffa::view::TriggerLimitIocView as ::buffa::MessageView>::decode_view_ctx(
11686                                            sub,
11687                                            __sub_ctx,
11688                                        )?,
11689                                    ),
11690                                ),
11691                            );
11692                        }
11693                    }
11694                    4u32 => {
11695                        ::buffa::encoding::check_wire_type(
11696                            tag,
11697                            ::buffa::encoding::WireType::LengthDelimited,
11698                        )?;
11699                        let __sub_ctx = ctx.descend()?;
11700                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11701                        if let Some(
11702                            super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11703                                ref mut existing,
11704                            ),
11705                        ) = view.execution
11706                        {
11707                            ::buffa::MessageView::merge_into_view(
11708                                &mut **existing,
11709                                sub,
11710                                __sub_ctx,
11711                            )?;
11712                        } else {
11713                            view.execution = Some(
11714                                super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11715                                    ::buffa::alloc::boxed::Box::new(
11716                                        <super::super::__buffa::view::TriggerLimitFokView as ::buffa::MessageView>::decode_view_ctx(
11717                                            sub,
11718                                            __sub_ctx,
11719                                        )?,
11720                                    ),
11721                                ),
11722                            );
11723                        }
11724                    }
11725                    _ => {
11726                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11727                        let span_len = before_tag.len() - cur.len();
11728                        view.__buffa_unknown_fields
11729                            .push_record(before_tag, span_len, ctx)?;
11730                    }
11731                }
11732                ::core::result::Result::Ok(cur)
11733            }
11734            fn to_owned_message(
11735                &self,
11736            ) -> ::core::result::Result<
11737                super::super::ConditionalChildExecution,
11738                ::buffa::DecodeError,
11739            > {
11740                self.to_owned_from_source(None)
11741            }
11742            #[allow(clippy::useless_conversion, clippy::needless_update)]
11743            fn to_owned_from_source(
11744                &self,
11745                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11746            ) -> ::core::result::Result<
11747                super::super::ConditionalChildExecution,
11748                ::buffa::DecodeError,
11749            > {
11750                #[allow(unused_imports)]
11751                use ::buffa::alloc::string::ToString as _;
11752                let _ = __buffa_src;
11753                ::core::result::Result::Ok(super::super::ConditionalChildExecution {
11754                    execution: match self.execution.as_ref() {
11755                        ::core::option::Option::Some(v) => {
11756                            ::core::option::Option::Some(
11757                                match v {
11758                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11759                                        v,
11760                                    ) => {
11761                                        super::super::__buffa::oneof::conditional_child_execution::Execution::MarketIoc(
11762                                            ::buffa::alloc::boxed::Box::new(
11763                                                v.to_owned_from_source(__buffa_src)?,
11764                                            ),
11765                                        )
11766                                    }
11767                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11768                                        v,
11769                                    ) => {
11770                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitGtc(
11771                                            ::buffa::alloc::boxed::Box::new(
11772                                                v.to_owned_from_source(__buffa_src)?,
11773                                            ),
11774                                        )
11775                                    }
11776                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11777                                        v,
11778                                    ) => {
11779                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitIoc(
11780                                            ::buffa::alloc::boxed::Box::new(
11781                                                v.to_owned_from_source(__buffa_src)?,
11782                                            ),
11783                                        )
11784                                    }
11785                                    super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11786                                        v,
11787                                    ) => {
11788                                        super::super::__buffa::oneof::conditional_child_execution::Execution::LimitFok(
11789                                            ::buffa::alloc::boxed::Box::new(
11790                                                v.to_owned_from_source(__buffa_src)?,
11791                                            ),
11792                                        )
11793                                    }
11794                                },
11795                            )
11796                        }
11797                        ::core::option::Option::None => ::core::option::Option::None,
11798                    },
11799                    __buffa_unknown_fields: self
11800                        .__buffa_unknown_fields
11801                        .to_owned()?
11802                        .into(),
11803                    ..::core::default::Default::default()
11804                })
11805            }
11806        }
11807        impl<'a> ::buffa::ViewEncode<'a> for ConditionalChildExecutionView<'a> {
11808            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11809            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11810                #[allow(unused_imports)]
11811                use ::buffa::Enumeration as _;
11812                let mut size = 0u32;
11813                if let ::core::option::Option::Some(ref v) = self.execution {
11814                    match v {
11815                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11816                            x,
11817                        ) => {
11818                            let __slot = __cache.reserve();
11819                            let inner = x.compute_size(__cache);
11820                            __cache.set(__slot, inner);
11821                            size
11822                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11823                                    + inner;
11824                        }
11825                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11826                            x,
11827                        ) => {
11828                            let __slot = __cache.reserve();
11829                            let inner = x.compute_size(__cache);
11830                            __cache.set(__slot, inner);
11831                            size
11832                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11833                                    + inner;
11834                        }
11835                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11836                            x,
11837                        ) => {
11838                            let __slot = __cache.reserve();
11839                            let inner = x.compute_size(__cache);
11840                            __cache.set(__slot, inner);
11841                            size
11842                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11843                                    + inner;
11844                        }
11845                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11846                            x,
11847                        ) => {
11848                            let __slot = __cache.reserve();
11849                            let inner = x.compute_size(__cache);
11850                            __cache.set(__slot, inner);
11851                            size
11852                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
11853                                    + inner;
11854                        }
11855                    }
11856                }
11857                size += self.__buffa_unknown_fields.encoded_len() as u32;
11858                size
11859            }
11860            #[allow(clippy::needless_borrow)]
11861            fn write_to(
11862                &self,
11863                __cache: &mut ::buffa::SizeCache,
11864                buf: &mut impl ::buffa::bytes::BufMut,
11865            ) {
11866                #[allow(unused_imports)]
11867                use ::buffa::Enumeration as _;
11868                if let ::core::option::Option::Some(ref v) = self.execution {
11869                    match v {
11870                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11871                            x,
11872                        ) => {
11873                            ::buffa::types::put_len_delimited_header(
11874                                1u32,
11875                                __cache.consume_next(),
11876                                buf,
11877                            );
11878                            x.write_to(__cache, buf);
11879                        }
11880                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11881                            x,
11882                        ) => {
11883                            ::buffa::types::put_len_delimited_header(
11884                                2u32,
11885                                __cache.consume_next(),
11886                                buf,
11887                            );
11888                            x.write_to(__cache, buf);
11889                        }
11890                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11891                            x,
11892                        ) => {
11893                            ::buffa::types::put_len_delimited_header(
11894                                3u32,
11895                                __cache.consume_next(),
11896                                buf,
11897                            );
11898                            x.write_to(__cache, buf);
11899                        }
11900                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11901                            x,
11902                        ) => {
11903                            ::buffa::types::put_len_delimited_header(
11904                                4u32,
11905                                __cache.consume_next(),
11906                                buf,
11907                            );
11908                            x.write_to(__cache, buf);
11909                        }
11910                    }
11911                }
11912                self.__buffa_unknown_fields.write_to(buf);
11913            }
11914        }
11915        /// Serializes this view as protobuf JSON.
11916        ///
11917        /// Implicit-presence fields with default values are omitted, `required`
11918        /// fields are always emitted, explicit-presence (`optional`) fields are
11919        /// emitted only when set, bytes fields are base64-encoded, and enum
11920        /// values are their proto name strings.
11921        ///
11922        /// This impl uses `serialize_map(None)` because the number of emitted
11923        /// fields depends on default-omission rules; serializers that require
11924        /// known map lengths (e.g. `bincode`) will return a runtime error.
11925        /// Use the owned message type for those formats.
11926        impl<'__a> ::serde::Serialize for ConditionalChildExecutionView<'__a> {
11927            fn serialize<__S: ::serde::Serializer>(
11928                &self,
11929                __s: __S,
11930            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11931                use ::serde::ser::SerializeMap as _;
11932                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11933                if let ::core::option::Option::Some(ref __ov) = self.execution {
11934                    match __ov {
11935                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::MarketIoc(
11936                            v,
11937                        ) => {
11938                            __map.serialize_entry("marketIoc", v)?;
11939                        }
11940                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitGtc(
11941                            v,
11942                        ) => {
11943                            __map.serialize_entry("limitGtc", v)?;
11944                        }
11945                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitIoc(
11946                            v,
11947                        ) => {
11948                            __map.serialize_entry("limitIoc", v)?;
11949                        }
11950                        super::super::__buffa::view::oneof::conditional_child_execution::Execution::LimitFok(
11951                            v,
11952                        ) => {
11953                            __map.serialize_entry("limitFok", v)?;
11954                        }
11955                    }
11956                }
11957                __map.end()
11958            }
11959        }
11960        impl<'a> ::buffa::MessageName for ConditionalChildExecutionView<'a> {
11961            const PACKAGE: &'static str = "triggers.v1";
11962            const NAME: &'static str = "ConditionalChildExecution";
11963            const FULL_NAME: &'static str = "triggers.v1.ConditionalChildExecution";
11964            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalChildExecution";
11965        }
11966        ::buffa::impl_default_view_instance!(ConditionalChildExecutionView);
11967        ::buffa::impl_view_reborrow!(ConditionalChildExecutionView);
11968        /** Self-contained, `'static` owned view of a `ConditionalChildExecution` message.
11969
11970 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.
11971
11972 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.*/
11973        #[derive(Clone, Debug)]
11974        pub struct ConditionalChildExecutionOwnedView(
11975            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
11976        );
11977        impl ConditionalChildExecutionOwnedView {
11978            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11979            ///
11980            /// The view borrows directly from the buffer's data; the buffer is
11981            /// retained inside the returned handle.
11982            ///
11983            /// # Errors
11984            ///
11985            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11986            /// protobuf data.
11987            pub fn decode(
11988                bytes: ::buffa::bytes::Bytes,
11989            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11990                ::core::result::Result::Ok(
11991                    ConditionalChildExecutionOwnedView(
11992                        ::buffa::OwnedView::decode(bytes)?,
11993                    ),
11994                )
11995            }
11996            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11997            /// max message size).
11998            ///
11999            /// # Errors
12000            ///
12001            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12002            /// exceeds the configured limits.
12003            pub fn decode_with_options(
12004                bytes: ::buffa::bytes::Bytes,
12005                opts: &::buffa::DecodeOptions,
12006            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12007                ::core::result::Result::Ok(
12008                    ConditionalChildExecutionOwnedView(
12009                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12010                    ),
12011                )
12012            }
12013            /// Build from an owned message via an encode → decode round-trip.
12014            ///
12015            /// # Errors
12016            ///
12017            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12018            /// somehow invalid (should not happen for well-formed messages).
12019            pub fn from_owned(
12020                msg: &super::super::ConditionalChildExecution,
12021            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12022                ::core::result::Result::Ok(
12023                    ConditionalChildExecutionOwnedView(
12024                        ::buffa::OwnedView::from_owned(msg)?,
12025                    ),
12026                )
12027            }
12028            /// Borrow the full [`ConditionalChildExecutionView`] with its lifetime tied to `&self`.
12029            #[must_use]
12030            pub fn view(&self) -> &ConditionalChildExecutionView<'_> {
12031                self.0.reborrow()
12032            }
12033            /// Convert to the owned message type.
12034            ///
12035            /// # Errors
12036            ///
12037            /// Returns an error if re-materializing preserved unknown fields
12038            /// fails (e.g. the unknown-field limit is exceeded).
12039            pub fn to_owned_message(
12040                &self,
12041            ) -> ::core::result::Result<
12042                super::super::ConditionalChildExecution,
12043                ::buffa::DecodeError,
12044            > {
12045                self.0.to_owned_message()
12046            }
12047            /// The underlying bytes buffer.
12048            #[must_use]
12049            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12050                self.0.bytes()
12051            }
12052            /// Consume the handle, returning the underlying bytes buffer.
12053            #[must_use]
12054            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12055                self.0.into_bytes()
12056            }
12057            /// Oneof `execution`.
12058            #[must_use]
12059            pub fn execution(
12060                &self,
12061            ) -> ::core::option::Option<
12062                &super::super::__buffa::view::oneof::conditional_child_execution::Execution<
12063                    '_,
12064                >,
12065            > {
12066                self.0.reborrow().execution.as_ref()
12067            }
12068        }
12069        impl ::core::convert::From<
12070            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12071        > for ConditionalChildExecutionOwnedView {
12072            fn from(
12073                inner: ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12074            ) -> Self {
12075                ConditionalChildExecutionOwnedView(inner)
12076            }
12077        }
12078        impl ::core::convert::From<ConditionalChildExecutionOwnedView>
12079        for ::buffa::OwnedView<ConditionalChildExecutionView<'static>> {
12080            fn from(wrapper: ConditionalChildExecutionOwnedView) -> Self {
12081                wrapper.0
12082            }
12083        }
12084        impl ::core::convert::AsRef<
12085            ::buffa::OwnedView<ConditionalChildExecutionView<'static>>,
12086        > for ConditionalChildExecutionOwnedView {
12087            fn as_ref(
12088                &self,
12089            ) -> &::buffa::OwnedView<ConditionalChildExecutionView<'static>> {
12090                &self.0
12091            }
12092        }
12093        impl ::buffa::HasMessageView for super::super::ConditionalChildExecution {
12094            type View<'a> = ConditionalChildExecutionView<'a>;
12095            type ViewHandle = ConditionalChildExecutionOwnedView;
12096        }
12097        impl ::serde::Serialize for ConditionalChildExecutionOwnedView {
12098            fn serialize<__S: ::serde::Serializer>(
12099                &self,
12100                __s: __S,
12101            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12102                ::serde::Serialize::serialize(&self.0, __s)
12103            }
12104        }
12105        /// ConditionalTrigger configures a standalone stop-loss or take-profit.
12106        #[derive(Clone, Debug, Default)]
12107        pub struct ConditionalTriggerView<'a> {
12108            /// Trigger threshold in quote units scaled by 1e6.
12109            ///
12110            /// Field 1: `trigger_price_ticks`
12111            pub trigger_price_ticks: i64,
12112            /// Child order side.
12113            ///
12114            /// Field 2: `side`
12115            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
12116            /// Child execution.
12117            ///
12118            /// Field 3: `child`
12119            pub child: ::buffa::MessageFieldView<
12120                super::super::__buffa::view::ConditionalChildExecutionView<'a>,
12121            >,
12122            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12123        }
12124        impl<'a> ::buffa::MessageView<'a> for ConditionalTriggerView<'a> {
12125            type Owned = super::super::ConditionalTrigger;
12126            fn decode_view(
12127                buf: &'a [u8],
12128            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12129                let __limit = ::core::cell::Cell::new(
12130                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12131                );
12132                <Self as ::buffa::MessageView>::decode_view_ctx(
12133                    buf,
12134                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12135                )
12136            }
12137            fn decode_view_with_ctx(
12138                buf: &'a [u8],
12139                ctx: ::buffa::DecodeContext<'_>,
12140            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12141                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12142            }
12143            fn merge_view_field(
12144                &mut self,
12145                tag: ::buffa::encoding::Tag,
12146                cur: &'a [u8],
12147                before_tag: &'a [u8],
12148                ctx: ::buffa::DecodeContext<'_>,
12149            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12150                let _ = ctx;
12151                #[allow(unused_variables)]
12152                let view = self;
12153                let mut cur = cur;
12154                match tag.field_number() {
12155                    1u32 => {
12156                        ::buffa::encoding::check_wire_type(
12157                            tag,
12158                            ::buffa::encoding::WireType::Varint,
12159                        )?;
12160                        view.trigger_price_ticks = ::buffa::types::decode_int64(
12161                            &mut cur,
12162                        )?;
12163                    }
12164                    2u32 => {
12165                        ::buffa::encoding::check_wire_type(
12166                            tag,
12167                            ::buffa::encoding::WireType::Varint,
12168                        )?;
12169                        view.side = ::buffa::EnumValue::from(
12170                            ::buffa::types::decode_int32(&mut cur)?,
12171                        );
12172                    }
12173                    3u32 => {
12174                        ::buffa::encoding::check_wire_type(
12175                            tag,
12176                            ::buffa::encoding::WireType::LengthDelimited,
12177                        )?;
12178                        let __sub_ctx = ctx.descend()?;
12179                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12180                        match view.child.as_mut() {
12181                            Some(existing) => {
12182                                ::buffa::MessageView::merge_into_view(
12183                                    existing,
12184                                    sub,
12185                                    __sub_ctx,
12186                                )?
12187                            }
12188                            None => {
12189                                view.child = ::buffa::MessageFieldView::set(
12190                                    <super::super::__buffa::view::ConditionalChildExecutionView as ::buffa::MessageView>::decode_view_ctx(
12191                                        sub,
12192                                        __sub_ctx,
12193                                    )?,
12194                                );
12195                            }
12196                        }
12197                    }
12198                    _ => {
12199                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12200                        let span_len = before_tag.len() - cur.len();
12201                        view.__buffa_unknown_fields
12202                            .push_record(before_tag, span_len, ctx)?;
12203                    }
12204                }
12205                ::core::result::Result::Ok(cur)
12206            }
12207            fn to_owned_message(
12208                &self,
12209            ) -> ::core::result::Result<
12210                super::super::ConditionalTrigger,
12211                ::buffa::DecodeError,
12212            > {
12213                self.to_owned_from_source(None)
12214            }
12215            #[allow(clippy::useless_conversion, clippy::needless_update)]
12216            fn to_owned_from_source(
12217                &self,
12218                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12219            ) -> ::core::result::Result<
12220                super::super::ConditionalTrigger,
12221                ::buffa::DecodeError,
12222            > {
12223                #[allow(unused_imports)]
12224                use ::buffa::alloc::string::ToString as _;
12225                let _ = __buffa_src;
12226                ::core::result::Result::Ok(super::super::ConditionalTrigger {
12227                    trigger_price_ticks: self.trigger_price_ticks,
12228                    side: self.side,
12229                    child: match self.child.as_option() {
12230                        Some(v) => {
12231                            ::buffa::MessageField::<
12232                                super::super::ConditionalChildExecution,
12233                            >::some(v.to_owned_from_source(__buffa_src)?)
12234                        }
12235                        None => ::buffa::MessageField::none(),
12236                    },
12237                    __buffa_unknown_fields: self
12238                        .__buffa_unknown_fields
12239                        .to_owned()?
12240                        .into(),
12241                    ..::core::default::Default::default()
12242                })
12243            }
12244        }
12245        impl<'a> ::buffa::ViewEncode<'a> for ConditionalTriggerView<'a> {
12246            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12247            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12248                #[allow(unused_imports)]
12249                use ::buffa::Enumeration as _;
12250                let mut size = 0u32;
12251                if self.trigger_price_ticks != 0i64 {
12252                    size
12253                        += 1u32
12254                            + ::buffa::types::int64_encoded_len(self.trigger_price_ticks)
12255                                as u32;
12256                }
12257                {
12258                    let val = self.side.to_i32();
12259                    if val != 0 {
12260                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12261                    }
12262                }
12263                if self.child.is_set() {
12264                    let __slot = __cache.reserve();
12265                    let inner_size = self.child.compute_size(__cache);
12266                    __cache.set(__slot, inner_size);
12267                    size
12268                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12269                            + inner_size;
12270                }
12271                size += self.__buffa_unknown_fields.encoded_len() as u32;
12272                size
12273            }
12274            #[allow(clippy::needless_borrow)]
12275            fn write_to(
12276                &self,
12277                __cache: &mut ::buffa::SizeCache,
12278                buf: &mut impl ::buffa::bytes::BufMut,
12279            ) {
12280                #[allow(unused_imports)]
12281                use ::buffa::Enumeration as _;
12282                if self.trigger_price_ticks != 0i64 {
12283                    ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
12284                }
12285                {
12286                    let val = self.side.to_i32();
12287                    if val != 0 {
12288                        ::buffa::types::put_int32_field(2u32, val, buf);
12289                    }
12290                }
12291                if self.child.is_set() {
12292                    ::buffa::types::put_len_delimited_header(
12293                        3u32,
12294                        __cache.consume_next(),
12295                        buf,
12296                    );
12297                    self.child.write_to(__cache, buf);
12298                }
12299                self.__buffa_unknown_fields.write_to(buf);
12300            }
12301        }
12302        /// Serializes this view as protobuf JSON.
12303        ///
12304        /// Implicit-presence fields with default values are omitted, `required`
12305        /// fields are always emitted, explicit-presence (`optional`) fields are
12306        /// emitted only when set, bytes fields are base64-encoded, and enum
12307        /// values are their proto name strings.
12308        ///
12309        /// This impl uses `serialize_map(None)` because the number of emitted
12310        /// fields depends on default-omission rules; serializers that require
12311        /// known map lengths (e.g. `bincode`) will return a runtime error.
12312        /// Use the owned message type for those formats.
12313        impl<'__a> ::serde::Serialize for ConditionalTriggerView<'__a> {
12314            fn serialize<__S: ::serde::Serializer>(
12315                &self,
12316                __s: __S,
12317            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12318                use ::serde::ser::SerializeMap as _;
12319                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12320                if !::buffa::json_helpers::skip_if::is_zero_i64(
12321                    &self.trigger_price_ticks,
12322                ) {
12323                    __map
12324                        .serialize_entry(
12325                            "triggerPriceTicks",
12326                            &::buffa::json_helpers::ProtoJson(&self.trigger_price_ticks),
12327                        )?;
12328                }
12329                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
12330                    __map.serialize_entry("side", &self.side)?;
12331                }
12332                {
12333                    if let ::core::option::Option::Some(__v) = self.child.as_option() {
12334                        __map.serialize_entry("child", __v)?;
12335                    }
12336                }
12337                __map.end()
12338            }
12339        }
12340        impl<'a> ::buffa::MessageName for ConditionalTriggerView<'a> {
12341            const PACKAGE: &'static str = "triggers.v1";
12342            const NAME: &'static str = "ConditionalTrigger";
12343            const FULL_NAME: &'static str = "triggers.v1.ConditionalTrigger";
12344            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ConditionalTrigger";
12345        }
12346        ::buffa::impl_default_view_instance!(ConditionalTriggerView);
12347        ::buffa::impl_view_reborrow!(ConditionalTriggerView);
12348        /** Self-contained, `'static` owned view of a `ConditionalTrigger` message.
12349
12350 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.
12351
12352 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.*/
12353        #[derive(Clone, Debug)]
12354        pub struct ConditionalTriggerOwnedView(
12355            ::buffa::OwnedView<ConditionalTriggerView<'static>>,
12356        );
12357        impl ConditionalTriggerOwnedView {
12358            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12359            ///
12360            /// The view borrows directly from the buffer's data; the buffer is
12361            /// retained inside the returned handle.
12362            ///
12363            /// # Errors
12364            ///
12365            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12366            /// protobuf data.
12367            pub fn decode(
12368                bytes: ::buffa::bytes::Bytes,
12369            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12370                ::core::result::Result::Ok(
12371                    ConditionalTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
12372                )
12373            }
12374            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12375            /// max message size).
12376            ///
12377            /// # Errors
12378            ///
12379            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12380            /// exceeds the configured limits.
12381            pub fn decode_with_options(
12382                bytes: ::buffa::bytes::Bytes,
12383                opts: &::buffa::DecodeOptions,
12384            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12385                ::core::result::Result::Ok(
12386                    ConditionalTriggerOwnedView(
12387                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12388                    ),
12389                )
12390            }
12391            /// Build from an owned message via an encode → decode round-trip.
12392            ///
12393            /// # Errors
12394            ///
12395            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12396            /// somehow invalid (should not happen for well-formed messages).
12397            pub fn from_owned(
12398                msg: &super::super::ConditionalTrigger,
12399            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12400                ::core::result::Result::Ok(
12401                    ConditionalTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
12402                )
12403            }
12404            /// Borrow the full [`ConditionalTriggerView`] with its lifetime tied to `&self`.
12405            #[must_use]
12406            pub fn view(&self) -> &ConditionalTriggerView<'_> {
12407                self.0.reborrow()
12408            }
12409            /// Convert to the owned message type.
12410            ///
12411            /// # Errors
12412            ///
12413            /// Returns an error if re-materializing preserved unknown fields
12414            /// fails (e.g. the unknown-field limit is exceeded).
12415            pub fn to_owned_message(
12416                &self,
12417            ) -> ::core::result::Result<
12418                super::super::ConditionalTrigger,
12419                ::buffa::DecodeError,
12420            > {
12421                self.0.to_owned_message()
12422            }
12423            /// The underlying bytes buffer.
12424            #[must_use]
12425            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12426                self.0.bytes()
12427            }
12428            /// Consume the handle, returning the underlying bytes buffer.
12429            #[must_use]
12430            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12431                self.0.into_bytes()
12432            }
12433            /// Trigger threshold in quote units scaled by 1e6.
12434            ///
12435            /// Field 1: `trigger_price_ticks`
12436            #[must_use]
12437            pub fn trigger_price_ticks(&self) -> i64 {
12438                self.0.reborrow().trigger_price_ticks
12439            }
12440            /// Child order side.
12441            ///
12442            /// Field 2: `side`
12443            #[must_use]
12444            pub fn side(
12445                &self,
12446            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
12447                self.0.reborrow().side
12448            }
12449            /// Child execution.
12450            ///
12451            /// Field 3: `child`
12452            #[must_use]
12453            pub fn child(
12454                &self,
12455            ) -> &::buffa::MessageFieldView<
12456                super::super::__buffa::view::ConditionalChildExecutionView<'_>,
12457            > {
12458                &self.0.reborrow().child
12459            }
12460        }
12461        impl ::core::convert::From<::buffa::OwnedView<ConditionalTriggerView<'static>>>
12462        for ConditionalTriggerOwnedView {
12463            fn from(inner: ::buffa::OwnedView<ConditionalTriggerView<'static>>) -> Self {
12464                ConditionalTriggerOwnedView(inner)
12465            }
12466        }
12467        impl ::core::convert::From<ConditionalTriggerOwnedView>
12468        for ::buffa::OwnedView<ConditionalTriggerView<'static>> {
12469            fn from(wrapper: ConditionalTriggerOwnedView) -> Self {
12470                wrapper.0
12471            }
12472        }
12473        impl ::core::convert::AsRef<::buffa::OwnedView<ConditionalTriggerView<'static>>>
12474        for ConditionalTriggerOwnedView {
12475            fn as_ref(&self) -> &::buffa::OwnedView<ConditionalTriggerView<'static>> {
12476                &self.0
12477            }
12478        }
12479        impl ::buffa::HasMessageView for super::super::ConditionalTrigger {
12480            type View<'a> = ConditionalTriggerView<'a>;
12481            type ViewHandle = ConditionalTriggerOwnedView;
12482        }
12483        impl ::serde::Serialize for ConditionalTriggerOwnedView {
12484            fn serialize<__S: ::serde::Serializer>(
12485                &self,
12486                __s: __S,
12487            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12488                ::serde::Serialize::serialize(&self.0, __s)
12489            }
12490        }
12491        /// TrailingStopTrigger configures a spot trailing-stop strategy.
12492        /// Standalone triggers currently support SELL market-IOC children. Attached
12493        /// trailing stops may use either side, opposite their parent order.
12494        #[derive(Clone, Debug, Default)]
12495        pub struct TrailingStopTriggerView<'a> {
12496            /// Optional activation price in quote units scaled by 1e6.
12497            ///
12498            /// Field 3: `activation_price_ticks`
12499            pub activation_price_ticks: i64,
12500            /// Child order side.
12501            ///
12502            /// Field 6: `side`
12503            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
12504            pub trailing_distance: ::core::option::Option<
12505                super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance,
12506            >,
12507            pub max_slippage: ::core::option::Option<
12508                super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage,
12509            >,
12510            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12511        }
12512        impl<'a> ::buffa::MessageView<'a> for TrailingStopTriggerView<'a> {
12513            type Owned = super::super::TrailingStopTrigger;
12514            fn decode_view(
12515                buf: &'a [u8],
12516            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12517                let __limit = ::core::cell::Cell::new(
12518                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12519                );
12520                <Self as ::buffa::MessageView>::decode_view_ctx(
12521                    buf,
12522                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12523                )
12524            }
12525            fn decode_view_with_ctx(
12526                buf: &'a [u8],
12527                ctx: ::buffa::DecodeContext<'_>,
12528            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12529                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12530            }
12531            fn merge_view_field(
12532                &mut self,
12533                tag: ::buffa::encoding::Tag,
12534                cur: &'a [u8],
12535                before_tag: &'a [u8],
12536                ctx: ::buffa::DecodeContext<'_>,
12537            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12538                let _ = ctx;
12539                #[allow(unused_variables)]
12540                let view = self;
12541                let mut cur = cur;
12542                match tag.field_number() {
12543                    3u32 => {
12544                        ::buffa::encoding::check_wire_type(
12545                            tag,
12546                            ::buffa::encoding::WireType::Varint,
12547                        )?;
12548                        view.activation_price_ticks = ::buffa::types::decode_int64(
12549                            &mut cur,
12550                        )?;
12551                    }
12552                    6u32 => {
12553                        ::buffa::encoding::check_wire_type(
12554                            tag,
12555                            ::buffa::encoding::WireType::Varint,
12556                        )?;
12557                        view.side = ::buffa::EnumValue::from(
12558                            ::buffa::types::decode_int32(&mut cur)?,
12559                        );
12560                    }
12561                    1u32 => {
12562                        ::buffa::encoding::check_wire_type(
12563                            tag,
12564                            ::buffa::encoding::WireType::Varint,
12565                        )?;
12566                        view.trailing_distance = Some(
12567                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12568                                ::buffa::types::decode_int64(&mut cur)?,
12569                            ),
12570                        );
12571                    }
12572                    2u32 => {
12573                        ::buffa::encoding::check_wire_type(
12574                            tag,
12575                            ::buffa::encoding::WireType::Varint,
12576                        )?;
12577                        view.trailing_distance = Some(
12578                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12579                                ::buffa::types::decode_int32(&mut cur)?,
12580                            ),
12581                        );
12582                    }
12583                    4u32 => {
12584                        ::buffa::encoding::check_wire_type(
12585                            tag,
12586                            ::buffa::encoding::WireType::Varint,
12587                        )?;
12588                        view.max_slippage = Some(
12589                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12590                                ::buffa::types::decode_int32(&mut cur)?,
12591                            ),
12592                        );
12593                    }
12594                    5u32 => {
12595                        ::buffa::encoding::check_wire_type(
12596                            tag,
12597                            ::buffa::encoding::WireType::Varint,
12598                        )?;
12599                        view.max_slippage = Some(
12600                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12601                                ::buffa::types::decode_int32(&mut cur)?,
12602                            ),
12603                        );
12604                    }
12605                    _ => {
12606                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12607                        let span_len = before_tag.len() - cur.len();
12608                        view.__buffa_unknown_fields
12609                            .push_record(before_tag, span_len, ctx)?;
12610                    }
12611                }
12612                ::core::result::Result::Ok(cur)
12613            }
12614            fn to_owned_message(
12615                &self,
12616            ) -> ::core::result::Result<
12617                super::super::TrailingStopTrigger,
12618                ::buffa::DecodeError,
12619            > {
12620                self.to_owned_from_source(None)
12621            }
12622            #[allow(clippy::useless_conversion, clippy::needless_update)]
12623            fn to_owned_from_source(
12624                &self,
12625                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12626            ) -> ::core::result::Result<
12627                super::super::TrailingStopTrigger,
12628                ::buffa::DecodeError,
12629            > {
12630                #[allow(unused_imports)]
12631                use ::buffa::alloc::string::ToString as _;
12632                let _ = __buffa_src;
12633                ::core::result::Result::Ok(super::super::TrailingStopTrigger {
12634                    activation_price_ticks: self.activation_price_ticks,
12635                    side: self.side,
12636                    trailing_distance: self
12637                        .trailing_distance
12638                        .as_ref()
12639                        .map(|v| match v {
12640                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12641                                v,
12642                            ) => {
12643                                super::super::__buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12644                                    *v,
12645                                )
12646                            }
12647                            super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12648                                v,
12649                            ) => {
12650                                super::super::__buffa::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12651                                    *v,
12652                                )
12653                            }
12654                        }),
12655                    max_slippage: self
12656                        .max_slippage
12657                        .as_ref()
12658                        .map(|v| match v {
12659                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12660                                v,
12661                            ) => {
12662                                super::super::__buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12663                                    *v,
12664                                )
12665                            }
12666                            super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12667                                v,
12668                            ) => {
12669                                super::super::__buffa::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12670                                    *v,
12671                                )
12672                            }
12673                        }),
12674                    __buffa_unknown_fields: self
12675                        .__buffa_unknown_fields
12676                        .to_owned()?
12677                        .into(),
12678                    ..::core::default::Default::default()
12679                })
12680            }
12681        }
12682        impl<'a> ::buffa::ViewEncode<'a> for TrailingStopTriggerView<'a> {
12683            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12684            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
12685                #[allow(unused_imports)]
12686                use ::buffa::Enumeration as _;
12687                let mut size = 0u32;
12688                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
12689                    match v {
12690                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12691                            v,
12692                        ) => {
12693                            size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
12694                        }
12695                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12696                            v,
12697                        ) => {
12698                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12699                        }
12700                    }
12701                }
12702                if self.activation_price_ticks != 0i64 {
12703                    size
12704                        += 1u32
12705                            + ::buffa::types::int64_encoded_len(
12706                                self.activation_price_ticks,
12707                            ) as u32;
12708                }
12709                if let ::core::option::Option::Some(ref v) = self.max_slippage {
12710                    match v {
12711                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12712                            v,
12713                        ) => {
12714                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12715                        }
12716                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12717                            v,
12718                        ) => {
12719                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
12720                        }
12721                    }
12722                }
12723                {
12724                    let val = self.side.to_i32();
12725                    if val != 0 {
12726                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12727                    }
12728                }
12729                size += self.__buffa_unknown_fields.encoded_len() as u32;
12730                size
12731            }
12732            #[allow(clippy::needless_borrow)]
12733            fn write_to(
12734                &self,
12735                _cache: &mut ::buffa::SizeCache,
12736                buf: &mut impl ::buffa::bytes::BufMut,
12737            ) {
12738                #[allow(unused_imports)]
12739                use ::buffa::Enumeration as _;
12740                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
12741                    match v {
12742                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12743                            x,
12744                        ) => {
12745                            ::buffa::types::put_int64_field(1u32, *x, buf);
12746                        }
12747                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12748                            x,
12749                        ) => {
12750                            ::buffa::types::put_int32_field(2u32, *x, buf);
12751                        }
12752                    }
12753                }
12754                if self.activation_price_ticks != 0i64 {
12755                    ::buffa::types::put_int64_field(
12756                        3u32,
12757                        self.activation_price_ticks,
12758                        buf,
12759                    );
12760                }
12761                if let ::core::option::Option::Some(ref v) = self.max_slippage {
12762                    match v {
12763                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12764                            x,
12765                        ) => {
12766                            ::buffa::types::put_int32_field(4u32, *x, buf);
12767                        }
12768                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12769                            x,
12770                        ) => {
12771                            ::buffa::types::put_int32_field(5u32, *x, buf);
12772                        }
12773                    }
12774                }
12775                {
12776                    let val = self.side.to_i32();
12777                    if val != 0 {
12778                        ::buffa::types::put_int32_field(6u32, val, buf);
12779                    }
12780                }
12781                self.__buffa_unknown_fields.write_to(buf);
12782            }
12783        }
12784        /// Serializes this view as protobuf JSON.
12785        ///
12786        /// Implicit-presence fields with default values are omitted, `required`
12787        /// fields are always emitted, explicit-presence (`optional`) fields are
12788        /// emitted only when set, bytes fields are base64-encoded, and enum
12789        /// values are their proto name strings.
12790        ///
12791        /// This impl uses `serialize_map(None)` because the number of emitted
12792        /// fields depends on default-omission rules; serializers that require
12793        /// known map lengths (e.g. `bincode`) will return a runtime error.
12794        /// Use the owned message type for those formats.
12795        impl<'__a> ::serde::Serialize for TrailingStopTriggerView<'__a> {
12796            fn serialize<__S: ::serde::Serializer>(
12797                &self,
12798                __s: __S,
12799            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12800                use ::serde::ser::SerializeMap as _;
12801                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12802                if !::buffa::json_helpers::skip_if::is_zero_i64(
12803                    &self.activation_price_ticks,
12804                ) {
12805                    __map
12806                        .serialize_entry(
12807                            "activationPriceTicks",
12808                            &::buffa::json_helpers::ProtoJson(
12809                                &self.activation_price_ticks,
12810                            ),
12811                        )?;
12812                }
12813                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
12814                    __map.serialize_entry("side", &self.side)?;
12815                }
12816                if let ::core::option::Option::Some(ref __ov) = self.trailing_distance {
12817                    match __ov {
12818                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceTicks(
12819                            v,
12820                        ) => {
12821                            __map
12822                                .serialize_entry(
12823                                    "trailingDistanceTicks",
12824                                    &::buffa::json_helpers::ProtoJson(v),
12825                                )?;
12826                        }
12827                        super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance::TrailingDistanceBps(
12828                            v,
12829                        ) => {
12830                            __map
12831                                .serialize_entry(
12832                                    "trailingDistanceBps",
12833                                    &::buffa::json_helpers::ProtoJson(v),
12834                                )?;
12835                        }
12836                    }
12837                }
12838                if let ::core::option::Option::Some(ref __ov) = self.max_slippage {
12839                    match __ov {
12840                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageTicks(
12841                            v,
12842                        ) => {
12843                            __map
12844                                .serialize_entry(
12845                                    "maxSlippageTicks",
12846                                    &::buffa::json_helpers::ProtoJson(v),
12847                                )?;
12848                        }
12849                        super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage::MaxSlippageBps(
12850                            v,
12851                        ) => {
12852                            __map
12853                                .serialize_entry(
12854                                    "maxSlippageBps",
12855                                    &::buffa::json_helpers::ProtoJson(v),
12856                                )?;
12857                        }
12858                    }
12859                }
12860                __map.end()
12861            }
12862        }
12863        impl<'a> ::buffa::MessageName for TrailingStopTriggerView<'a> {
12864            const PACKAGE: &'static str = "triggers.v1";
12865            const NAME: &'static str = "TrailingStopTrigger";
12866            const FULL_NAME: &'static str = "triggers.v1.TrailingStopTrigger";
12867            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingStopTrigger";
12868        }
12869        ::buffa::impl_default_view_instance!(TrailingStopTriggerView);
12870        ::buffa::impl_view_reborrow!(TrailingStopTriggerView);
12871        /** Self-contained, `'static` owned view of a `TrailingStopTrigger` message.
12872
12873 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.
12874
12875 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.*/
12876        #[derive(Clone, Debug)]
12877        pub struct TrailingStopTriggerOwnedView(
12878            ::buffa::OwnedView<TrailingStopTriggerView<'static>>,
12879        );
12880        impl TrailingStopTriggerOwnedView {
12881            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12882            ///
12883            /// The view borrows directly from the buffer's data; the buffer is
12884            /// retained inside the returned handle.
12885            ///
12886            /// # Errors
12887            ///
12888            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12889            /// protobuf data.
12890            pub fn decode(
12891                bytes: ::buffa::bytes::Bytes,
12892            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12893                ::core::result::Result::Ok(
12894                    TrailingStopTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
12895                )
12896            }
12897            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12898            /// max message size).
12899            ///
12900            /// # Errors
12901            ///
12902            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12903            /// exceeds the configured limits.
12904            pub fn decode_with_options(
12905                bytes: ::buffa::bytes::Bytes,
12906                opts: &::buffa::DecodeOptions,
12907            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12908                ::core::result::Result::Ok(
12909                    TrailingStopTriggerOwnedView(
12910                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12911                    ),
12912                )
12913            }
12914            /// Build from an owned message via an encode → decode round-trip.
12915            ///
12916            /// # Errors
12917            ///
12918            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12919            /// somehow invalid (should not happen for well-formed messages).
12920            pub fn from_owned(
12921                msg: &super::super::TrailingStopTrigger,
12922            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12923                ::core::result::Result::Ok(
12924                    TrailingStopTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
12925                )
12926            }
12927            /// Borrow the full [`TrailingStopTriggerView`] with its lifetime tied to `&self`.
12928            #[must_use]
12929            pub fn view(&self) -> &TrailingStopTriggerView<'_> {
12930                self.0.reborrow()
12931            }
12932            /// Convert to the owned message type.
12933            ///
12934            /// # Errors
12935            ///
12936            /// Returns an error if re-materializing preserved unknown fields
12937            /// fails (e.g. the unknown-field limit is exceeded).
12938            pub fn to_owned_message(
12939                &self,
12940            ) -> ::core::result::Result<
12941                super::super::TrailingStopTrigger,
12942                ::buffa::DecodeError,
12943            > {
12944                self.0.to_owned_message()
12945            }
12946            /// The underlying bytes buffer.
12947            #[must_use]
12948            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12949                self.0.bytes()
12950            }
12951            /// Consume the handle, returning the underlying bytes buffer.
12952            #[must_use]
12953            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12954                self.0.into_bytes()
12955            }
12956            /// Optional activation price in quote units scaled by 1e6.
12957            ///
12958            /// Field 3: `activation_price_ticks`
12959            #[must_use]
12960            pub fn activation_price_ticks(&self) -> i64 {
12961                self.0.reborrow().activation_price_ticks
12962            }
12963            /// Child order side.
12964            ///
12965            /// Field 6: `side`
12966            #[must_use]
12967            pub fn side(
12968                &self,
12969            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
12970                self.0.reborrow().side
12971            }
12972            /// Oneof `trailing_distance`.
12973            #[must_use]
12974            pub fn trailing_distance(
12975                &self,
12976            ) -> ::core::option::Option<
12977                &super::super::__buffa::view::oneof::trailing_stop_trigger::TrailingDistance,
12978            > {
12979                self.0.reborrow().trailing_distance.as_ref()
12980            }
12981            /// Oneof `max_slippage`.
12982            #[must_use]
12983            pub fn max_slippage(
12984                &self,
12985            ) -> ::core::option::Option<
12986                &super::super::__buffa::view::oneof::trailing_stop_trigger::MaxSlippage,
12987            > {
12988                self.0.reborrow().max_slippage.as_ref()
12989            }
12990        }
12991        impl ::core::convert::From<::buffa::OwnedView<TrailingStopTriggerView<'static>>>
12992        for TrailingStopTriggerOwnedView {
12993            fn from(
12994                inner: ::buffa::OwnedView<TrailingStopTriggerView<'static>>,
12995            ) -> Self {
12996                TrailingStopTriggerOwnedView(inner)
12997            }
12998        }
12999        impl ::core::convert::From<TrailingStopTriggerOwnedView>
13000        for ::buffa::OwnedView<TrailingStopTriggerView<'static>> {
13001            fn from(wrapper: TrailingStopTriggerOwnedView) -> Self {
13002                wrapper.0
13003            }
13004        }
13005        impl ::core::convert::AsRef<::buffa::OwnedView<TrailingStopTriggerView<'static>>>
13006        for TrailingStopTriggerOwnedView {
13007            fn as_ref(&self) -> &::buffa::OwnedView<TrailingStopTriggerView<'static>> {
13008                &self.0
13009            }
13010        }
13011        impl ::buffa::HasMessageView for super::super::TrailingStopTrigger {
13012            type View<'a> = TrailingStopTriggerView<'a>;
13013            type ViewHandle = TrailingStopTriggerOwnedView;
13014        }
13015        impl ::serde::Serialize for TrailingStopTriggerOwnedView {
13016            fn serialize<__S: ::serde::Serializer>(
13017                &self,
13018                __s: __S,
13019            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13020                ::serde::Serialize::serialize(&self.0, __s)
13021            }
13022        }
13023        /// TwapMarketIoc configures server-priced market-IOC slices.
13024        #[derive(Clone, Debug, Default)]
13025        pub struct TwapMarketIocView<'a> {
13026            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13027        }
13028        impl<'a> ::buffa::MessageView<'a> for TwapMarketIocView<'a> {
13029            type Owned = super::super::TwapMarketIoc;
13030            fn decode_view(
13031                buf: &'a [u8],
13032            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13033                let __limit = ::core::cell::Cell::new(
13034                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13035                );
13036                <Self as ::buffa::MessageView>::decode_view_ctx(
13037                    buf,
13038                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13039                )
13040            }
13041            fn decode_view_with_ctx(
13042                buf: &'a [u8],
13043                ctx: ::buffa::DecodeContext<'_>,
13044            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13045                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13046            }
13047            fn merge_view_field(
13048                &mut self,
13049                tag: ::buffa::encoding::Tag,
13050                cur: &'a [u8],
13051                before_tag: &'a [u8],
13052                ctx: ::buffa::DecodeContext<'_>,
13053            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13054                let _ = ctx;
13055                #[allow(unused_variables)]
13056                let view = self;
13057                let mut cur = cur;
13058                match tag.field_number() {
13059                    _ => {
13060                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13061                        let span_len = before_tag.len() - cur.len();
13062                        view.__buffa_unknown_fields
13063                            .push_record(before_tag, span_len, ctx)?;
13064                    }
13065                }
13066                ::core::result::Result::Ok(cur)
13067            }
13068            fn to_owned_message(
13069                &self,
13070            ) -> ::core::result::Result<
13071                super::super::TwapMarketIoc,
13072                ::buffa::DecodeError,
13073            > {
13074                self.to_owned_from_source(None)
13075            }
13076            #[allow(clippy::useless_conversion, clippy::needless_update)]
13077            fn to_owned_from_source(
13078                &self,
13079                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13080            ) -> ::core::result::Result<
13081                super::super::TwapMarketIoc,
13082                ::buffa::DecodeError,
13083            > {
13084                #[allow(unused_imports)]
13085                use ::buffa::alloc::string::ToString as _;
13086                let _ = __buffa_src;
13087                ::core::result::Result::Ok(super::super::TwapMarketIoc {
13088                    __buffa_unknown_fields: self
13089                        .__buffa_unknown_fields
13090                        .to_owned()?
13091                        .into(),
13092                    ..::core::default::Default::default()
13093                })
13094            }
13095        }
13096        impl<'a> ::buffa::ViewEncode<'a> for TwapMarketIocView<'a> {
13097            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13098            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13099                #[allow(unused_imports)]
13100                use ::buffa::Enumeration as _;
13101                let mut size = 0u32;
13102                size += self.__buffa_unknown_fields.encoded_len() as u32;
13103                size
13104            }
13105            #[allow(clippy::needless_borrow)]
13106            fn write_to(
13107                &self,
13108                _cache: &mut ::buffa::SizeCache,
13109                buf: &mut impl ::buffa::bytes::BufMut,
13110            ) {
13111                #[allow(unused_imports)]
13112                use ::buffa::Enumeration as _;
13113                self.__buffa_unknown_fields.write_to(buf);
13114            }
13115        }
13116        /// Serializes this view as protobuf JSON.
13117        ///
13118        /// Implicit-presence fields with default values are omitted, `required`
13119        /// fields are always emitted, explicit-presence (`optional`) fields are
13120        /// emitted only when set, bytes fields are base64-encoded, and enum
13121        /// values are their proto name strings.
13122        ///
13123        /// This impl uses `serialize_map(None)` because the number of emitted
13124        /// fields depends on default-omission rules; serializers that require
13125        /// known map lengths (e.g. `bincode`) will return a runtime error.
13126        /// Use the owned message type for those formats.
13127        impl<'__a> ::serde::Serialize for TwapMarketIocView<'__a> {
13128            fn serialize<__S: ::serde::Serializer>(
13129                &self,
13130                __s: __S,
13131            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13132                use ::serde::ser::SerializeMap as _;
13133                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13134                __map.end()
13135            }
13136        }
13137        impl<'a> ::buffa::MessageName for TwapMarketIocView<'a> {
13138            const PACKAGE: &'static str = "triggers.v1";
13139            const NAME: &'static str = "TwapMarketIoc";
13140            const FULL_NAME: &'static str = "triggers.v1.TwapMarketIoc";
13141            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapMarketIoc";
13142        }
13143        ::buffa::impl_default_view_instance!(TwapMarketIocView);
13144        ::buffa::impl_view_reborrow!(TwapMarketIocView);
13145        /** Self-contained, `'static` owned view of a `TwapMarketIoc` message.
13146
13147 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.
13148
13149 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.*/
13150        #[derive(Clone, Debug)]
13151        pub struct TwapMarketIocOwnedView(
13152            ::buffa::OwnedView<TwapMarketIocView<'static>>,
13153        );
13154        impl TwapMarketIocOwnedView {
13155            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13156            ///
13157            /// The view borrows directly from the buffer's data; the buffer is
13158            /// retained inside the returned handle.
13159            ///
13160            /// # Errors
13161            ///
13162            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13163            /// protobuf data.
13164            pub fn decode(
13165                bytes: ::buffa::bytes::Bytes,
13166            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13167                ::core::result::Result::Ok(
13168                    TwapMarketIocOwnedView(::buffa::OwnedView::decode(bytes)?),
13169                )
13170            }
13171            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13172            /// max message size).
13173            ///
13174            /// # Errors
13175            ///
13176            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13177            /// exceeds the configured limits.
13178            pub fn decode_with_options(
13179                bytes: ::buffa::bytes::Bytes,
13180                opts: &::buffa::DecodeOptions,
13181            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13182                ::core::result::Result::Ok(
13183                    TwapMarketIocOwnedView(
13184                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13185                    ),
13186                )
13187            }
13188            /// Build from an owned message via an encode → decode round-trip.
13189            ///
13190            /// # Errors
13191            ///
13192            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13193            /// somehow invalid (should not happen for well-formed messages).
13194            pub fn from_owned(
13195                msg: &super::super::TwapMarketIoc,
13196            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13197                ::core::result::Result::Ok(
13198                    TwapMarketIocOwnedView(::buffa::OwnedView::from_owned(msg)?),
13199                )
13200            }
13201            /// Borrow the full [`TwapMarketIocView`] with its lifetime tied to `&self`.
13202            #[must_use]
13203            pub fn view(&self) -> &TwapMarketIocView<'_> {
13204                self.0.reborrow()
13205            }
13206            /// Convert to the owned message type.
13207            ///
13208            /// # Errors
13209            ///
13210            /// Returns an error if re-materializing preserved unknown fields
13211            /// fails (e.g. the unknown-field limit is exceeded).
13212            pub fn to_owned_message(
13213                &self,
13214            ) -> ::core::result::Result<
13215                super::super::TwapMarketIoc,
13216                ::buffa::DecodeError,
13217            > {
13218                self.0.to_owned_message()
13219            }
13220            /// The underlying bytes buffer.
13221            #[must_use]
13222            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13223                self.0.bytes()
13224            }
13225            /// Consume the handle, returning the underlying bytes buffer.
13226            #[must_use]
13227            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13228                self.0.into_bytes()
13229            }
13230        }
13231        impl ::core::convert::From<::buffa::OwnedView<TwapMarketIocView<'static>>>
13232        for TwapMarketIocOwnedView {
13233            fn from(inner: ::buffa::OwnedView<TwapMarketIocView<'static>>) -> Self {
13234                TwapMarketIocOwnedView(inner)
13235            }
13236        }
13237        impl ::core::convert::From<TwapMarketIocOwnedView>
13238        for ::buffa::OwnedView<TwapMarketIocView<'static>> {
13239            fn from(wrapper: TwapMarketIocOwnedView) -> Self {
13240                wrapper.0
13241            }
13242        }
13243        impl ::core::convert::AsRef<::buffa::OwnedView<TwapMarketIocView<'static>>>
13244        for TwapMarketIocOwnedView {
13245            fn as_ref(&self) -> &::buffa::OwnedView<TwapMarketIocView<'static>> {
13246                &self.0
13247            }
13248        }
13249        impl ::buffa::HasMessageView for super::super::TwapMarketIoc {
13250            type View<'a> = TwapMarketIocView<'a>;
13251            type ViewHandle = TwapMarketIocOwnedView;
13252        }
13253        impl ::serde::Serialize for TwapMarketIocOwnedView {
13254            fn serialize<__S: ::serde::Serializer>(
13255                &self,
13256                __s: __S,
13257            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13258                ::serde::Serialize::serialize(&self.0, __s)
13259            }
13260        }
13261        /// TwapLimitGtc configures one resting limit slice at a time. A previous open
13262        /// slice is canceled before the next interval.
13263        #[derive(Clone, Debug, Default)]
13264        pub struct TwapLimitGtcView<'a> {
13265            /// Slice limit price in quote units scaled by 1e6.
13266            ///
13267            /// Field 1: `price_ticks`
13268            pub price_ticks: i64,
13269            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13270        }
13271        impl<'a> ::buffa::MessageView<'a> for TwapLimitGtcView<'a> {
13272            type Owned = super::super::TwapLimitGtc;
13273            fn decode_view(
13274                buf: &'a [u8],
13275            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13276                let __limit = ::core::cell::Cell::new(
13277                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13278                );
13279                <Self as ::buffa::MessageView>::decode_view_ctx(
13280                    buf,
13281                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13282                )
13283            }
13284            fn decode_view_with_ctx(
13285                buf: &'a [u8],
13286                ctx: ::buffa::DecodeContext<'_>,
13287            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13288                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13289            }
13290            fn merge_view_field(
13291                &mut self,
13292                tag: ::buffa::encoding::Tag,
13293                cur: &'a [u8],
13294                before_tag: &'a [u8],
13295                ctx: ::buffa::DecodeContext<'_>,
13296            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13297                let _ = ctx;
13298                #[allow(unused_variables)]
13299                let view = self;
13300                let mut cur = cur;
13301                match tag.field_number() {
13302                    1u32 => {
13303                        ::buffa::encoding::check_wire_type(
13304                            tag,
13305                            ::buffa::encoding::WireType::Varint,
13306                        )?;
13307                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
13308                    }
13309                    _ => {
13310                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13311                        let span_len = before_tag.len() - cur.len();
13312                        view.__buffa_unknown_fields
13313                            .push_record(before_tag, span_len, ctx)?;
13314                    }
13315                }
13316                ::core::result::Result::Ok(cur)
13317            }
13318            fn to_owned_message(
13319                &self,
13320            ) -> ::core::result::Result<
13321                super::super::TwapLimitGtc,
13322                ::buffa::DecodeError,
13323            > {
13324                self.to_owned_from_source(None)
13325            }
13326            #[allow(clippy::useless_conversion, clippy::needless_update)]
13327            fn to_owned_from_source(
13328                &self,
13329                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13330            ) -> ::core::result::Result<
13331                super::super::TwapLimitGtc,
13332                ::buffa::DecodeError,
13333            > {
13334                #[allow(unused_imports)]
13335                use ::buffa::alloc::string::ToString as _;
13336                let _ = __buffa_src;
13337                ::core::result::Result::Ok(super::super::TwapLimitGtc {
13338                    price_ticks: self.price_ticks,
13339                    __buffa_unknown_fields: self
13340                        .__buffa_unknown_fields
13341                        .to_owned()?
13342                        .into(),
13343                    ..::core::default::Default::default()
13344                })
13345            }
13346        }
13347        impl<'a> ::buffa::ViewEncode<'a> for TwapLimitGtcView<'a> {
13348            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13349            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13350                #[allow(unused_imports)]
13351                use ::buffa::Enumeration as _;
13352                let mut size = 0u32;
13353                if self.price_ticks != 0i64 {
13354                    size
13355                        += 1u32
13356                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
13357                }
13358                size += self.__buffa_unknown_fields.encoded_len() as u32;
13359                size
13360            }
13361            #[allow(clippy::needless_borrow)]
13362            fn write_to(
13363                &self,
13364                _cache: &mut ::buffa::SizeCache,
13365                buf: &mut impl ::buffa::bytes::BufMut,
13366            ) {
13367                #[allow(unused_imports)]
13368                use ::buffa::Enumeration as _;
13369                if self.price_ticks != 0i64 {
13370                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
13371                }
13372                self.__buffa_unknown_fields.write_to(buf);
13373            }
13374        }
13375        /// Serializes this view as protobuf JSON.
13376        ///
13377        /// Implicit-presence fields with default values are omitted, `required`
13378        /// fields are always emitted, explicit-presence (`optional`) fields are
13379        /// emitted only when set, bytes fields are base64-encoded, and enum
13380        /// values are their proto name strings.
13381        ///
13382        /// This impl uses `serialize_map(None)` because the number of emitted
13383        /// fields depends on default-omission rules; serializers that require
13384        /// known map lengths (e.g. `bincode`) will return a runtime error.
13385        /// Use the owned message type for those formats.
13386        impl<'__a> ::serde::Serialize for TwapLimitGtcView<'__a> {
13387            fn serialize<__S: ::serde::Serializer>(
13388                &self,
13389                __s: __S,
13390            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13391                use ::serde::ser::SerializeMap as _;
13392                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13393                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
13394                    __map
13395                        .serialize_entry(
13396                            "priceTicks",
13397                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
13398                        )?;
13399                }
13400                __map.end()
13401            }
13402        }
13403        impl<'a> ::buffa::MessageName for TwapLimitGtcView<'a> {
13404            const PACKAGE: &'static str = "triggers.v1";
13405            const NAME: &'static str = "TwapLimitGtc";
13406            const FULL_NAME: &'static str = "triggers.v1.TwapLimitGtc";
13407            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapLimitGtc";
13408        }
13409        ::buffa::impl_default_view_instance!(TwapLimitGtcView);
13410        ::buffa::impl_view_reborrow!(TwapLimitGtcView);
13411        /** Self-contained, `'static` owned view of a `TwapLimitGtc` message.
13412
13413 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.
13414
13415 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.*/
13416        #[derive(Clone, Debug)]
13417        pub struct TwapLimitGtcOwnedView(::buffa::OwnedView<TwapLimitGtcView<'static>>);
13418        impl TwapLimitGtcOwnedView {
13419            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13420            ///
13421            /// The view borrows directly from the buffer's data; the buffer is
13422            /// retained inside the returned handle.
13423            ///
13424            /// # Errors
13425            ///
13426            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13427            /// protobuf data.
13428            pub fn decode(
13429                bytes: ::buffa::bytes::Bytes,
13430            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13431                ::core::result::Result::Ok(
13432                    TwapLimitGtcOwnedView(::buffa::OwnedView::decode(bytes)?),
13433                )
13434            }
13435            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13436            /// max message size).
13437            ///
13438            /// # Errors
13439            ///
13440            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13441            /// exceeds the configured limits.
13442            pub fn decode_with_options(
13443                bytes: ::buffa::bytes::Bytes,
13444                opts: &::buffa::DecodeOptions,
13445            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13446                ::core::result::Result::Ok(
13447                    TwapLimitGtcOwnedView(
13448                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13449                    ),
13450                )
13451            }
13452            /// Build from an owned message via an encode → decode round-trip.
13453            ///
13454            /// # Errors
13455            ///
13456            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13457            /// somehow invalid (should not happen for well-formed messages).
13458            pub fn from_owned(
13459                msg: &super::super::TwapLimitGtc,
13460            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13461                ::core::result::Result::Ok(
13462                    TwapLimitGtcOwnedView(::buffa::OwnedView::from_owned(msg)?),
13463                )
13464            }
13465            /// Borrow the full [`TwapLimitGtcView`] with its lifetime tied to `&self`.
13466            #[must_use]
13467            pub fn view(&self) -> &TwapLimitGtcView<'_> {
13468                self.0.reborrow()
13469            }
13470            /// Convert to the owned message type.
13471            ///
13472            /// # Errors
13473            ///
13474            /// Returns an error if re-materializing preserved unknown fields
13475            /// fails (e.g. the unknown-field limit is exceeded).
13476            pub fn to_owned_message(
13477                &self,
13478            ) -> ::core::result::Result<
13479                super::super::TwapLimitGtc,
13480                ::buffa::DecodeError,
13481            > {
13482                self.0.to_owned_message()
13483            }
13484            /// The underlying bytes buffer.
13485            #[must_use]
13486            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13487                self.0.bytes()
13488            }
13489            /// Consume the handle, returning the underlying bytes buffer.
13490            #[must_use]
13491            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13492                self.0.into_bytes()
13493            }
13494            /// Slice limit price in quote units scaled by 1e6.
13495            ///
13496            /// Field 1: `price_ticks`
13497            #[must_use]
13498            pub fn price_ticks(&self) -> i64 {
13499                self.0.reborrow().price_ticks
13500            }
13501        }
13502        impl ::core::convert::From<::buffa::OwnedView<TwapLimitGtcView<'static>>>
13503        for TwapLimitGtcOwnedView {
13504            fn from(inner: ::buffa::OwnedView<TwapLimitGtcView<'static>>) -> Self {
13505                TwapLimitGtcOwnedView(inner)
13506            }
13507        }
13508        impl ::core::convert::From<TwapLimitGtcOwnedView>
13509        for ::buffa::OwnedView<TwapLimitGtcView<'static>> {
13510            fn from(wrapper: TwapLimitGtcOwnedView) -> Self {
13511                wrapper.0
13512            }
13513        }
13514        impl ::core::convert::AsRef<::buffa::OwnedView<TwapLimitGtcView<'static>>>
13515        for TwapLimitGtcOwnedView {
13516            fn as_ref(&self) -> &::buffa::OwnedView<TwapLimitGtcView<'static>> {
13517                &self.0
13518            }
13519        }
13520        impl ::buffa::HasMessageView for super::super::TwapLimitGtc {
13521            type View<'a> = TwapLimitGtcView<'a>;
13522            type ViewHandle = TwapLimitGtcOwnedView;
13523        }
13524        impl ::serde::Serialize for TwapLimitGtcOwnedView {
13525            fn serialize<__S: ::serde::Serializer>(
13526                &self,
13527                __s: __S,
13528            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13529                ::serde::Serialize::serialize(&self.0, __s)
13530            }
13531        }
13532        /// TwapTrigger configures a proven TWAP execution mode.
13533        #[derive(Clone, Debug, Default)]
13534        pub struct TwapTriggerView<'a> {
13535            /// Child side.
13536            ///
13537            /// Field 1: `side`
13538            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
13539            /// Total execution duration in milliseconds.
13540            ///
13541            /// Field 2: `duration_ms`
13542            pub duration_ms: i64,
13543            /// Interval between slices in milliseconds.
13544            ///
13545            /// Field 3: `slice_interval_ms`
13546            pub slice_interval_ms: i64,
13547            pub execution: ::core::option::Option<
13548                super::super::__buffa::view::oneof::twap_trigger::Execution<'a>,
13549            >,
13550            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13551        }
13552        impl<'a> ::buffa::MessageView<'a> for TwapTriggerView<'a> {
13553            type Owned = super::super::TwapTrigger;
13554            fn decode_view(
13555                buf: &'a [u8],
13556            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13557                let __limit = ::core::cell::Cell::new(
13558                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13559                );
13560                <Self as ::buffa::MessageView>::decode_view_ctx(
13561                    buf,
13562                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13563                )
13564            }
13565            fn decode_view_with_ctx(
13566                buf: &'a [u8],
13567                ctx: ::buffa::DecodeContext<'_>,
13568            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13569                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13570            }
13571            fn merge_view_field(
13572                &mut self,
13573                tag: ::buffa::encoding::Tag,
13574                cur: &'a [u8],
13575                before_tag: &'a [u8],
13576                ctx: ::buffa::DecodeContext<'_>,
13577            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13578                let _ = ctx;
13579                #[allow(unused_variables)]
13580                let view = self;
13581                let mut cur = cur;
13582                match tag.field_number() {
13583                    1u32 => {
13584                        ::buffa::encoding::check_wire_type(
13585                            tag,
13586                            ::buffa::encoding::WireType::Varint,
13587                        )?;
13588                        view.side = ::buffa::EnumValue::from(
13589                            ::buffa::types::decode_int32(&mut cur)?,
13590                        );
13591                    }
13592                    2u32 => {
13593                        ::buffa::encoding::check_wire_type(
13594                            tag,
13595                            ::buffa::encoding::WireType::Varint,
13596                        )?;
13597                        view.duration_ms = ::buffa::types::decode_int64(&mut cur)?;
13598                    }
13599                    3u32 => {
13600                        ::buffa::encoding::check_wire_type(
13601                            tag,
13602                            ::buffa::encoding::WireType::Varint,
13603                        )?;
13604                        view.slice_interval_ms = ::buffa::types::decode_int64(&mut cur)?;
13605                    }
13606                    4u32 => {
13607                        ::buffa::encoding::check_wire_type(
13608                            tag,
13609                            ::buffa::encoding::WireType::LengthDelimited,
13610                        )?;
13611                        let __sub_ctx = ctx.descend()?;
13612                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13613                        if let Some(
13614                            super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13615                                ref mut existing,
13616                            ),
13617                        ) = view.execution
13618                        {
13619                            ::buffa::MessageView::merge_into_view(
13620                                &mut **existing,
13621                                sub,
13622                                __sub_ctx,
13623                            )?;
13624                        } else {
13625                            view.execution = Some(
13626                                super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13627                                    ::buffa::alloc::boxed::Box::new(
13628                                        <super::super::__buffa::view::TwapMarketIocView as ::buffa::MessageView>::decode_view_ctx(
13629                                            sub,
13630                                            __sub_ctx,
13631                                        )?,
13632                                    ),
13633                                ),
13634                            );
13635                        }
13636                    }
13637                    5u32 => {
13638                        ::buffa::encoding::check_wire_type(
13639                            tag,
13640                            ::buffa::encoding::WireType::LengthDelimited,
13641                        )?;
13642                        let __sub_ctx = ctx.descend()?;
13643                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13644                        if let Some(
13645                            super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13646                                ref mut existing,
13647                            ),
13648                        ) = view.execution
13649                        {
13650                            ::buffa::MessageView::merge_into_view(
13651                                &mut **existing,
13652                                sub,
13653                                __sub_ctx,
13654                            )?;
13655                        } else {
13656                            view.execution = Some(
13657                                super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13658                                    ::buffa::alloc::boxed::Box::new(
13659                                        <super::super::__buffa::view::TwapLimitGtcView as ::buffa::MessageView>::decode_view_ctx(
13660                                            sub,
13661                                            __sub_ctx,
13662                                        )?,
13663                                    ),
13664                                ),
13665                            );
13666                        }
13667                    }
13668                    _ => {
13669                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13670                        let span_len = before_tag.len() - cur.len();
13671                        view.__buffa_unknown_fields
13672                            .push_record(before_tag, span_len, ctx)?;
13673                    }
13674                }
13675                ::core::result::Result::Ok(cur)
13676            }
13677            fn to_owned_message(
13678                &self,
13679            ) -> ::core::result::Result<
13680                super::super::TwapTrigger,
13681                ::buffa::DecodeError,
13682            > {
13683                self.to_owned_from_source(None)
13684            }
13685            #[allow(clippy::useless_conversion, clippy::needless_update)]
13686            fn to_owned_from_source(
13687                &self,
13688                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13689            ) -> ::core::result::Result<
13690                super::super::TwapTrigger,
13691                ::buffa::DecodeError,
13692            > {
13693                #[allow(unused_imports)]
13694                use ::buffa::alloc::string::ToString as _;
13695                let _ = __buffa_src;
13696                ::core::result::Result::Ok(super::super::TwapTrigger {
13697                    side: self.side,
13698                    duration_ms: self.duration_ms,
13699                    slice_interval_ms: self.slice_interval_ms,
13700                    execution: match self.execution.as_ref() {
13701                        ::core::option::Option::Some(v) => {
13702                            ::core::option::Option::Some(
13703                                match v {
13704                                    super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13705                                        v,
13706                                    ) => {
13707                                        super::super::__buffa::oneof::twap_trigger::Execution::MarketIoc(
13708                                            ::buffa::alloc::boxed::Box::new(
13709                                                v.to_owned_from_source(__buffa_src)?,
13710                                            ),
13711                                        )
13712                                    }
13713                                    super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13714                                        v,
13715                                    ) => {
13716                                        super::super::__buffa::oneof::twap_trigger::Execution::LimitGtc(
13717                                            ::buffa::alloc::boxed::Box::new(
13718                                                v.to_owned_from_source(__buffa_src)?,
13719                                            ),
13720                                        )
13721                                    }
13722                                },
13723                            )
13724                        }
13725                        ::core::option::Option::None => ::core::option::Option::None,
13726                    },
13727                    __buffa_unknown_fields: self
13728                        .__buffa_unknown_fields
13729                        .to_owned()?
13730                        .into(),
13731                    ..::core::default::Default::default()
13732                })
13733            }
13734        }
13735        impl<'a> ::buffa::ViewEncode<'a> for TwapTriggerView<'a> {
13736            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13737            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
13738                #[allow(unused_imports)]
13739                use ::buffa::Enumeration as _;
13740                let mut size = 0u32;
13741                {
13742                    let val = self.side.to_i32();
13743                    if val != 0 {
13744                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
13745                    }
13746                }
13747                if self.duration_ms != 0i64 {
13748                    size
13749                        += 1u32
13750                            + ::buffa::types::int64_encoded_len(self.duration_ms) as u32;
13751                }
13752                if self.slice_interval_ms != 0i64 {
13753                    size
13754                        += 1u32
13755                            + ::buffa::types::int64_encoded_len(self.slice_interval_ms)
13756                                as u32;
13757                }
13758                if let ::core::option::Option::Some(ref v) = self.execution {
13759                    match v {
13760                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13761                            x,
13762                        ) => {
13763                            let __slot = __cache.reserve();
13764                            let inner = x.compute_size(__cache);
13765                            __cache.set(__slot, inner);
13766                            size
13767                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
13768                                    + inner;
13769                        }
13770                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13771                            x,
13772                        ) => {
13773                            let __slot = __cache.reserve();
13774                            let inner = x.compute_size(__cache);
13775                            __cache.set(__slot, inner);
13776                            size
13777                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
13778                                    + inner;
13779                        }
13780                    }
13781                }
13782                size += self.__buffa_unknown_fields.encoded_len() as u32;
13783                size
13784            }
13785            #[allow(clippy::needless_borrow)]
13786            fn write_to(
13787                &self,
13788                __cache: &mut ::buffa::SizeCache,
13789                buf: &mut impl ::buffa::bytes::BufMut,
13790            ) {
13791                #[allow(unused_imports)]
13792                use ::buffa::Enumeration as _;
13793                {
13794                    let val = self.side.to_i32();
13795                    if val != 0 {
13796                        ::buffa::types::put_int32_field(1u32, val, buf);
13797                    }
13798                }
13799                if self.duration_ms != 0i64 {
13800                    ::buffa::types::put_int64_field(2u32, self.duration_ms, buf);
13801                }
13802                if self.slice_interval_ms != 0i64 {
13803                    ::buffa::types::put_int64_field(3u32, self.slice_interval_ms, buf);
13804                }
13805                if let ::core::option::Option::Some(ref v) = self.execution {
13806                    match v {
13807                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13808                            x,
13809                        ) => {
13810                            ::buffa::types::put_len_delimited_header(
13811                                4u32,
13812                                __cache.consume_next(),
13813                                buf,
13814                            );
13815                            x.write_to(__cache, buf);
13816                        }
13817                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13818                            x,
13819                        ) => {
13820                            ::buffa::types::put_len_delimited_header(
13821                                5u32,
13822                                __cache.consume_next(),
13823                                buf,
13824                            );
13825                            x.write_to(__cache, buf);
13826                        }
13827                    }
13828                }
13829                self.__buffa_unknown_fields.write_to(buf);
13830            }
13831        }
13832        /// Serializes this view as protobuf JSON.
13833        ///
13834        /// Implicit-presence fields with default values are omitted, `required`
13835        /// fields are always emitted, explicit-presence (`optional`) fields are
13836        /// emitted only when set, bytes fields are base64-encoded, and enum
13837        /// values are their proto name strings.
13838        ///
13839        /// This impl uses `serialize_map(None)` because the number of emitted
13840        /// fields depends on default-omission rules; serializers that require
13841        /// known map lengths (e.g. `bincode`) will return a runtime error.
13842        /// Use the owned message type for those formats.
13843        impl<'__a> ::serde::Serialize for TwapTriggerView<'__a> {
13844            fn serialize<__S: ::serde::Serializer>(
13845                &self,
13846                __s: __S,
13847            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13848                use ::serde::ser::SerializeMap as _;
13849                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13850                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
13851                    __map.serialize_entry("side", &self.side)?;
13852                }
13853                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.duration_ms) {
13854                    __map
13855                        .serialize_entry(
13856                            "durationMs",
13857                            &::buffa::json_helpers::ProtoJson(&self.duration_ms),
13858                        )?;
13859                }
13860                if !::buffa::json_helpers::skip_if::is_zero_i64(
13861                    &self.slice_interval_ms,
13862                ) {
13863                    __map
13864                        .serialize_entry(
13865                            "sliceIntervalMs",
13866                            &::buffa::json_helpers::ProtoJson(&self.slice_interval_ms),
13867                        )?;
13868                }
13869                if let ::core::option::Option::Some(ref __ov) = self.execution {
13870                    match __ov {
13871                        super::super::__buffa::view::oneof::twap_trigger::Execution::MarketIoc(
13872                            v,
13873                        ) => {
13874                            __map.serialize_entry("marketIoc", v)?;
13875                        }
13876                        super::super::__buffa::view::oneof::twap_trigger::Execution::LimitGtc(
13877                            v,
13878                        ) => {
13879                            __map.serialize_entry("limitGtc", v)?;
13880                        }
13881                    }
13882                }
13883                __map.end()
13884            }
13885        }
13886        impl<'a> ::buffa::MessageName for TwapTriggerView<'a> {
13887            const PACKAGE: &'static str = "triggers.v1";
13888            const NAME: &'static str = "TwapTrigger";
13889            const FULL_NAME: &'static str = "triggers.v1.TwapTrigger";
13890            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapTrigger";
13891        }
13892        ::buffa::impl_default_view_instance!(TwapTriggerView);
13893        ::buffa::impl_view_reborrow!(TwapTriggerView);
13894        /** Self-contained, `'static` owned view of a `TwapTrigger` message.
13895
13896 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.
13897
13898 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.*/
13899        #[derive(Clone, Debug)]
13900        pub struct TwapTriggerOwnedView(::buffa::OwnedView<TwapTriggerView<'static>>);
13901        impl TwapTriggerOwnedView {
13902            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13903            ///
13904            /// The view borrows directly from the buffer's data; the buffer is
13905            /// retained inside the returned handle.
13906            ///
13907            /// # Errors
13908            ///
13909            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13910            /// protobuf data.
13911            pub fn decode(
13912                bytes: ::buffa::bytes::Bytes,
13913            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13914                ::core::result::Result::Ok(
13915                    TwapTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
13916                )
13917            }
13918            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13919            /// max message size).
13920            ///
13921            /// # Errors
13922            ///
13923            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13924            /// exceeds the configured limits.
13925            pub fn decode_with_options(
13926                bytes: ::buffa::bytes::Bytes,
13927                opts: &::buffa::DecodeOptions,
13928            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13929                ::core::result::Result::Ok(
13930                    TwapTriggerOwnedView(
13931                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13932                    ),
13933                )
13934            }
13935            /// Build from an owned message via an encode → decode round-trip.
13936            ///
13937            /// # Errors
13938            ///
13939            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13940            /// somehow invalid (should not happen for well-formed messages).
13941            pub fn from_owned(
13942                msg: &super::super::TwapTrigger,
13943            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13944                ::core::result::Result::Ok(
13945                    TwapTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
13946                )
13947            }
13948            /// Borrow the full [`TwapTriggerView`] with its lifetime tied to `&self`.
13949            #[must_use]
13950            pub fn view(&self) -> &TwapTriggerView<'_> {
13951                self.0.reborrow()
13952            }
13953            /// Convert to the owned message type.
13954            ///
13955            /// # Errors
13956            ///
13957            /// Returns an error if re-materializing preserved unknown fields
13958            /// fails (e.g. the unknown-field limit is exceeded).
13959            pub fn to_owned_message(
13960                &self,
13961            ) -> ::core::result::Result<
13962                super::super::TwapTrigger,
13963                ::buffa::DecodeError,
13964            > {
13965                self.0.to_owned_message()
13966            }
13967            /// The underlying bytes buffer.
13968            #[must_use]
13969            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13970                self.0.bytes()
13971            }
13972            /// Consume the handle, returning the underlying bytes buffer.
13973            #[must_use]
13974            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13975                self.0.into_bytes()
13976            }
13977            /// Child side.
13978            ///
13979            /// Field 1: `side`
13980            #[must_use]
13981            pub fn side(
13982                &self,
13983            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
13984                self.0.reborrow().side
13985            }
13986            /// Total execution duration in milliseconds.
13987            ///
13988            /// Field 2: `duration_ms`
13989            #[must_use]
13990            pub fn duration_ms(&self) -> i64 {
13991                self.0.reborrow().duration_ms
13992            }
13993            /// Interval between slices in milliseconds.
13994            ///
13995            /// Field 3: `slice_interval_ms`
13996            #[must_use]
13997            pub fn slice_interval_ms(&self) -> i64 {
13998                self.0.reborrow().slice_interval_ms
13999            }
14000            /// Oneof `execution`.
14001            #[must_use]
14002            pub fn execution(
14003                &self,
14004            ) -> ::core::option::Option<
14005                &super::super::__buffa::view::oneof::twap_trigger::Execution<'_>,
14006            > {
14007                self.0.reborrow().execution.as_ref()
14008            }
14009        }
14010        impl ::core::convert::From<::buffa::OwnedView<TwapTriggerView<'static>>>
14011        for TwapTriggerOwnedView {
14012            fn from(inner: ::buffa::OwnedView<TwapTriggerView<'static>>) -> Self {
14013                TwapTriggerOwnedView(inner)
14014            }
14015        }
14016        impl ::core::convert::From<TwapTriggerOwnedView>
14017        for ::buffa::OwnedView<TwapTriggerView<'static>> {
14018            fn from(wrapper: TwapTriggerOwnedView) -> Self {
14019                wrapper.0
14020            }
14021        }
14022        impl ::core::convert::AsRef<::buffa::OwnedView<TwapTriggerView<'static>>>
14023        for TwapTriggerOwnedView {
14024            fn as_ref(&self) -> &::buffa::OwnedView<TwapTriggerView<'static>> {
14025                &self.0
14026            }
14027        }
14028        impl ::buffa::HasMessageView for super::super::TwapTrigger {
14029            type View<'a> = TwapTriggerView<'a>;
14030            type ViewHandle = TwapTriggerOwnedView;
14031        }
14032        impl ::serde::Serialize for TwapTriggerOwnedView {
14033            fn serialize<__S: ::serde::Serializer>(
14034                &self,
14035                __s: __S,
14036            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14037                ::serde::Serialize::serialize(&self.0, __s)
14038            }
14039        }
14040        /// LadderTrigger configures the supported LINEAR limit-GTC ladder. All levels
14041        /// are admitted immediately and may rest concurrently.
14042        #[derive(Clone, Debug, Default)]
14043        pub struct LadderTriggerView<'a> {
14044            /// Child side.
14045            ///
14046            /// Field 1: `side`
14047            pub side: ::buffa::EnumValue<super::super::super::super::orders::v1::Side>,
14048            /// Minimum generated level price in quote units scaled by 1e6.
14049            ///
14050            /// Field 2: `price_min_ticks`
14051            pub price_min_ticks: i64,
14052            /// Maximum generated level price in quote units scaled by 1e6.
14053            ///
14054            /// Field 3: `price_max_ticks`
14055            pub price_max_ticks: i64,
14056            /// Number of linearly distributed levels.
14057            ///
14058            /// Field 4: `levels`
14059            pub levels: i32,
14060            /// Reject each level instead of taking liquidity.
14061            ///
14062            /// Field 5: `post_only`
14063            pub post_only: bool,
14064            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14065        }
14066        impl<'a> ::buffa::MessageView<'a> for LadderTriggerView<'a> {
14067            type Owned = super::super::LadderTrigger;
14068            fn decode_view(
14069                buf: &'a [u8],
14070            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14071                let __limit = ::core::cell::Cell::new(
14072                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14073                );
14074                <Self as ::buffa::MessageView>::decode_view_ctx(
14075                    buf,
14076                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14077                )
14078            }
14079            fn decode_view_with_ctx(
14080                buf: &'a [u8],
14081                ctx: ::buffa::DecodeContext<'_>,
14082            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14083                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14084            }
14085            fn merge_view_field(
14086                &mut self,
14087                tag: ::buffa::encoding::Tag,
14088                cur: &'a [u8],
14089                before_tag: &'a [u8],
14090                ctx: ::buffa::DecodeContext<'_>,
14091            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14092                let _ = ctx;
14093                #[allow(unused_variables)]
14094                let view = self;
14095                let mut cur = cur;
14096                match tag.field_number() {
14097                    1u32 => {
14098                        ::buffa::encoding::check_wire_type(
14099                            tag,
14100                            ::buffa::encoding::WireType::Varint,
14101                        )?;
14102                        view.side = ::buffa::EnumValue::from(
14103                            ::buffa::types::decode_int32(&mut cur)?,
14104                        );
14105                    }
14106                    2u32 => {
14107                        ::buffa::encoding::check_wire_type(
14108                            tag,
14109                            ::buffa::encoding::WireType::Varint,
14110                        )?;
14111                        view.price_min_ticks = ::buffa::types::decode_int64(&mut cur)?;
14112                    }
14113                    3u32 => {
14114                        ::buffa::encoding::check_wire_type(
14115                            tag,
14116                            ::buffa::encoding::WireType::Varint,
14117                        )?;
14118                        view.price_max_ticks = ::buffa::types::decode_int64(&mut cur)?;
14119                    }
14120                    4u32 => {
14121                        ::buffa::encoding::check_wire_type(
14122                            tag,
14123                            ::buffa::encoding::WireType::Varint,
14124                        )?;
14125                        view.levels = ::buffa::types::decode_int32(&mut cur)?;
14126                    }
14127                    5u32 => {
14128                        ::buffa::encoding::check_wire_type(
14129                            tag,
14130                            ::buffa::encoding::WireType::Varint,
14131                        )?;
14132                        view.post_only = ::buffa::types::decode_bool(&mut cur)?;
14133                    }
14134                    _ => {
14135                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14136                        let span_len = before_tag.len() - cur.len();
14137                        view.__buffa_unknown_fields
14138                            .push_record(before_tag, span_len, ctx)?;
14139                    }
14140                }
14141                ::core::result::Result::Ok(cur)
14142            }
14143            fn to_owned_message(
14144                &self,
14145            ) -> ::core::result::Result<
14146                super::super::LadderTrigger,
14147                ::buffa::DecodeError,
14148            > {
14149                self.to_owned_from_source(None)
14150            }
14151            #[allow(clippy::useless_conversion, clippy::needless_update)]
14152            fn to_owned_from_source(
14153                &self,
14154                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14155            ) -> ::core::result::Result<
14156                super::super::LadderTrigger,
14157                ::buffa::DecodeError,
14158            > {
14159                #[allow(unused_imports)]
14160                use ::buffa::alloc::string::ToString as _;
14161                let _ = __buffa_src;
14162                ::core::result::Result::Ok(super::super::LadderTrigger {
14163                    side: self.side,
14164                    price_min_ticks: self.price_min_ticks,
14165                    price_max_ticks: self.price_max_ticks,
14166                    levels: self.levels,
14167                    post_only: self.post_only,
14168                    __buffa_unknown_fields: self
14169                        .__buffa_unknown_fields
14170                        .to_owned()?
14171                        .into(),
14172                    ..::core::default::Default::default()
14173                })
14174            }
14175        }
14176        impl<'a> ::buffa::ViewEncode<'a> for LadderTriggerView<'a> {
14177            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14178            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
14179                #[allow(unused_imports)]
14180                use ::buffa::Enumeration as _;
14181                let mut size = 0u32;
14182                {
14183                    let val = self.side.to_i32();
14184                    if val != 0 {
14185                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14186                    }
14187                }
14188                if self.price_min_ticks != 0i64 {
14189                    size
14190                        += 1u32
14191                            + ::buffa::types::int64_encoded_len(self.price_min_ticks)
14192                                as u32;
14193                }
14194                if self.price_max_ticks != 0i64 {
14195                    size
14196                        += 1u32
14197                            + ::buffa::types::int64_encoded_len(self.price_max_ticks)
14198                                as u32;
14199                }
14200                if self.levels != 0i32 {
14201                    size += 1u32 + ::buffa::types::int32_encoded_len(self.levels) as u32;
14202                }
14203                if self.post_only {
14204                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14205                }
14206                size += self.__buffa_unknown_fields.encoded_len() as u32;
14207                size
14208            }
14209            #[allow(clippy::needless_borrow)]
14210            fn write_to(
14211                &self,
14212                _cache: &mut ::buffa::SizeCache,
14213                buf: &mut impl ::buffa::bytes::BufMut,
14214            ) {
14215                #[allow(unused_imports)]
14216                use ::buffa::Enumeration as _;
14217                {
14218                    let val = self.side.to_i32();
14219                    if val != 0 {
14220                        ::buffa::types::put_int32_field(1u32, val, buf);
14221                    }
14222                }
14223                if self.price_min_ticks != 0i64 {
14224                    ::buffa::types::put_int64_field(2u32, self.price_min_ticks, buf);
14225                }
14226                if self.price_max_ticks != 0i64 {
14227                    ::buffa::types::put_int64_field(3u32, self.price_max_ticks, buf);
14228                }
14229                if self.levels != 0i32 {
14230                    ::buffa::types::put_int32_field(4u32, self.levels, buf);
14231                }
14232                if self.post_only {
14233                    ::buffa::types::put_bool_field(5u32, self.post_only, buf);
14234                }
14235                self.__buffa_unknown_fields.write_to(buf);
14236            }
14237        }
14238        /// Serializes this view as protobuf JSON.
14239        ///
14240        /// Implicit-presence fields with default values are omitted, `required`
14241        /// fields are always emitted, explicit-presence (`optional`) fields are
14242        /// emitted only when set, bytes fields are base64-encoded, and enum
14243        /// values are their proto name strings.
14244        ///
14245        /// This impl uses `serialize_map(None)` because the number of emitted
14246        /// fields depends on default-omission rules; serializers that require
14247        /// known map lengths (e.g. `bincode`) will return a runtime error.
14248        /// Use the owned message type for those formats.
14249        impl<'__a> ::serde::Serialize for LadderTriggerView<'__a> {
14250            fn serialize<__S: ::serde::Serializer>(
14251                &self,
14252                __s: __S,
14253            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14254                use ::serde::ser::SerializeMap as _;
14255                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14256                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
14257                    __map.serialize_entry("side", &self.side)?;
14258                }
14259                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_min_ticks) {
14260                    __map
14261                        .serialize_entry(
14262                            "priceMinTicks",
14263                            &::buffa::json_helpers::ProtoJson(&self.price_min_ticks),
14264                        )?;
14265                }
14266                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_max_ticks) {
14267                    __map
14268                        .serialize_entry(
14269                            "priceMaxTicks",
14270                            &::buffa::json_helpers::ProtoJson(&self.price_max_ticks),
14271                        )?;
14272                }
14273                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.levels) {
14274                    __map
14275                        .serialize_entry(
14276                            "levels",
14277                            &::buffa::json_helpers::ProtoJson(&self.levels),
14278                        )?;
14279                }
14280                if self.post_only {
14281                    __map.serialize_entry("postOnly", &self.post_only)?;
14282                }
14283                __map.end()
14284            }
14285        }
14286        impl<'a> ::buffa::MessageName for LadderTriggerView<'a> {
14287            const PACKAGE: &'static str = "triggers.v1";
14288            const NAME: &'static str = "LadderTrigger";
14289            const FULL_NAME: &'static str = "triggers.v1.LadderTrigger";
14290            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderTrigger";
14291        }
14292        ::buffa::impl_default_view_instance!(LadderTriggerView);
14293        ::buffa::impl_view_reborrow!(LadderTriggerView);
14294        /** Self-contained, `'static` owned view of a `LadderTrigger` message.
14295
14296 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.
14297
14298 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.*/
14299        #[derive(Clone, Debug)]
14300        pub struct LadderTriggerOwnedView(
14301            ::buffa::OwnedView<LadderTriggerView<'static>>,
14302        );
14303        impl LadderTriggerOwnedView {
14304            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
14305            ///
14306            /// The view borrows directly from the buffer's data; the buffer is
14307            /// retained inside the returned handle.
14308            ///
14309            /// # Errors
14310            ///
14311            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
14312            /// protobuf data.
14313            pub fn decode(
14314                bytes: ::buffa::bytes::Bytes,
14315            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14316                ::core::result::Result::Ok(
14317                    LadderTriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
14318                )
14319            }
14320            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
14321            /// max message size).
14322            ///
14323            /// # Errors
14324            ///
14325            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
14326            /// exceeds the configured limits.
14327            pub fn decode_with_options(
14328                bytes: ::buffa::bytes::Bytes,
14329                opts: &::buffa::DecodeOptions,
14330            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14331                ::core::result::Result::Ok(
14332                    LadderTriggerOwnedView(
14333                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
14334                    ),
14335                )
14336            }
14337            /// Build from an owned message via an encode → decode round-trip.
14338            ///
14339            /// # Errors
14340            ///
14341            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
14342            /// somehow invalid (should not happen for well-formed messages).
14343            pub fn from_owned(
14344                msg: &super::super::LadderTrigger,
14345            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14346                ::core::result::Result::Ok(
14347                    LadderTriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
14348                )
14349            }
14350            /// Borrow the full [`LadderTriggerView`] with its lifetime tied to `&self`.
14351            #[must_use]
14352            pub fn view(&self) -> &LadderTriggerView<'_> {
14353                self.0.reborrow()
14354            }
14355            /// Convert to the owned message type.
14356            ///
14357            /// # Errors
14358            ///
14359            /// Returns an error if re-materializing preserved unknown fields
14360            /// fails (e.g. the unknown-field limit is exceeded).
14361            pub fn to_owned_message(
14362                &self,
14363            ) -> ::core::result::Result<
14364                super::super::LadderTrigger,
14365                ::buffa::DecodeError,
14366            > {
14367                self.0.to_owned_message()
14368            }
14369            /// The underlying bytes buffer.
14370            #[must_use]
14371            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
14372                self.0.bytes()
14373            }
14374            /// Consume the handle, returning the underlying bytes buffer.
14375            #[must_use]
14376            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
14377                self.0.into_bytes()
14378            }
14379            /// Child side.
14380            ///
14381            /// Field 1: `side`
14382            #[must_use]
14383            pub fn side(
14384                &self,
14385            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::Side> {
14386                self.0.reborrow().side
14387            }
14388            /// Minimum generated level price in quote units scaled by 1e6.
14389            ///
14390            /// Field 2: `price_min_ticks`
14391            #[must_use]
14392            pub fn price_min_ticks(&self) -> i64 {
14393                self.0.reborrow().price_min_ticks
14394            }
14395            /// Maximum generated level price in quote units scaled by 1e6.
14396            ///
14397            /// Field 3: `price_max_ticks`
14398            #[must_use]
14399            pub fn price_max_ticks(&self) -> i64 {
14400                self.0.reborrow().price_max_ticks
14401            }
14402            /// Number of linearly distributed levels.
14403            ///
14404            /// Field 4: `levels`
14405            #[must_use]
14406            pub fn levels(&self) -> i32 {
14407                self.0.reborrow().levels
14408            }
14409            /// Reject each level instead of taking liquidity.
14410            ///
14411            /// Field 5: `post_only`
14412            #[must_use]
14413            pub fn post_only(&self) -> bool {
14414                self.0.reborrow().post_only
14415            }
14416        }
14417        impl ::core::convert::From<::buffa::OwnedView<LadderTriggerView<'static>>>
14418        for LadderTriggerOwnedView {
14419            fn from(inner: ::buffa::OwnedView<LadderTriggerView<'static>>) -> Self {
14420                LadderTriggerOwnedView(inner)
14421            }
14422        }
14423        impl ::core::convert::From<LadderTriggerOwnedView>
14424        for ::buffa::OwnedView<LadderTriggerView<'static>> {
14425            fn from(wrapper: LadderTriggerOwnedView) -> Self {
14426                wrapper.0
14427            }
14428        }
14429        impl ::core::convert::AsRef<::buffa::OwnedView<LadderTriggerView<'static>>>
14430        for LadderTriggerOwnedView {
14431            fn as_ref(&self) -> &::buffa::OwnedView<LadderTriggerView<'static>> {
14432                &self.0
14433            }
14434        }
14435        impl ::buffa::HasMessageView for super::super::LadderTrigger {
14436            type View<'a> = LadderTriggerView<'a>;
14437            type ViewHandle = LadderTriggerOwnedView;
14438        }
14439        impl ::serde::Serialize for LadderTriggerOwnedView {
14440            fn serialize<__S: ::serde::Serializer>(
14441                &self,
14442                __s: __S,
14443            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14444                ::serde::Serialize::serialize(&self.0, __s)
14445            }
14446        }
14447        /// TriggerIntent contains one standalone trigger's immutable configuration.
14448        #[derive(Clone, Debug, Default)]
14449        pub struct TriggerIntentView<'a> {
14450            /// Symbol, for example "BTC-USDT".
14451            ///
14452            /// Field 1: `symbol`
14453            pub symbol: &'a str,
14454            /// Total quantity scaled by the pair's base_quantity_scale.
14455            ///
14456            /// Field 2: `qty_scaled`
14457            pub qty_scaled: i64,
14458            /// Fee asset for BUY children. SELL children must use QUOTE.
14459            ///
14460            /// Field 3: `fee_asset`
14461            pub fee_asset: ::buffa::EnumValue<
14462                super::super::super::super::orders::v1::FeeAsset,
14463            >,
14464            /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
14465            ///
14466            /// Field 4: `self_trade_prevention_mode`
14467            pub self_trade_prevention_mode: ::buffa::EnumValue<
14468                super::super::super::super::orders::v1::SelfTradePreventionMode,
14469            >,
14470            /// Client-provided trigger ID for idempotency.
14471            ///
14472            /// Field 5: `client_trigger_id`
14473            pub client_trigger_id: &'a str,
14474            pub strategy: ::core::option::Option<
14475                super::super::__buffa::view::oneof::trigger_intent::Strategy<'a>,
14476            >,
14477            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14478        }
14479        impl<'a> ::buffa::MessageView<'a> for TriggerIntentView<'a> {
14480            type Owned = super::super::TriggerIntent;
14481            fn decode_view(
14482                buf: &'a [u8],
14483            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14484                let __limit = ::core::cell::Cell::new(
14485                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14486                );
14487                <Self as ::buffa::MessageView>::decode_view_ctx(
14488                    buf,
14489                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14490                )
14491            }
14492            fn decode_view_with_ctx(
14493                buf: &'a [u8],
14494                ctx: ::buffa::DecodeContext<'_>,
14495            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14496                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14497            }
14498            fn merge_view_field(
14499                &mut self,
14500                tag: ::buffa::encoding::Tag,
14501                cur: &'a [u8],
14502                before_tag: &'a [u8],
14503                ctx: ::buffa::DecodeContext<'_>,
14504            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14505                let _ = ctx;
14506                #[allow(unused_variables)]
14507                let view = self;
14508                let mut cur = cur;
14509                match tag.field_number() {
14510                    1u32 => {
14511                        ::buffa::encoding::check_wire_type(
14512                            tag,
14513                            ::buffa::encoding::WireType::LengthDelimited,
14514                        )?;
14515                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
14516                    }
14517                    2u32 => {
14518                        ::buffa::encoding::check_wire_type(
14519                            tag,
14520                            ::buffa::encoding::WireType::Varint,
14521                        )?;
14522                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
14523                    }
14524                    3u32 => {
14525                        ::buffa::encoding::check_wire_type(
14526                            tag,
14527                            ::buffa::encoding::WireType::Varint,
14528                        )?;
14529                        view.fee_asset = ::buffa::EnumValue::from(
14530                            ::buffa::types::decode_int32(&mut cur)?,
14531                        );
14532                    }
14533                    4u32 => {
14534                        ::buffa::encoding::check_wire_type(
14535                            tag,
14536                            ::buffa::encoding::WireType::Varint,
14537                        )?;
14538                        view.self_trade_prevention_mode = ::buffa::EnumValue::from(
14539                            ::buffa::types::decode_int32(&mut cur)?,
14540                        );
14541                    }
14542                    5u32 => {
14543                        ::buffa::encoding::check_wire_type(
14544                            tag,
14545                            ::buffa::encoding::WireType::LengthDelimited,
14546                        )?;
14547                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
14548                    }
14549                    10u32 => {
14550                        ::buffa::encoding::check_wire_type(
14551                            tag,
14552                            ::buffa::encoding::WireType::LengthDelimited,
14553                        )?;
14554                        let __sub_ctx = ctx.descend()?;
14555                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14556                        if let Some(
14557                            super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14558                                ref mut existing,
14559                            ),
14560                        ) = view.strategy
14561                        {
14562                            ::buffa::MessageView::merge_into_view(
14563                                &mut **existing,
14564                                sub,
14565                                __sub_ctx,
14566                            )?;
14567                        } else {
14568                            view.strategy = Some(
14569                                super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14570                                    ::buffa::alloc::boxed::Box::new(
14571                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
14572                                            sub,
14573                                            __sub_ctx,
14574                                        )?,
14575                                    ),
14576                                ),
14577                            );
14578                        }
14579                    }
14580                    11u32 => {
14581                        ::buffa::encoding::check_wire_type(
14582                            tag,
14583                            ::buffa::encoding::WireType::LengthDelimited,
14584                        )?;
14585                        let __sub_ctx = ctx.descend()?;
14586                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14587                        if let Some(
14588                            super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14589                                ref mut existing,
14590                            ),
14591                        ) = view.strategy
14592                        {
14593                            ::buffa::MessageView::merge_into_view(
14594                                &mut **existing,
14595                                sub,
14596                                __sub_ctx,
14597                            )?;
14598                        } else {
14599                            view.strategy = Some(
14600                                super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14601                                    ::buffa::alloc::boxed::Box::new(
14602                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
14603                                            sub,
14604                                            __sub_ctx,
14605                                        )?,
14606                                    ),
14607                                ),
14608                            );
14609                        }
14610                    }
14611                    12u32 => {
14612                        ::buffa::encoding::check_wire_type(
14613                            tag,
14614                            ::buffa::encoding::WireType::LengthDelimited,
14615                        )?;
14616                        let __sub_ctx = ctx.descend()?;
14617                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14618                        if let Some(
14619                            super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14620                                ref mut existing,
14621                            ),
14622                        ) = view.strategy
14623                        {
14624                            ::buffa::MessageView::merge_into_view(
14625                                &mut **existing,
14626                                sub,
14627                                __sub_ctx,
14628                            )?;
14629                        } else {
14630                            view.strategy = Some(
14631                                super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14632                                    ::buffa::alloc::boxed::Box::new(
14633                                        <super::super::__buffa::view::TrailingStopTriggerView as ::buffa::MessageView>::decode_view_ctx(
14634                                            sub,
14635                                            __sub_ctx,
14636                                        )?,
14637                                    ),
14638                                ),
14639                            );
14640                        }
14641                    }
14642                    13u32 => {
14643                        ::buffa::encoding::check_wire_type(
14644                            tag,
14645                            ::buffa::encoding::WireType::LengthDelimited,
14646                        )?;
14647                        let __sub_ctx = ctx.descend()?;
14648                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14649                        if let Some(
14650                            super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14651                                ref mut existing,
14652                            ),
14653                        ) = view.strategy
14654                        {
14655                            ::buffa::MessageView::merge_into_view(
14656                                &mut **existing,
14657                                sub,
14658                                __sub_ctx,
14659                            )?;
14660                        } else {
14661                            view.strategy = Some(
14662                                super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14663                                    ::buffa::alloc::boxed::Box::new(
14664                                        <super::super::__buffa::view::TwapTriggerView as ::buffa::MessageView>::decode_view_ctx(
14665                                            sub,
14666                                            __sub_ctx,
14667                                        )?,
14668                                    ),
14669                                ),
14670                            );
14671                        }
14672                    }
14673                    14u32 => {
14674                        ::buffa::encoding::check_wire_type(
14675                            tag,
14676                            ::buffa::encoding::WireType::LengthDelimited,
14677                        )?;
14678                        let __sub_ctx = ctx.descend()?;
14679                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14680                        if let Some(
14681                            super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14682                                ref mut existing,
14683                            ),
14684                        ) = view.strategy
14685                        {
14686                            ::buffa::MessageView::merge_into_view(
14687                                &mut **existing,
14688                                sub,
14689                                __sub_ctx,
14690                            )?;
14691                        } else {
14692                            view.strategy = Some(
14693                                super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14694                                    ::buffa::alloc::boxed::Box::new(
14695                                        <super::super::__buffa::view::LadderTriggerView as ::buffa::MessageView>::decode_view_ctx(
14696                                            sub,
14697                                            __sub_ctx,
14698                                        )?,
14699                                    ),
14700                                ),
14701                            );
14702                        }
14703                    }
14704                    _ => {
14705                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14706                        let span_len = before_tag.len() - cur.len();
14707                        view.__buffa_unknown_fields
14708                            .push_record(before_tag, span_len, ctx)?;
14709                    }
14710                }
14711                ::core::result::Result::Ok(cur)
14712            }
14713            fn to_owned_message(
14714                &self,
14715            ) -> ::core::result::Result<
14716                super::super::TriggerIntent,
14717                ::buffa::DecodeError,
14718            > {
14719                self.to_owned_from_source(None)
14720            }
14721            #[allow(clippy::useless_conversion, clippy::needless_update)]
14722            fn to_owned_from_source(
14723                &self,
14724                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14725            ) -> ::core::result::Result<
14726                super::super::TriggerIntent,
14727                ::buffa::DecodeError,
14728            > {
14729                #[allow(unused_imports)]
14730                use ::buffa::alloc::string::ToString as _;
14731                let _ = __buffa_src;
14732                ::core::result::Result::Ok(super::super::TriggerIntent {
14733                    symbol: self.symbol.to_string(),
14734                    qty_scaled: self.qty_scaled,
14735                    fee_asset: self.fee_asset,
14736                    self_trade_prevention_mode: self.self_trade_prevention_mode,
14737                    client_trigger_id: self.client_trigger_id.to_string(),
14738                    strategy: match self.strategy.as_ref() {
14739                        ::core::option::Option::Some(v) => {
14740                            ::core::option::Option::Some(
14741                                match v {
14742                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14743                                        v,
14744                                    ) => {
14745                                        super::super::__buffa::oneof::trigger_intent::Strategy::StopLoss(
14746                                            ::buffa::alloc::boxed::Box::new(
14747                                                v.to_owned_from_source(__buffa_src)?,
14748                                            ),
14749                                        )
14750                                    }
14751                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14752                                        v,
14753                                    ) => {
14754                                        super::super::__buffa::oneof::trigger_intent::Strategy::TakeProfit(
14755                                            ::buffa::alloc::boxed::Box::new(
14756                                                v.to_owned_from_source(__buffa_src)?,
14757                                            ),
14758                                        )
14759                                    }
14760                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14761                                        v,
14762                                    ) => {
14763                                        super::super::__buffa::oneof::trigger_intent::Strategy::TrailingStop(
14764                                            ::buffa::alloc::boxed::Box::new(
14765                                                v.to_owned_from_source(__buffa_src)?,
14766                                            ),
14767                                        )
14768                                    }
14769                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14770                                        v,
14771                                    ) => {
14772                                        super::super::__buffa::oneof::trigger_intent::Strategy::Twap(
14773                                            ::buffa::alloc::boxed::Box::new(
14774                                                v.to_owned_from_source(__buffa_src)?,
14775                                            ),
14776                                        )
14777                                    }
14778                                    super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14779                                        v,
14780                                    ) => {
14781                                        super::super::__buffa::oneof::trigger_intent::Strategy::Ladder(
14782                                            ::buffa::alloc::boxed::Box::new(
14783                                                v.to_owned_from_source(__buffa_src)?,
14784                                            ),
14785                                        )
14786                                    }
14787                                },
14788                            )
14789                        }
14790                        ::core::option::Option::None => ::core::option::Option::None,
14791                    },
14792                    __buffa_unknown_fields: self
14793                        .__buffa_unknown_fields
14794                        .to_owned()?
14795                        .into(),
14796                    ..::core::default::Default::default()
14797                })
14798            }
14799        }
14800        impl<'a> ::buffa::ViewEncode<'a> for TriggerIntentView<'a> {
14801            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14802            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14803                #[allow(unused_imports)]
14804                use ::buffa::Enumeration as _;
14805                let mut size = 0u32;
14806                if !self.symbol.is_empty() {
14807                    size
14808                        += 1u32
14809                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
14810                }
14811                if self.qty_scaled != 0i64 {
14812                    size
14813                        += 1u32
14814                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
14815                }
14816                {
14817                    let val = self.fee_asset.to_i32();
14818                    if val != 0 {
14819                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14820                    }
14821                }
14822                {
14823                    let val = self.self_trade_prevention_mode.to_i32();
14824                    if val != 0 {
14825                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14826                    }
14827                }
14828                if !self.client_trigger_id.is_empty() {
14829                    size
14830                        += 1u32
14831                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
14832                                as u32;
14833                }
14834                if let ::core::option::Option::Some(ref v) = self.strategy {
14835                    match v {
14836                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14837                            x,
14838                        ) => {
14839                            let __slot = __cache.reserve();
14840                            let inner = x.compute_size(__cache);
14841                            __cache.set(__slot, inner);
14842                            size
14843                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14844                                    + inner;
14845                        }
14846                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14847                            x,
14848                        ) => {
14849                            let __slot = __cache.reserve();
14850                            let inner = x.compute_size(__cache);
14851                            __cache.set(__slot, inner);
14852                            size
14853                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14854                                    + inner;
14855                        }
14856                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14857                            x,
14858                        ) => {
14859                            let __slot = __cache.reserve();
14860                            let inner = x.compute_size(__cache);
14861                            __cache.set(__slot, inner);
14862                            size
14863                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14864                                    + inner;
14865                        }
14866                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14867                            x,
14868                        ) => {
14869                            let __slot = __cache.reserve();
14870                            let inner = x.compute_size(__cache);
14871                            __cache.set(__slot, inner);
14872                            size
14873                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14874                                    + inner;
14875                        }
14876                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14877                            x,
14878                        ) => {
14879                            let __slot = __cache.reserve();
14880                            let inner = x.compute_size(__cache);
14881                            __cache.set(__slot, inner);
14882                            size
14883                                += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
14884                                    + inner;
14885                        }
14886                    }
14887                }
14888                size += self.__buffa_unknown_fields.encoded_len() as u32;
14889                size
14890            }
14891            #[allow(clippy::needless_borrow)]
14892            fn write_to(
14893                &self,
14894                __cache: &mut ::buffa::SizeCache,
14895                buf: &mut impl ::buffa::bytes::BufMut,
14896            ) {
14897                #[allow(unused_imports)]
14898                use ::buffa::Enumeration as _;
14899                if !self.symbol.is_empty() {
14900                    ::buffa::types::put_string_field(1u32, &self.symbol, buf);
14901                }
14902                if self.qty_scaled != 0i64 {
14903                    ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
14904                }
14905                {
14906                    let val = self.fee_asset.to_i32();
14907                    if val != 0 {
14908                        ::buffa::types::put_int32_field(3u32, val, buf);
14909                    }
14910                }
14911                {
14912                    let val = self.self_trade_prevention_mode.to_i32();
14913                    if val != 0 {
14914                        ::buffa::types::put_int32_field(4u32, val, buf);
14915                    }
14916                }
14917                if !self.client_trigger_id.is_empty() {
14918                    ::buffa::types::put_string_field(5u32, &self.client_trigger_id, buf);
14919                }
14920                if let ::core::option::Option::Some(ref v) = self.strategy {
14921                    match v {
14922                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
14923                            x,
14924                        ) => {
14925                            ::buffa::types::put_len_delimited_header(
14926                                10u32,
14927                                __cache.consume_next(),
14928                                buf,
14929                            );
14930                            x.write_to(__cache, buf);
14931                        }
14932                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
14933                            x,
14934                        ) => {
14935                            ::buffa::types::put_len_delimited_header(
14936                                11u32,
14937                                __cache.consume_next(),
14938                                buf,
14939                            );
14940                            x.write_to(__cache, buf);
14941                        }
14942                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
14943                            x,
14944                        ) => {
14945                            ::buffa::types::put_len_delimited_header(
14946                                12u32,
14947                                __cache.consume_next(),
14948                                buf,
14949                            );
14950                            x.write_to(__cache, buf);
14951                        }
14952                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
14953                            x,
14954                        ) => {
14955                            ::buffa::types::put_len_delimited_header(
14956                                13u32,
14957                                __cache.consume_next(),
14958                                buf,
14959                            );
14960                            x.write_to(__cache, buf);
14961                        }
14962                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
14963                            x,
14964                        ) => {
14965                            ::buffa::types::put_len_delimited_header(
14966                                14u32,
14967                                __cache.consume_next(),
14968                                buf,
14969                            );
14970                            x.write_to(__cache, buf);
14971                        }
14972                    }
14973                }
14974                self.__buffa_unknown_fields.write_to(buf);
14975            }
14976        }
14977        /// Serializes this view as protobuf JSON.
14978        ///
14979        /// Implicit-presence fields with default values are omitted, `required`
14980        /// fields are always emitted, explicit-presence (`optional`) fields are
14981        /// emitted only when set, bytes fields are base64-encoded, and enum
14982        /// values are their proto name strings.
14983        ///
14984        /// This impl uses `serialize_map(None)` because the number of emitted
14985        /// fields depends on default-omission rules; serializers that require
14986        /// known map lengths (e.g. `bincode`) will return a runtime error.
14987        /// Use the owned message type for those formats.
14988        impl<'__a> ::serde::Serialize for TriggerIntentView<'__a> {
14989            fn serialize<__S: ::serde::Serializer>(
14990                &self,
14991                __s: __S,
14992            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14993                use ::serde::ser::SerializeMap as _;
14994                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14995                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
14996                    __map.serialize_entry("symbol", self.symbol)?;
14997                }
14998                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
14999                    __map
15000                        .serialize_entry(
15001                            "qtyScaled",
15002                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
15003                        )?;
15004                }
15005                if !::buffa::json_helpers::skip_if::is_default_enum_value(
15006                    &self.fee_asset,
15007                ) {
15008                    __map.serialize_entry("feeAsset", &self.fee_asset)?;
15009                }
15010                if !::buffa::json_helpers::skip_if::is_default_enum_value(
15011                    &self.self_trade_prevention_mode,
15012                ) {
15013                    __map
15014                        .serialize_entry(
15015                            "selfTradePreventionMode",
15016                            &self.self_trade_prevention_mode,
15017                        )?;
15018                }
15019                if !::buffa::json_helpers::skip_if::is_empty_str(
15020                    self.client_trigger_id,
15021                ) {
15022                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
15023                }
15024                if let ::core::option::Option::Some(ref __ov) = self.strategy {
15025                    match __ov {
15026                        super::super::__buffa::view::oneof::trigger_intent::Strategy::StopLoss(
15027                            v,
15028                        ) => {
15029                            __map.serialize_entry("stopLoss", v)?;
15030                        }
15031                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TakeProfit(
15032                            v,
15033                        ) => {
15034                            __map.serialize_entry("takeProfit", v)?;
15035                        }
15036                        super::super::__buffa::view::oneof::trigger_intent::Strategy::TrailingStop(
15037                            v,
15038                        ) => {
15039                            __map.serialize_entry("trailingStop", v)?;
15040                        }
15041                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Twap(
15042                            v,
15043                        ) => {
15044                            __map.serialize_entry("twap", v)?;
15045                        }
15046                        super::super::__buffa::view::oneof::trigger_intent::Strategy::Ladder(
15047                            v,
15048                        ) => {
15049                            __map.serialize_entry("ladder", v)?;
15050                        }
15051                    }
15052                }
15053                __map.end()
15054            }
15055        }
15056        impl<'a> ::buffa::MessageName for TriggerIntentView<'a> {
15057            const PACKAGE: &'static str = "triggers.v1";
15058            const NAME: &'static str = "TriggerIntent";
15059            const FULL_NAME: &'static str = "triggers.v1.TriggerIntent";
15060            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerIntent";
15061        }
15062        ::buffa::impl_default_view_instance!(TriggerIntentView);
15063        ::buffa::impl_view_reborrow!(TriggerIntentView);
15064        /** Self-contained, `'static` owned view of a `TriggerIntent` message.
15065
15066 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.
15067
15068 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.*/
15069        #[derive(Clone, Debug)]
15070        pub struct TriggerIntentOwnedView(
15071            ::buffa::OwnedView<TriggerIntentView<'static>>,
15072        );
15073        impl TriggerIntentOwnedView {
15074            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15075            ///
15076            /// The view borrows directly from the buffer's data; the buffer is
15077            /// retained inside the returned handle.
15078            ///
15079            /// # Errors
15080            ///
15081            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15082            /// protobuf data.
15083            pub fn decode(
15084                bytes: ::buffa::bytes::Bytes,
15085            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15086                ::core::result::Result::Ok(
15087                    TriggerIntentOwnedView(::buffa::OwnedView::decode(bytes)?),
15088                )
15089            }
15090            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15091            /// max message size).
15092            ///
15093            /// # Errors
15094            ///
15095            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15096            /// exceeds the configured limits.
15097            pub fn decode_with_options(
15098                bytes: ::buffa::bytes::Bytes,
15099                opts: &::buffa::DecodeOptions,
15100            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15101                ::core::result::Result::Ok(
15102                    TriggerIntentOwnedView(
15103                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15104                    ),
15105                )
15106            }
15107            /// Build from an owned message via an encode → decode round-trip.
15108            ///
15109            /// # Errors
15110            ///
15111            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15112            /// somehow invalid (should not happen for well-formed messages).
15113            pub fn from_owned(
15114                msg: &super::super::TriggerIntent,
15115            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15116                ::core::result::Result::Ok(
15117                    TriggerIntentOwnedView(::buffa::OwnedView::from_owned(msg)?),
15118                )
15119            }
15120            /// Borrow the full [`TriggerIntentView`] with its lifetime tied to `&self`.
15121            #[must_use]
15122            pub fn view(&self) -> &TriggerIntentView<'_> {
15123                self.0.reborrow()
15124            }
15125            /// Convert to the owned message type.
15126            ///
15127            /// # Errors
15128            ///
15129            /// Returns an error if re-materializing preserved unknown fields
15130            /// fails (e.g. the unknown-field limit is exceeded).
15131            pub fn to_owned_message(
15132                &self,
15133            ) -> ::core::result::Result<
15134                super::super::TriggerIntent,
15135                ::buffa::DecodeError,
15136            > {
15137                self.0.to_owned_message()
15138            }
15139            /// The underlying bytes buffer.
15140            #[must_use]
15141            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15142                self.0.bytes()
15143            }
15144            /// Consume the handle, returning the underlying bytes buffer.
15145            #[must_use]
15146            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15147                self.0.into_bytes()
15148            }
15149            /// Symbol, for example "BTC-USDT".
15150            ///
15151            /// Field 1: `symbol`
15152            #[must_use]
15153            pub fn symbol(&self) -> &'_ str {
15154                self.0.reborrow().symbol
15155            }
15156            /// Total quantity scaled by the pair's base_quantity_scale.
15157            ///
15158            /// Field 2: `qty_scaled`
15159            #[must_use]
15160            pub fn qty_scaled(&self) -> i64 {
15161                self.0.reborrow().qty_scaled
15162            }
15163            /// Fee asset for BUY children. SELL children must use QUOTE.
15164            ///
15165            /// Field 3: `fee_asset`
15166            #[must_use]
15167            pub fn fee_asset(
15168                &self,
15169            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::FeeAsset> {
15170                self.0.reborrow().fee_asset
15171            }
15172            /// Child self-trade prevention mode. Defaults to EXPIRE_MAKER.
15173            ///
15174            /// Field 4: `self_trade_prevention_mode`
15175            #[must_use]
15176            pub fn self_trade_prevention_mode(
15177                &self,
15178            ) -> ::buffa::EnumValue<
15179                super::super::super::super::orders::v1::SelfTradePreventionMode,
15180            > {
15181                self.0.reborrow().self_trade_prevention_mode
15182            }
15183            /// Client-provided trigger ID for idempotency.
15184            ///
15185            /// Field 5: `client_trigger_id`
15186            #[must_use]
15187            pub fn client_trigger_id(&self) -> &'_ str {
15188                self.0.reborrow().client_trigger_id
15189            }
15190            /// Oneof `strategy`.
15191            #[must_use]
15192            pub fn strategy(
15193                &self,
15194            ) -> ::core::option::Option<
15195                &super::super::__buffa::view::oneof::trigger_intent::Strategy<'_>,
15196            > {
15197                self.0.reborrow().strategy.as_ref()
15198            }
15199        }
15200        impl ::core::convert::From<::buffa::OwnedView<TriggerIntentView<'static>>>
15201        for TriggerIntentOwnedView {
15202            fn from(inner: ::buffa::OwnedView<TriggerIntentView<'static>>) -> Self {
15203                TriggerIntentOwnedView(inner)
15204            }
15205        }
15206        impl ::core::convert::From<TriggerIntentOwnedView>
15207        for ::buffa::OwnedView<TriggerIntentView<'static>> {
15208            fn from(wrapper: TriggerIntentOwnedView) -> Self {
15209                wrapper.0
15210            }
15211        }
15212        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerIntentView<'static>>>
15213        for TriggerIntentOwnedView {
15214            fn as_ref(&self) -> &::buffa::OwnedView<TriggerIntentView<'static>> {
15215                &self.0
15216            }
15217        }
15218        impl ::buffa::HasMessageView for super::super::TriggerIntent {
15219            type View<'a> = TriggerIntentView<'a>;
15220            type ViewHandle = TriggerIntentOwnedView;
15221        }
15222        impl ::serde::Serialize for TriggerIntentOwnedView {
15223            fn serialize<__S: ::serde::Serializer>(
15224                &self,
15225                __s: __S,
15226            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15227                ::serde::Serialize::serialize(&self.0, __s)
15228            }
15229        }
15230        /// CreateTriggerRequest submits one standalone trigger intent for admission.
15231        #[derive(Clone, Debug, Default)]
15232        pub struct CreateTriggerRequestView<'a> {
15233            /// Target sub-account. When omitted, uses the caller's root account.
15234            ///
15235            /// Field 1: `subaccount_id`
15236            pub subaccount_id: ::core::option::Option<u64>,
15237            /// Trigger to admit.
15238            ///
15239            /// Field 2: `trigger`
15240            pub trigger: ::buffa::MessageFieldView<
15241                super::super::__buffa::view::TriggerIntentView<'a>,
15242            >,
15243            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15244        }
15245        impl<'a> ::buffa::MessageView<'a> for CreateTriggerRequestView<'a> {
15246            type Owned = super::super::CreateTriggerRequest;
15247            fn decode_view(
15248                buf: &'a [u8],
15249            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15250                let __limit = ::core::cell::Cell::new(
15251                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15252                );
15253                <Self as ::buffa::MessageView>::decode_view_ctx(
15254                    buf,
15255                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15256                )
15257            }
15258            fn decode_view_with_ctx(
15259                buf: &'a [u8],
15260                ctx: ::buffa::DecodeContext<'_>,
15261            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15262                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15263            }
15264            fn merge_view_field(
15265                &mut self,
15266                tag: ::buffa::encoding::Tag,
15267                cur: &'a [u8],
15268                before_tag: &'a [u8],
15269                ctx: ::buffa::DecodeContext<'_>,
15270            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15271                let _ = ctx;
15272                #[allow(unused_variables)]
15273                let view = self;
15274                let mut cur = cur;
15275                match tag.field_number() {
15276                    1u32 => {
15277                        ::buffa::encoding::check_wire_type(
15278                            tag,
15279                            ::buffa::encoding::WireType::Fixed64,
15280                        )?;
15281                        view.subaccount_id = Some(
15282                            ::buffa::types::decode_fixed64(&mut cur)?,
15283                        );
15284                    }
15285                    2u32 => {
15286                        ::buffa::encoding::check_wire_type(
15287                            tag,
15288                            ::buffa::encoding::WireType::LengthDelimited,
15289                        )?;
15290                        let __sub_ctx = ctx.descend()?;
15291                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15292                        match view.trigger.as_mut() {
15293                            Some(existing) => {
15294                                ::buffa::MessageView::merge_into_view(
15295                                    existing,
15296                                    sub,
15297                                    __sub_ctx,
15298                                )?
15299                            }
15300                            None => {
15301                                view.trigger = ::buffa::MessageFieldView::set(
15302                                    <super::super::__buffa::view::TriggerIntentView as ::buffa::MessageView>::decode_view_ctx(
15303                                        sub,
15304                                        __sub_ctx,
15305                                    )?,
15306                                );
15307                            }
15308                        }
15309                    }
15310                    _ => {
15311                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15312                        let span_len = before_tag.len() - cur.len();
15313                        view.__buffa_unknown_fields
15314                            .push_record(before_tag, span_len, ctx)?;
15315                    }
15316                }
15317                ::core::result::Result::Ok(cur)
15318            }
15319            fn to_owned_message(
15320                &self,
15321            ) -> ::core::result::Result<
15322                super::super::CreateTriggerRequest,
15323                ::buffa::DecodeError,
15324            > {
15325                self.to_owned_from_source(None)
15326            }
15327            #[allow(clippy::useless_conversion, clippy::needless_update)]
15328            fn to_owned_from_source(
15329                &self,
15330                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15331            ) -> ::core::result::Result<
15332                super::super::CreateTriggerRequest,
15333                ::buffa::DecodeError,
15334            > {
15335                #[allow(unused_imports)]
15336                use ::buffa::alloc::string::ToString as _;
15337                let _ = __buffa_src;
15338                ::core::result::Result::Ok(super::super::CreateTriggerRequest {
15339                    subaccount_id: self.subaccount_id,
15340                    trigger: match self.trigger.as_option() {
15341                        Some(v) => {
15342                            ::buffa::MessageField::<
15343                                super::super::TriggerIntent,
15344                            >::some(v.to_owned_from_source(__buffa_src)?)
15345                        }
15346                        None => ::buffa::MessageField::none(),
15347                    },
15348                    __buffa_unknown_fields: self
15349                        .__buffa_unknown_fields
15350                        .to_owned()?
15351                        .into(),
15352                    ..::core::default::Default::default()
15353                })
15354            }
15355        }
15356        impl<'a> ::buffa::ViewEncode<'a> for CreateTriggerRequestView<'a> {
15357            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15358            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15359                #[allow(unused_imports)]
15360                use ::buffa::Enumeration as _;
15361                let mut size = 0u32;
15362                if self.subaccount_id.is_some() {
15363                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15364                }
15365                if self.trigger.is_set() {
15366                    let __slot = __cache.reserve();
15367                    let inner_size = self.trigger.compute_size(__cache);
15368                    __cache.set(__slot, inner_size);
15369                    size
15370                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15371                            + inner_size;
15372                }
15373                size += self.__buffa_unknown_fields.encoded_len() as u32;
15374                size
15375            }
15376            #[allow(clippy::needless_borrow)]
15377            fn write_to(
15378                &self,
15379                __cache: &mut ::buffa::SizeCache,
15380                buf: &mut impl ::buffa::bytes::BufMut,
15381            ) {
15382                #[allow(unused_imports)]
15383                use ::buffa::Enumeration as _;
15384                if let Some(v) = self.subaccount_id {
15385                    ::buffa::types::put_fixed64_field(1u32, v, buf);
15386                }
15387                if self.trigger.is_set() {
15388                    ::buffa::types::put_len_delimited_header(
15389                        2u32,
15390                        __cache.consume_next(),
15391                        buf,
15392                    );
15393                    self.trigger.write_to(__cache, buf);
15394                }
15395                self.__buffa_unknown_fields.write_to(buf);
15396            }
15397        }
15398        /// Serializes this view as protobuf JSON.
15399        ///
15400        /// Implicit-presence fields with default values are omitted, `required`
15401        /// fields are always emitted, explicit-presence (`optional`) fields are
15402        /// emitted only when set, bytes fields are base64-encoded, and enum
15403        /// values are their proto name strings.
15404        ///
15405        /// This impl uses `serialize_map(None)` because the number of emitted
15406        /// fields depends on default-omission rules; serializers that require
15407        /// known map lengths (e.g. `bincode`) will return a runtime error.
15408        /// Use the owned message type for those formats.
15409        impl<'__a> ::serde::Serialize for CreateTriggerRequestView<'__a> {
15410            fn serialize<__S: ::serde::Serializer>(
15411                &self,
15412                __s: __S,
15413            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15414                use ::serde::ser::SerializeMap as _;
15415                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15416                if let ::core::option::Option::Some(__v) = self.subaccount_id {
15417                    __map
15418                        .serialize_entry(
15419                            "subaccountId",
15420                            &::buffa::json_helpers::ProtoJson(&__v),
15421                        )?;
15422                }
15423                {
15424                    if let ::core::option::Option::Some(__v) = self.trigger.as_option() {
15425                        __map.serialize_entry("trigger", __v)?;
15426                    }
15427                }
15428                __map.end()
15429            }
15430        }
15431        impl<'a> ::buffa::MessageName for CreateTriggerRequestView<'a> {
15432            const PACKAGE: &'static str = "triggers.v1";
15433            const NAME: &'static str = "CreateTriggerRequest";
15434            const FULL_NAME: &'static str = "triggers.v1.CreateTriggerRequest";
15435            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerRequest";
15436        }
15437        ::buffa::impl_default_view_instance!(CreateTriggerRequestView);
15438        ::buffa::impl_view_reborrow!(CreateTriggerRequestView);
15439        /** Self-contained, `'static` owned view of a `CreateTriggerRequest` message.
15440
15441 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.
15442
15443 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.*/
15444        #[derive(Clone, Debug)]
15445        pub struct CreateTriggerRequestOwnedView(
15446            ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15447        );
15448        impl CreateTriggerRequestOwnedView {
15449            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15450            ///
15451            /// The view borrows directly from the buffer's data; the buffer is
15452            /// retained inside the returned handle.
15453            ///
15454            /// # Errors
15455            ///
15456            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15457            /// protobuf data.
15458            pub fn decode(
15459                bytes: ::buffa::bytes::Bytes,
15460            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15461                ::core::result::Result::Ok(
15462                    CreateTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
15463                )
15464            }
15465            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15466            /// max message size).
15467            ///
15468            /// # Errors
15469            ///
15470            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15471            /// exceeds the configured limits.
15472            pub fn decode_with_options(
15473                bytes: ::buffa::bytes::Bytes,
15474                opts: &::buffa::DecodeOptions,
15475            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15476                ::core::result::Result::Ok(
15477                    CreateTriggerRequestOwnedView(
15478                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15479                    ),
15480                )
15481            }
15482            /// Build from an owned message via an encode → decode round-trip.
15483            ///
15484            /// # Errors
15485            ///
15486            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15487            /// somehow invalid (should not happen for well-formed messages).
15488            pub fn from_owned(
15489                msg: &super::super::CreateTriggerRequest,
15490            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15491                ::core::result::Result::Ok(
15492                    CreateTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
15493                )
15494            }
15495            /// Borrow the full [`CreateTriggerRequestView`] with its lifetime tied to `&self`.
15496            #[must_use]
15497            pub fn view(&self) -> &CreateTriggerRequestView<'_> {
15498                self.0.reborrow()
15499            }
15500            /// Convert to the owned message type.
15501            ///
15502            /// # Errors
15503            ///
15504            /// Returns an error if re-materializing preserved unknown fields
15505            /// fails (e.g. the unknown-field limit is exceeded).
15506            pub fn to_owned_message(
15507                &self,
15508            ) -> ::core::result::Result<
15509                super::super::CreateTriggerRequest,
15510                ::buffa::DecodeError,
15511            > {
15512                self.0.to_owned_message()
15513            }
15514            /// The underlying bytes buffer.
15515            #[must_use]
15516            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15517                self.0.bytes()
15518            }
15519            /// Consume the handle, returning the underlying bytes buffer.
15520            #[must_use]
15521            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15522                self.0.into_bytes()
15523            }
15524            /// Target sub-account. When omitted, uses the caller's root account.
15525            ///
15526            /// Field 1: `subaccount_id`
15527            #[must_use]
15528            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
15529                self.0.reborrow().subaccount_id
15530            }
15531            /// Trigger to admit.
15532            ///
15533            /// Field 2: `trigger`
15534            #[must_use]
15535            pub fn trigger(
15536                &self,
15537            ) -> &::buffa::MessageFieldView<
15538                super::super::__buffa::view::TriggerIntentView<'_>,
15539            > {
15540                &self.0.reborrow().trigger
15541            }
15542        }
15543        impl ::core::convert::From<::buffa::OwnedView<CreateTriggerRequestView<'static>>>
15544        for CreateTriggerRequestOwnedView {
15545            fn from(
15546                inner: ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15547            ) -> Self {
15548                CreateTriggerRequestOwnedView(inner)
15549            }
15550        }
15551        impl ::core::convert::From<CreateTriggerRequestOwnedView>
15552        for ::buffa::OwnedView<CreateTriggerRequestView<'static>> {
15553            fn from(wrapper: CreateTriggerRequestOwnedView) -> Self {
15554                wrapper.0
15555            }
15556        }
15557        impl ::core::convert::AsRef<
15558            ::buffa::OwnedView<CreateTriggerRequestView<'static>>,
15559        > for CreateTriggerRequestOwnedView {
15560            fn as_ref(&self) -> &::buffa::OwnedView<CreateTriggerRequestView<'static>> {
15561                &self.0
15562            }
15563        }
15564        impl ::buffa::HasMessageView for super::super::CreateTriggerRequest {
15565            type View<'a> = CreateTriggerRequestView<'a>;
15566            type ViewHandle = CreateTriggerRequestOwnedView;
15567        }
15568        impl ::serde::Serialize for CreateTriggerRequestOwnedView {
15569            fn serialize<__S: ::serde::Serializer>(
15570                &self,
15571                __s: __S,
15572            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15573                ::serde::Serialize::serialize(&self.0, __s)
15574            }
15575        }
15576        /// CreateTriggerResponse acknowledges trigger creation only. Arming and child
15577        /// execution happen asynchronously and are visible through trigger reads/events.
15578        #[derive(Clone, Debug, Default)]
15579        pub struct CreateTriggerResponseView<'a> {
15580            /// Assigned trigger ID.
15581            ///
15582            /// Field 1: `trigger_id`
15583            pub trigger_id: u64,
15584            /// Echoed client trigger ID.
15585            ///
15586            /// Field 2: `client_trigger_id`
15587            pub client_trigger_id: &'a str,
15588            /// Time creation admission completed.
15589            ///
15590            /// Field 3: `accepted_at`
15591            pub accepted_at: ::buffa::MessageFieldView<
15592                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
15593            >,
15594            /// Admission completion time in nanoseconds since epoch (UTC).
15595            ///
15596            /// Field 4: `accepted_at_ts_ns`
15597            pub accepted_at_ts_ns: u64,
15598            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15599        }
15600        impl<'a> ::buffa::MessageView<'a> for CreateTriggerResponseView<'a> {
15601            type Owned = super::super::CreateTriggerResponse;
15602            fn decode_view(
15603                buf: &'a [u8],
15604            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15605                let __limit = ::core::cell::Cell::new(
15606                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15607                );
15608                <Self as ::buffa::MessageView>::decode_view_ctx(
15609                    buf,
15610                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15611                )
15612            }
15613            fn decode_view_with_ctx(
15614                buf: &'a [u8],
15615                ctx: ::buffa::DecodeContext<'_>,
15616            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15617                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15618            }
15619            fn merge_view_field(
15620                &mut self,
15621                tag: ::buffa::encoding::Tag,
15622                cur: &'a [u8],
15623                before_tag: &'a [u8],
15624                ctx: ::buffa::DecodeContext<'_>,
15625            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15626                let _ = ctx;
15627                #[allow(unused_variables)]
15628                let view = self;
15629                let mut cur = cur;
15630                match tag.field_number() {
15631                    1u32 => {
15632                        ::buffa::encoding::check_wire_type(
15633                            tag,
15634                            ::buffa::encoding::WireType::Fixed64,
15635                        )?;
15636                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
15637                    }
15638                    2u32 => {
15639                        ::buffa::encoding::check_wire_type(
15640                            tag,
15641                            ::buffa::encoding::WireType::LengthDelimited,
15642                        )?;
15643                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
15644                    }
15645                    3u32 => {
15646                        ::buffa::encoding::check_wire_type(
15647                            tag,
15648                            ::buffa::encoding::WireType::LengthDelimited,
15649                        )?;
15650                        let __sub_ctx = ctx.descend()?;
15651                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15652                        match view.accepted_at.as_mut() {
15653                            Some(existing) => {
15654                                ::buffa::MessageView::merge_into_view(
15655                                    existing,
15656                                    sub,
15657                                    __sub_ctx,
15658                                )?
15659                            }
15660                            None => {
15661                                view.accepted_at = ::buffa::MessageFieldView::set(
15662                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
15663                                        sub,
15664                                        __sub_ctx,
15665                                    )?,
15666                                );
15667                            }
15668                        }
15669                    }
15670                    4u32 => {
15671                        ::buffa::encoding::check_wire_type(
15672                            tag,
15673                            ::buffa::encoding::WireType::Varint,
15674                        )?;
15675                        view.accepted_at_ts_ns = ::buffa::types::decode_uint64(
15676                            &mut cur,
15677                        )?;
15678                    }
15679                    _ => {
15680                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15681                        let span_len = before_tag.len() - cur.len();
15682                        view.__buffa_unknown_fields
15683                            .push_record(before_tag, span_len, ctx)?;
15684                    }
15685                }
15686                ::core::result::Result::Ok(cur)
15687            }
15688            fn to_owned_message(
15689                &self,
15690            ) -> ::core::result::Result<
15691                super::super::CreateTriggerResponse,
15692                ::buffa::DecodeError,
15693            > {
15694                self.to_owned_from_source(None)
15695            }
15696            #[allow(clippy::useless_conversion, clippy::needless_update)]
15697            fn to_owned_from_source(
15698                &self,
15699                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15700            ) -> ::core::result::Result<
15701                super::super::CreateTriggerResponse,
15702                ::buffa::DecodeError,
15703            > {
15704                #[allow(unused_imports)]
15705                use ::buffa::alloc::string::ToString as _;
15706                let _ = __buffa_src;
15707                ::core::result::Result::Ok(super::super::CreateTriggerResponse {
15708                    trigger_id: self.trigger_id,
15709                    client_trigger_id: self.client_trigger_id.to_string(),
15710                    accepted_at: match self.accepted_at.as_option() {
15711                        Some(v) => {
15712                            ::buffa::MessageField::<
15713                                ::buffa_types::google::protobuf::Timestamp,
15714                            >::some(v.to_owned_from_source(__buffa_src)?)
15715                        }
15716                        None => ::buffa::MessageField::none(),
15717                    },
15718                    accepted_at_ts_ns: self.accepted_at_ts_ns,
15719                    __buffa_unknown_fields: self
15720                        .__buffa_unknown_fields
15721                        .to_owned()?
15722                        .into(),
15723                    ..::core::default::Default::default()
15724                })
15725            }
15726        }
15727        impl<'a> ::buffa::ViewEncode<'a> for CreateTriggerResponseView<'a> {
15728            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15729            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15730                #[allow(unused_imports)]
15731                use ::buffa::Enumeration as _;
15732                let mut size = 0u32;
15733                if self.trigger_id != 0u64 {
15734                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15735                }
15736                if !self.client_trigger_id.is_empty() {
15737                    size
15738                        += 1u32
15739                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
15740                                as u32;
15741                }
15742                if self.accepted_at.is_set() {
15743                    let __slot = __cache.reserve();
15744                    let inner_size = self.accepted_at.compute_size(__cache);
15745                    __cache.set(__slot, inner_size);
15746                    size
15747                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15748                            + inner_size;
15749                }
15750                if self.accepted_at_ts_ns != 0u64 {
15751                    size
15752                        += 1u32
15753                            + ::buffa::types::uint64_encoded_len(self.accepted_at_ts_ns)
15754                                as u32;
15755                }
15756                size += self.__buffa_unknown_fields.encoded_len() as u32;
15757                size
15758            }
15759            #[allow(clippy::needless_borrow)]
15760            fn write_to(
15761                &self,
15762                __cache: &mut ::buffa::SizeCache,
15763                buf: &mut impl ::buffa::bytes::BufMut,
15764            ) {
15765                #[allow(unused_imports)]
15766                use ::buffa::Enumeration as _;
15767                if self.trigger_id != 0u64 {
15768                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
15769                }
15770                if !self.client_trigger_id.is_empty() {
15771                    ::buffa::types::put_string_field(2u32, &self.client_trigger_id, buf);
15772                }
15773                if self.accepted_at.is_set() {
15774                    ::buffa::types::put_len_delimited_header(
15775                        3u32,
15776                        __cache.consume_next(),
15777                        buf,
15778                    );
15779                    self.accepted_at.write_to(__cache, buf);
15780                }
15781                if self.accepted_at_ts_ns != 0u64 {
15782                    ::buffa::types::put_uint64_field(4u32, self.accepted_at_ts_ns, buf);
15783                }
15784                self.__buffa_unknown_fields.write_to(buf);
15785            }
15786        }
15787        /// Serializes this view as protobuf JSON.
15788        ///
15789        /// Implicit-presence fields with default values are omitted, `required`
15790        /// fields are always emitted, explicit-presence (`optional`) fields are
15791        /// emitted only when set, bytes fields are base64-encoded, and enum
15792        /// values are their proto name strings.
15793        ///
15794        /// This impl uses `serialize_map(None)` because the number of emitted
15795        /// fields depends on default-omission rules; serializers that require
15796        /// known map lengths (e.g. `bincode`) will return a runtime error.
15797        /// Use the owned message type for those formats.
15798        impl<'__a> ::serde::Serialize for CreateTriggerResponseView<'__a> {
15799            fn serialize<__S: ::serde::Serializer>(
15800                &self,
15801                __s: __S,
15802            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15803                use ::serde::ser::SerializeMap as _;
15804                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15805                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
15806                    __map
15807                        .serialize_entry(
15808                            "triggerId",
15809                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
15810                        )?;
15811                }
15812                if !::buffa::json_helpers::skip_if::is_empty_str(
15813                    self.client_trigger_id,
15814                ) {
15815                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
15816                }
15817                {
15818                    if let ::core::option::Option::Some(__v) = self
15819                        .accepted_at
15820                        .as_option()
15821                    {
15822                        __map.serialize_entry("acceptedAt", __v)?;
15823                    }
15824                }
15825                if !::buffa::json_helpers::skip_if::is_zero_u64(
15826                    &self.accepted_at_ts_ns,
15827                ) {
15828                    __map
15829                        .serialize_entry(
15830                            "acceptedAtTsNs",
15831                            &::buffa::json_helpers::ProtoJson(&self.accepted_at_ts_ns),
15832                        )?;
15833                }
15834                __map.end()
15835            }
15836        }
15837        impl<'a> ::buffa::MessageName for CreateTriggerResponseView<'a> {
15838            const PACKAGE: &'static str = "triggers.v1";
15839            const NAME: &'static str = "CreateTriggerResponse";
15840            const FULL_NAME: &'static str = "triggers.v1.CreateTriggerResponse";
15841            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CreateTriggerResponse";
15842        }
15843        ::buffa::impl_default_view_instance!(CreateTriggerResponseView);
15844        ::buffa::impl_view_reborrow!(CreateTriggerResponseView);
15845        /** Self-contained, `'static` owned view of a `CreateTriggerResponse` message.
15846
15847 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.
15848
15849 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.*/
15850        #[derive(Clone, Debug)]
15851        pub struct CreateTriggerResponseOwnedView(
15852            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15853        );
15854        impl CreateTriggerResponseOwnedView {
15855            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15856            ///
15857            /// The view borrows directly from the buffer's data; the buffer is
15858            /// retained inside the returned handle.
15859            ///
15860            /// # Errors
15861            ///
15862            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15863            /// protobuf data.
15864            pub fn decode(
15865                bytes: ::buffa::bytes::Bytes,
15866            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15867                ::core::result::Result::Ok(
15868                    CreateTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
15869                )
15870            }
15871            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15872            /// max message size).
15873            ///
15874            /// # Errors
15875            ///
15876            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15877            /// exceeds the configured limits.
15878            pub fn decode_with_options(
15879                bytes: ::buffa::bytes::Bytes,
15880                opts: &::buffa::DecodeOptions,
15881            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15882                ::core::result::Result::Ok(
15883                    CreateTriggerResponseOwnedView(
15884                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15885                    ),
15886                )
15887            }
15888            /// Build from an owned message via an encode → decode round-trip.
15889            ///
15890            /// # Errors
15891            ///
15892            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15893            /// somehow invalid (should not happen for well-formed messages).
15894            pub fn from_owned(
15895                msg: &super::super::CreateTriggerResponse,
15896            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15897                ::core::result::Result::Ok(
15898                    CreateTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
15899                )
15900            }
15901            /// Borrow the full [`CreateTriggerResponseView`] with its lifetime tied to `&self`.
15902            #[must_use]
15903            pub fn view(&self) -> &CreateTriggerResponseView<'_> {
15904                self.0.reborrow()
15905            }
15906            /// Convert to the owned message type.
15907            ///
15908            /// # Errors
15909            ///
15910            /// Returns an error if re-materializing preserved unknown fields
15911            /// fails (e.g. the unknown-field limit is exceeded).
15912            pub fn to_owned_message(
15913                &self,
15914            ) -> ::core::result::Result<
15915                super::super::CreateTriggerResponse,
15916                ::buffa::DecodeError,
15917            > {
15918                self.0.to_owned_message()
15919            }
15920            /// The underlying bytes buffer.
15921            #[must_use]
15922            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15923                self.0.bytes()
15924            }
15925            /// Consume the handle, returning the underlying bytes buffer.
15926            #[must_use]
15927            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15928                self.0.into_bytes()
15929            }
15930            /// Assigned trigger ID.
15931            ///
15932            /// Field 1: `trigger_id`
15933            #[must_use]
15934            pub fn trigger_id(&self) -> u64 {
15935                self.0.reborrow().trigger_id
15936            }
15937            /// Echoed client trigger ID.
15938            ///
15939            /// Field 2: `client_trigger_id`
15940            #[must_use]
15941            pub fn client_trigger_id(&self) -> &'_ str {
15942                self.0.reborrow().client_trigger_id
15943            }
15944            /// Time creation admission completed.
15945            ///
15946            /// Field 3: `accepted_at`
15947            #[must_use]
15948            pub fn accepted_at(
15949                &self,
15950            ) -> &::buffa::MessageFieldView<
15951                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
15952            > {
15953                &self.0.reborrow().accepted_at
15954            }
15955            /// Admission completion time in nanoseconds since epoch (UTC).
15956            ///
15957            /// Field 4: `accepted_at_ts_ns`
15958            #[must_use]
15959            pub fn accepted_at_ts_ns(&self) -> u64 {
15960                self.0.reborrow().accepted_at_ts_ns
15961            }
15962        }
15963        impl ::core::convert::From<
15964            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15965        > for CreateTriggerResponseOwnedView {
15966            fn from(
15967                inner: ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15968            ) -> Self {
15969                CreateTriggerResponseOwnedView(inner)
15970            }
15971        }
15972        impl ::core::convert::From<CreateTriggerResponseOwnedView>
15973        for ::buffa::OwnedView<CreateTriggerResponseView<'static>> {
15974            fn from(wrapper: CreateTriggerResponseOwnedView) -> Self {
15975                wrapper.0
15976            }
15977        }
15978        impl ::core::convert::AsRef<
15979            ::buffa::OwnedView<CreateTriggerResponseView<'static>>,
15980        > for CreateTriggerResponseOwnedView {
15981            fn as_ref(&self) -> &::buffa::OwnedView<CreateTriggerResponseView<'static>> {
15982                &self.0
15983            }
15984        }
15985        impl ::buffa::HasMessageView for super::super::CreateTriggerResponse {
15986            type View<'a> = CreateTriggerResponseView<'a>;
15987            type ViewHandle = CreateTriggerResponseOwnedView;
15988        }
15989        impl ::serde::Serialize for CreateTriggerResponseOwnedView {
15990            fn serialize<__S: ::serde::Serializer>(
15991                &self,
15992                __s: __S,
15993            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15994                ::serde::Serialize::serialize(&self.0, __s)
15995            }
15996        }
15997        /// =============================================================================
15998        /// Get Trigger
15999        /// =============================================================================
16000        ///
16001        /// GetTriggerRequest retrieves one trigger by ID.
16002        #[derive(Clone, Debug, Default)]
16003        pub struct GetTriggerRequestView<'a> {
16004            /// Trigger ID to retrieve.
16005            ///
16006            /// Field 1: `trigger_id`
16007            pub trigger_id: u64,
16008            /// Optional sub-account for authorization.
16009            ///
16010            /// Field 2: `subaccount_id`
16011            pub subaccount_id: ::core::option::Option<u64>,
16012            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16013        }
16014        impl<'a> ::buffa::MessageView<'a> for GetTriggerRequestView<'a> {
16015            type Owned = super::super::GetTriggerRequest;
16016            fn decode_view(
16017                buf: &'a [u8],
16018            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16019                let __limit = ::core::cell::Cell::new(
16020                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16021                );
16022                <Self as ::buffa::MessageView>::decode_view_ctx(
16023                    buf,
16024                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16025                )
16026            }
16027            fn decode_view_with_ctx(
16028                buf: &'a [u8],
16029                ctx: ::buffa::DecodeContext<'_>,
16030            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16031                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16032            }
16033            fn merge_view_field(
16034                &mut self,
16035                tag: ::buffa::encoding::Tag,
16036                cur: &'a [u8],
16037                before_tag: &'a [u8],
16038                ctx: ::buffa::DecodeContext<'_>,
16039            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16040                let _ = ctx;
16041                #[allow(unused_variables)]
16042                let view = self;
16043                let mut cur = cur;
16044                match tag.field_number() {
16045                    1u32 => {
16046                        ::buffa::encoding::check_wire_type(
16047                            tag,
16048                            ::buffa::encoding::WireType::Fixed64,
16049                        )?;
16050                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
16051                    }
16052                    2u32 => {
16053                        ::buffa::encoding::check_wire_type(
16054                            tag,
16055                            ::buffa::encoding::WireType::Fixed64,
16056                        )?;
16057                        view.subaccount_id = Some(
16058                            ::buffa::types::decode_fixed64(&mut cur)?,
16059                        );
16060                    }
16061                    _ => {
16062                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16063                        let span_len = before_tag.len() - cur.len();
16064                        view.__buffa_unknown_fields
16065                            .push_record(before_tag, span_len, ctx)?;
16066                    }
16067                }
16068                ::core::result::Result::Ok(cur)
16069            }
16070            fn to_owned_message(
16071                &self,
16072            ) -> ::core::result::Result<
16073                super::super::GetTriggerRequest,
16074                ::buffa::DecodeError,
16075            > {
16076                self.to_owned_from_source(None)
16077            }
16078            #[allow(clippy::useless_conversion, clippy::needless_update)]
16079            fn to_owned_from_source(
16080                &self,
16081                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16082            ) -> ::core::result::Result<
16083                super::super::GetTriggerRequest,
16084                ::buffa::DecodeError,
16085            > {
16086                #[allow(unused_imports)]
16087                use ::buffa::alloc::string::ToString as _;
16088                let _ = __buffa_src;
16089                ::core::result::Result::Ok(super::super::GetTriggerRequest {
16090                    trigger_id: self.trigger_id,
16091                    subaccount_id: self.subaccount_id,
16092                    __buffa_unknown_fields: self
16093                        .__buffa_unknown_fields
16094                        .to_owned()?
16095                        .into(),
16096                    ..::core::default::Default::default()
16097                })
16098            }
16099        }
16100        impl<'a> ::buffa::ViewEncode<'a> for GetTriggerRequestView<'a> {
16101            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16102            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16103                #[allow(unused_imports)]
16104                use ::buffa::Enumeration as _;
16105                let mut size = 0u32;
16106                if self.trigger_id != 0u64 {
16107                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16108                }
16109                if self.subaccount_id.is_some() {
16110                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16111                }
16112                size += self.__buffa_unknown_fields.encoded_len() as u32;
16113                size
16114            }
16115            #[allow(clippy::needless_borrow)]
16116            fn write_to(
16117                &self,
16118                _cache: &mut ::buffa::SizeCache,
16119                buf: &mut impl ::buffa::bytes::BufMut,
16120            ) {
16121                #[allow(unused_imports)]
16122                use ::buffa::Enumeration as _;
16123                if self.trigger_id != 0u64 {
16124                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
16125                }
16126                if let Some(v) = self.subaccount_id {
16127                    ::buffa::types::put_fixed64_field(2u32, v, buf);
16128                }
16129                self.__buffa_unknown_fields.write_to(buf);
16130            }
16131        }
16132        /// Serializes this view as protobuf JSON.
16133        ///
16134        /// Implicit-presence fields with default values are omitted, `required`
16135        /// fields are always emitted, explicit-presence (`optional`) fields are
16136        /// emitted only when set, bytes fields are base64-encoded, and enum
16137        /// values are their proto name strings.
16138        ///
16139        /// This impl uses `serialize_map(None)` because the number of emitted
16140        /// fields depends on default-omission rules; serializers that require
16141        /// known map lengths (e.g. `bincode`) will return a runtime error.
16142        /// Use the owned message type for those formats.
16143        impl<'__a> ::serde::Serialize for GetTriggerRequestView<'__a> {
16144            fn serialize<__S: ::serde::Serializer>(
16145                &self,
16146                __s: __S,
16147            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16148                use ::serde::ser::SerializeMap as _;
16149                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16150                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
16151                    __map
16152                        .serialize_entry(
16153                            "triggerId",
16154                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
16155                        )?;
16156                }
16157                if let ::core::option::Option::Some(__v) = self.subaccount_id {
16158                    __map
16159                        .serialize_entry(
16160                            "subaccountId",
16161                            &::buffa::json_helpers::ProtoJson(&__v),
16162                        )?;
16163                }
16164                __map.end()
16165            }
16166        }
16167        impl<'a> ::buffa::MessageName for GetTriggerRequestView<'a> {
16168            const PACKAGE: &'static str = "triggers.v1";
16169            const NAME: &'static str = "GetTriggerRequest";
16170            const FULL_NAME: &'static str = "triggers.v1.GetTriggerRequest";
16171            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerRequest";
16172        }
16173        ::buffa::impl_default_view_instance!(GetTriggerRequestView);
16174        ::buffa::impl_view_reborrow!(GetTriggerRequestView);
16175        /** Self-contained, `'static` owned view of a `GetTriggerRequest` message.
16176
16177 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.
16178
16179 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.*/
16180        #[derive(Clone, Debug)]
16181        pub struct GetTriggerRequestOwnedView(
16182            ::buffa::OwnedView<GetTriggerRequestView<'static>>,
16183        );
16184        impl GetTriggerRequestOwnedView {
16185            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16186            ///
16187            /// The view borrows directly from the buffer's data; the buffer is
16188            /// retained inside the returned handle.
16189            ///
16190            /// # Errors
16191            ///
16192            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16193            /// protobuf data.
16194            pub fn decode(
16195                bytes: ::buffa::bytes::Bytes,
16196            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16197                ::core::result::Result::Ok(
16198                    GetTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
16199                )
16200            }
16201            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16202            /// max message size).
16203            ///
16204            /// # Errors
16205            ///
16206            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16207            /// exceeds the configured limits.
16208            pub fn decode_with_options(
16209                bytes: ::buffa::bytes::Bytes,
16210                opts: &::buffa::DecodeOptions,
16211            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16212                ::core::result::Result::Ok(
16213                    GetTriggerRequestOwnedView(
16214                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16215                    ),
16216                )
16217            }
16218            /// Build from an owned message via an encode → decode round-trip.
16219            ///
16220            /// # Errors
16221            ///
16222            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16223            /// somehow invalid (should not happen for well-formed messages).
16224            pub fn from_owned(
16225                msg: &super::super::GetTriggerRequest,
16226            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16227                ::core::result::Result::Ok(
16228                    GetTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
16229                )
16230            }
16231            /// Borrow the full [`GetTriggerRequestView`] with its lifetime tied to `&self`.
16232            #[must_use]
16233            pub fn view(&self) -> &GetTriggerRequestView<'_> {
16234                self.0.reborrow()
16235            }
16236            /// Convert to the owned message type.
16237            ///
16238            /// # Errors
16239            ///
16240            /// Returns an error if re-materializing preserved unknown fields
16241            /// fails (e.g. the unknown-field limit is exceeded).
16242            pub fn to_owned_message(
16243                &self,
16244            ) -> ::core::result::Result<
16245                super::super::GetTriggerRequest,
16246                ::buffa::DecodeError,
16247            > {
16248                self.0.to_owned_message()
16249            }
16250            /// The underlying bytes buffer.
16251            #[must_use]
16252            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16253                self.0.bytes()
16254            }
16255            /// Consume the handle, returning the underlying bytes buffer.
16256            #[must_use]
16257            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16258                self.0.into_bytes()
16259            }
16260            /// Trigger ID to retrieve.
16261            ///
16262            /// Field 1: `trigger_id`
16263            #[must_use]
16264            pub fn trigger_id(&self) -> u64 {
16265                self.0.reborrow().trigger_id
16266            }
16267            /// Optional sub-account for authorization.
16268            ///
16269            /// Field 2: `subaccount_id`
16270            #[must_use]
16271            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
16272                self.0.reborrow().subaccount_id
16273            }
16274        }
16275        impl ::core::convert::From<::buffa::OwnedView<GetTriggerRequestView<'static>>>
16276        for GetTriggerRequestOwnedView {
16277            fn from(inner: ::buffa::OwnedView<GetTriggerRequestView<'static>>) -> Self {
16278                GetTriggerRequestOwnedView(inner)
16279            }
16280        }
16281        impl ::core::convert::From<GetTriggerRequestOwnedView>
16282        for ::buffa::OwnedView<GetTriggerRequestView<'static>> {
16283            fn from(wrapper: GetTriggerRequestOwnedView) -> Self {
16284                wrapper.0
16285            }
16286        }
16287        impl ::core::convert::AsRef<::buffa::OwnedView<GetTriggerRequestView<'static>>>
16288        for GetTriggerRequestOwnedView {
16289            fn as_ref(&self) -> &::buffa::OwnedView<GetTriggerRequestView<'static>> {
16290                &self.0
16291            }
16292        }
16293        impl ::buffa::HasMessageView for super::super::GetTriggerRequest {
16294            type View<'a> = GetTriggerRequestView<'a>;
16295            type ViewHandle = GetTriggerRequestOwnedView;
16296        }
16297        impl ::serde::Serialize for GetTriggerRequestOwnedView {
16298            fn serialize<__S: ::serde::Serializer>(
16299                &self,
16300                __s: __S,
16301            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16302                ::serde::Serialize::serialize(&self.0, __s)
16303            }
16304        }
16305        /// GetTriggerResponse returns the requested trigger.
16306        #[derive(Clone, Debug, Default)]
16307        pub struct GetTriggerResponseView<'a> {
16308            /// Trigger state and configuration.
16309            ///
16310            /// Field 1: `trigger`
16311            pub trigger: ::buffa::MessageFieldView<
16312                super::super::__buffa::view::TriggerView<'a>,
16313            >,
16314            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16315        }
16316        impl<'a> ::buffa::MessageView<'a> for GetTriggerResponseView<'a> {
16317            type Owned = super::super::GetTriggerResponse;
16318            fn decode_view(
16319                buf: &'a [u8],
16320            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16321                let __limit = ::core::cell::Cell::new(
16322                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16323                );
16324                <Self as ::buffa::MessageView>::decode_view_ctx(
16325                    buf,
16326                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16327                )
16328            }
16329            fn decode_view_with_ctx(
16330                buf: &'a [u8],
16331                ctx: ::buffa::DecodeContext<'_>,
16332            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16333                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16334            }
16335            fn merge_view_field(
16336                &mut self,
16337                tag: ::buffa::encoding::Tag,
16338                cur: &'a [u8],
16339                before_tag: &'a [u8],
16340                ctx: ::buffa::DecodeContext<'_>,
16341            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16342                let _ = ctx;
16343                #[allow(unused_variables)]
16344                let view = self;
16345                let mut cur = cur;
16346                match tag.field_number() {
16347                    1u32 => {
16348                        ::buffa::encoding::check_wire_type(
16349                            tag,
16350                            ::buffa::encoding::WireType::LengthDelimited,
16351                        )?;
16352                        let __sub_ctx = ctx.descend()?;
16353                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
16354                        match view.trigger.as_mut() {
16355                            Some(existing) => {
16356                                ::buffa::MessageView::merge_into_view(
16357                                    existing,
16358                                    sub,
16359                                    __sub_ctx,
16360                                )?
16361                            }
16362                            None => {
16363                                view.trigger = ::buffa::MessageFieldView::set(
16364                                    <super::super::__buffa::view::TriggerView as ::buffa::MessageView>::decode_view_ctx(
16365                                        sub,
16366                                        __sub_ctx,
16367                                    )?,
16368                                );
16369                            }
16370                        }
16371                    }
16372                    _ => {
16373                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16374                        let span_len = before_tag.len() - cur.len();
16375                        view.__buffa_unknown_fields
16376                            .push_record(before_tag, span_len, ctx)?;
16377                    }
16378                }
16379                ::core::result::Result::Ok(cur)
16380            }
16381            fn to_owned_message(
16382                &self,
16383            ) -> ::core::result::Result<
16384                super::super::GetTriggerResponse,
16385                ::buffa::DecodeError,
16386            > {
16387                self.to_owned_from_source(None)
16388            }
16389            #[allow(clippy::useless_conversion, clippy::needless_update)]
16390            fn to_owned_from_source(
16391                &self,
16392                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16393            ) -> ::core::result::Result<
16394                super::super::GetTriggerResponse,
16395                ::buffa::DecodeError,
16396            > {
16397                #[allow(unused_imports)]
16398                use ::buffa::alloc::string::ToString as _;
16399                let _ = __buffa_src;
16400                ::core::result::Result::Ok(super::super::GetTriggerResponse {
16401                    trigger: match self.trigger.as_option() {
16402                        Some(v) => {
16403                            ::buffa::MessageField::<
16404                                super::super::Trigger,
16405                            >::some(v.to_owned_from_source(__buffa_src)?)
16406                        }
16407                        None => ::buffa::MessageField::none(),
16408                    },
16409                    __buffa_unknown_fields: self
16410                        .__buffa_unknown_fields
16411                        .to_owned()?
16412                        .into(),
16413                    ..::core::default::Default::default()
16414                })
16415            }
16416        }
16417        impl<'a> ::buffa::ViewEncode<'a> for GetTriggerResponseView<'a> {
16418            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16419            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
16420                #[allow(unused_imports)]
16421                use ::buffa::Enumeration as _;
16422                let mut size = 0u32;
16423                if self.trigger.is_set() {
16424                    let __slot = __cache.reserve();
16425                    let inner_size = self.trigger.compute_size(__cache);
16426                    __cache.set(__slot, inner_size);
16427                    size
16428                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
16429                            + inner_size;
16430                }
16431                size += self.__buffa_unknown_fields.encoded_len() as u32;
16432                size
16433            }
16434            #[allow(clippy::needless_borrow)]
16435            fn write_to(
16436                &self,
16437                __cache: &mut ::buffa::SizeCache,
16438                buf: &mut impl ::buffa::bytes::BufMut,
16439            ) {
16440                #[allow(unused_imports)]
16441                use ::buffa::Enumeration as _;
16442                if self.trigger.is_set() {
16443                    ::buffa::types::put_len_delimited_header(
16444                        1u32,
16445                        __cache.consume_next(),
16446                        buf,
16447                    );
16448                    self.trigger.write_to(__cache, buf);
16449                }
16450                self.__buffa_unknown_fields.write_to(buf);
16451            }
16452        }
16453        /// Serializes this view as protobuf JSON.
16454        ///
16455        /// Implicit-presence fields with default values are omitted, `required`
16456        /// fields are always emitted, explicit-presence (`optional`) fields are
16457        /// emitted only when set, bytes fields are base64-encoded, and enum
16458        /// values are their proto name strings.
16459        ///
16460        /// This impl uses `serialize_map(None)` because the number of emitted
16461        /// fields depends on default-omission rules; serializers that require
16462        /// known map lengths (e.g. `bincode`) will return a runtime error.
16463        /// Use the owned message type for those formats.
16464        impl<'__a> ::serde::Serialize for GetTriggerResponseView<'__a> {
16465            fn serialize<__S: ::serde::Serializer>(
16466                &self,
16467                __s: __S,
16468            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16469                use ::serde::ser::SerializeMap as _;
16470                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16471                {
16472                    if let ::core::option::Option::Some(__v) = self.trigger.as_option() {
16473                        __map.serialize_entry("trigger", __v)?;
16474                    }
16475                }
16476                __map.end()
16477            }
16478        }
16479        impl<'a> ::buffa::MessageName for GetTriggerResponseView<'a> {
16480            const PACKAGE: &'static str = "triggers.v1";
16481            const NAME: &'static str = "GetTriggerResponse";
16482            const FULL_NAME: &'static str = "triggers.v1.GetTriggerResponse";
16483            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.GetTriggerResponse";
16484        }
16485        ::buffa::impl_default_view_instance!(GetTriggerResponseView);
16486        ::buffa::impl_view_reborrow!(GetTriggerResponseView);
16487        /** Self-contained, `'static` owned view of a `GetTriggerResponse` message.
16488
16489 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.
16490
16491 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.*/
16492        #[derive(Clone, Debug)]
16493        pub struct GetTriggerResponseOwnedView(
16494            ::buffa::OwnedView<GetTriggerResponseView<'static>>,
16495        );
16496        impl GetTriggerResponseOwnedView {
16497            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16498            ///
16499            /// The view borrows directly from the buffer's data; the buffer is
16500            /// retained inside the returned handle.
16501            ///
16502            /// # Errors
16503            ///
16504            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16505            /// protobuf data.
16506            pub fn decode(
16507                bytes: ::buffa::bytes::Bytes,
16508            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16509                ::core::result::Result::Ok(
16510                    GetTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
16511                )
16512            }
16513            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16514            /// max message size).
16515            ///
16516            /// # Errors
16517            ///
16518            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16519            /// exceeds the configured limits.
16520            pub fn decode_with_options(
16521                bytes: ::buffa::bytes::Bytes,
16522                opts: &::buffa::DecodeOptions,
16523            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16524                ::core::result::Result::Ok(
16525                    GetTriggerResponseOwnedView(
16526                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16527                    ),
16528                )
16529            }
16530            /// Build from an owned message via an encode → decode round-trip.
16531            ///
16532            /// # Errors
16533            ///
16534            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16535            /// somehow invalid (should not happen for well-formed messages).
16536            pub fn from_owned(
16537                msg: &super::super::GetTriggerResponse,
16538            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16539                ::core::result::Result::Ok(
16540                    GetTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
16541                )
16542            }
16543            /// Borrow the full [`GetTriggerResponseView`] with its lifetime tied to `&self`.
16544            #[must_use]
16545            pub fn view(&self) -> &GetTriggerResponseView<'_> {
16546                self.0.reborrow()
16547            }
16548            /// Convert to the owned message type.
16549            ///
16550            /// # Errors
16551            ///
16552            /// Returns an error if re-materializing preserved unknown fields
16553            /// fails (e.g. the unknown-field limit is exceeded).
16554            pub fn to_owned_message(
16555                &self,
16556            ) -> ::core::result::Result<
16557                super::super::GetTriggerResponse,
16558                ::buffa::DecodeError,
16559            > {
16560                self.0.to_owned_message()
16561            }
16562            /// The underlying bytes buffer.
16563            #[must_use]
16564            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16565                self.0.bytes()
16566            }
16567            /// Consume the handle, returning the underlying bytes buffer.
16568            #[must_use]
16569            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16570                self.0.into_bytes()
16571            }
16572            /// Trigger state and configuration.
16573            ///
16574            /// Field 1: `trigger`
16575            #[must_use]
16576            pub fn trigger(
16577                &self,
16578            ) -> &::buffa::MessageFieldView<
16579                super::super::__buffa::view::TriggerView<'_>,
16580            > {
16581                &self.0.reborrow().trigger
16582            }
16583        }
16584        impl ::core::convert::From<::buffa::OwnedView<GetTriggerResponseView<'static>>>
16585        for GetTriggerResponseOwnedView {
16586            fn from(inner: ::buffa::OwnedView<GetTriggerResponseView<'static>>) -> Self {
16587                GetTriggerResponseOwnedView(inner)
16588            }
16589        }
16590        impl ::core::convert::From<GetTriggerResponseOwnedView>
16591        for ::buffa::OwnedView<GetTriggerResponseView<'static>> {
16592            fn from(wrapper: GetTriggerResponseOwnedView) -> Self {
16593                wrapper.0
16594            }
16595        }
16596        impl ::core::convert::AsRef<::buffa::OwnedView<GetTriggerResponseView<'static>>>
16597        for GetTriggerResponseOwnedView {
16598            fn as_ref(&self) -> &::buffa::OwnedView<GetTriggerResponseView<'static>> {
16599                &self.0
16600            }
16601        }
16602        impl ::buffa::HasMessageView for super::super::GetTriggerResponse {
16603            type View<'a> = GetTriggerResponseView<'a>;
16604            type ViewHandle = GetTriggerResponseOwnedView;
16605        }
16606        impl ::serde::Serialize for GetTriggerResponseOwnedView {
16607            fn serialize<__S: ::serde::Serializer>(
16608                &self,
16609                __s: __S,
16610            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16611                ::serde::Serialize::serialize(&self.0, __s)
16612            }
16613        }
16614        /// =============================================================================
16615        /// List Triggers
16616        /// =============================================================================
16617        ///
16618        /// ListTriggersRequest lists triggers for an account.
16619        #[derive(Clone, Debug, Default)]
16620        pub struct ListTriggersRequestView<'a> {
16621            /// Optional sub-account to list triggers for. When empty or omitted, uses the
16622            /// caller's root account.
16623            ///
16624            /// Field 1: `subaccount_id`
16625            pub subaccount_id: ::core::option::Option<u64>,
16626            /// Optional filter by symbol.
16627            ///
16628            /// Field 2: `symbol`
16629            pub symbol: &'a str,
16630            /// Optional filter by status (can specify multiple).
16631            ///
16632            /// Field 3: `status`
16633            pub status: ::buffa::RepeatedView<
16634                'a,
16635                ::buffa::EnumValue<super::super::TriggerStatus>,
16636            >,
16637            /// Optional filter by type.
16638            ///
16639            /// Field 4: `trigger_type`
16640            pub trigger_type: ::buffa::EnumValue<super::super::TriggerType>,
16641            /// Optional filter by attached parent order ID.
16642            ///
16643            /// Field 5: `parent_order_id`
16644            pub parent_order_id: ::core::option::Option<u64>,
16645            /// Maximum number of triggers to return. Defaults to 100 when omitted;
16646            /// maximum is 1000.
16647            ///
16648            /// Field 10: `limit`
16649            pub limit: u32,
16650            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
16651            /// bound to the authenticated account, sub-account scope, filters, and newest
16652            /// first sort order.
16653            ///
16654            /// Field 12: `page_token`
16655            pub page_token: &'a str,
16656            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16657        }
16658        impl<'a> ::buffa::MessageView<'a> for ListTriggersRequestView<'a> {
16659            type Owned = super::super::ListTriggersRequest;
16660            fn decode_view(
16661                buf: &'a [u8],
16662            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16663                let __limit = ::core::cell::Cell::new(
16664                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16665                );
16666                <Self as ::buffa::MessageView>::decode_view_ctx(
16667                    buf,
16668                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16669                )
16670            }
16671            fn decode_view_with_ctx(
16672                buf: &'a [u8],
16673                ctx: ::buffa::DecodeContext<'_>,
16674            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16675                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16676            }
16677            fn merge_view_field(
16678                &mut self,
16679                tag: ::buffa::encoding::Tag,
16680                cur: &'a [u8],
16681                before_tag: &'a [u8],
16682                ctx: ::buffa::DecodeContext<'_>,
16683            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16684                let _ = ctx;
16685                #[allow(unused_variables)]
16686                let view = self;
16687                let mut cur = cur;
16688                match tag.field_number() {
16689                    1u32 => {
16690                        ::buffa::encoding::check_wire_type(
16691                            tag,
16692                            ::buffa::encoding::WireType::Fixed64,
16693                        )?;
16694                        view.subaccount_id = Some(
16695                            ::buffa::types::decode_fixed64(&mut cur)?,
16696                        );
16697                    }
16698                    2u32 => {
16699                        ::buffa::encoding::check_wire_type(
16700                            tag,
16701                            ::buffa::encoding::WireType::LengthDelimited,
16702                        )?;
16703                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
16704                    }
16705                    4u32 => {
16706                        ::buffa::encoding::check_wire_type(
16707                            tag,
16708                            ::buffa::encoding::WireType::Varint,
16709                        )?;
16710                        view.trigger_type = ::buffa::EnumValue::from(
16711                            ::buffa::types::decode_int32(&mut cur)?,
16712                        );
16713                    }
16714                    5u32 => {
16715                        ::buffa::encoding::check_wire_type(
16716                            tag,
16717                            ::buffa::encoding::WireType::Fixed64,
16718                        )?;
16719                        view.parent_order_id = Some(
16720                            ::buffa::types::decode_fixed64(&mut cur)?,
16721                        );
16722                    }
16723                    10u32 => {
16724                        ::buffa::encoding::check_wire_type(
16725                            tag,
16726                            ::buffa::encoding::WireType::Varint,
16727                        )?;
16728                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
16729                    }
16730                    12u32 => {
16731                        ::buffa::encoding::check_wire_type(
16732                            tag,
16733                            ::buffa::encoding::WireType::LengthDelimited,
16734                        )?;
16735                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
16736                    }
16737                    3u32 => {
16738                        if tag.wire_type()
16739                            == ::buffa::encoding::WireType::LengthDelimited
16740                        {
16741                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16742                            view.status
16743                                .reserve(::buffa::encoding::count_varints(payload));
16744                            let mut pcur: &[u8] = payload;
16745                            while !pcur.is_empty() {
16746                                view.status
16747                                    .push(
16748                                        ::buffa::EnumValue::from(
16749                                            ::buffa::types::decode_int32(&mut pcur)?,
16750                                        ),
16751                                    );
16752                            }
16753                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16754                        {
16755                            view.status
16756                                .push(
16757                                    ::buffa::EnumValue::from(
16758                                        ::buffa::types::decode_int32(&mut cur)?,
16759                                    ),
16760                                );
16761                        } else {
16762                            return Err(
16763                                ::buffa::encoding::wire_type_mismatch(
16764                                    tag,
16765                                    ::buffa::encoding::WireType::LengthDelimited,
16766                                ),
16767                            );
16768                        }
16769                    }
16770                    _ => {
16771                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16772                        let span_len = before_tag.len() - cur.len();
16773                        view.__buffa_unknown_fields
16774                            .push_record(before_tag, span_len, ctx)?;
16775                    }
16776                }
16777                ::core::result::Result::Ok(cur)
16778            }
16779            fn to_owned_message(
16780                &self,
16781            ) -> ::core::result::Result<
16782                super::super::ListTriggersRequest,
16783                ::buffa::DecodeError,
16784            > {
16785                self.to_owned_from_source(None)
16786            }
16787            #[allow(clippy::useless_conversion, clippy::needless_update)]
16788            fn to_owned_from_source(
16789                &self,
16790                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16791            ) -> ::core::result::Result<
16792                super::super::ListTriggersRequest,
16793                ::buffa::DecodeError,
16794            > {
16795                #[allow(unused_imports)]
16796                use ::buffa::alloc::string::ToString as _;
16797                let _ = __buffa_src;
16798                ::core::result::Result::Ok(super::super::ListTriggersRequest {
16799                    subaccount_id: self.subaccount_id,
16800                    symbol: self.symbol.to_string(),
16801                    status: self.status.to_vec(),
16802                    trigger_type: self.trigger_type,
16803                    parent_order_id: self.parent_order_id,
16804                    limit: self.limit,
16805                    page_token: self.page_token.to_string(),
16806                    __buffa_unknown_fields: self
16807                        .__buffa_unknown_fields
16808                        .to_owned()?
16809                        .into(),
16810                    ..::core::default::Default::default()
16811                })
16812            }
16813        }
16814        impl<'a> ::buffa::ViewEncode<'a> for ListTriggersRequestView<'a> {
16815            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16816            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16817                #[allow(unused_imports)]
16818                use ::buffa::Enumeration as _;
16819                let mut size = 0u32;
16820                if self.subaccount_id.is_some() {
16821                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16822                }
16823                if !self.symbol.is_empty() {
16824                    size
16825                        += 1u32
16826                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
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                    size
16835                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16836                            + payload;
16837                }
16838                {
16839                    let val = self.trigger_type.to_i32();
16840                    if val != 0 {
16841                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
16842                    }
16843                }
16844                if self.parent_order_id.is_some() {
16845                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
16846                }
16847                if self.limit != 0u32 {
16848                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
16849                }
16850                if !self.page_token.is_empty() {
16851                    size
16852                        += 1u32
16853                            + ::buffa::types::string_encoded_len(&self.page_token)
16854                                as u32;
16855                }
16856                size += self.__buffa_unknown_fields.encoded_len() as u32;
16857                size
16858            }
16859            #[allow(clippy::needless_borrow)]
16860            fn write_to(
16861                &self,
16862                _cache: &mut ::buffa::SizeCache,
16863                buf: &mut impl ::buffa::bytes::BufMut,
16864            ) {
16865                #[allow(unused_imports)]
16866                use ::buffa::Enumeration as _;
16867                if let Some(v) = self.subaccount_id {
16868                    ::buffa::types::put_fixed64_field(1u32, v, buf);
16869                }
16870                if !self.symbol.is_empty() {
16871                    ::buffa::types::put_string_field(2u32, &self.symbol, buf);
16872                }
16873                if !self.status.is_empty() {
16874                    let payload: u32 = self
16875                        .status
16876                        .iter()
16877                        .map(|v| ::buffa::types::int32_encoded_len(v.to_i32()) as u32)
16878                        .sum::<u32>();
16879                    ::buffa::types::put_len_delimited_header(3u32, payload, buf);
16880                    for v in &self.status {
16881                        ::buffa::types::encode_int32(v.to_i32(), buf);
16882                    }
16883                }
16884                {
16885                    let val = self.trigger_type.to_i32();
16886                    if val != 0 {
16887                        ::buffa::types::put_int32_field(4u32, val, buf);
16888                    }
16889                }
16890                if let Some(v) = self.parent_order_id {
16891                    ::buffa::types::put_fixed64_field(5u32, v, buf);
16892                }
16893                if self.limit != 0u32 {
16894                    ::buffa::types::put_uint32_field(10u32, self.limit, buf);
16895                }
16896                if !self.page_token.is_empty() {
16897                    ::buffa::types::put_string_field(12u32, &self.page_token, buf);
16898                }
16899                self.__buffa_unknown_fields.write_to(buf);
16900            }
16901        }
16902        /// Serializes this view as protobuf JSON.
16903        ///
16904        /// Implicit-presence fields with default values are omitted, `required`
16905        /// fields are always emitted, explicit-presence (`optional`) fields are
16906        /// emitted only when set, bytes fields are base64-encoded, and enum
16907        /// values are their proto name strings.
16908        ///
16909        /// This impl uses `serialize_map(None)` because the number of emitted
16910        /// fields depends on default-omission rules; serializers that require
16911        /// known map lengths (e.g. `bincode`) will return a runtime error.
16912        /// Use the owned message type for those formats.
16913        impl<'__a> ::serde::Serialize for ListTriggersRequestView<'__a> {
16914            fn serialize<__S: ::serde::Serializer>(
16915                &self,
16916                __s: __S,
16917            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16918                use ::serde::ser::SerializeMap as _;
16919                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16920                if let ::core::option::Option::Some(__v) = self.subaccount_id {
16921                    __map
16922                        .serialize_entry(
16923                            "subaccountId",
16924                            &::buffa::json_helpers::ProtoJson(&__v),
16925                        )?;
16926                }
16927                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
16928                    __map.serialize_entry("symbol", self.symbol)?;
16929                }
16930                if !self.status.is_empty() {
16931                    __map
16932                        .serialize_entry(
16933                            "status",
16934                            &::buffa::json_helpers::EnumSeqJson(&self.status),
16935                        )?;
16936                }
16937                if !::buffa::json_helpers::skip_if::is_default_enum_value(
16938                    &self.trigger_type,
16939                ) {
16940                    __map.serialize_entry("triggerType", &self.trigger_type)?;
16941                }
16942                if let ::core::option::Option::Some(__v) = self.parent_order_id {
16943                    __map
16944                        .serialize_entry(
16945                            "parentOrderId",
16946                            &::buffa::json_helpers::ProtoJson(&__v),
16947                        )?;
16948                }
16949                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
16950                    __map
16951                        .serialize_entry(
16952                            "limit",
16953                            &::buffa::json_helpers::ProtoJson(&self.limit),
16954                        )?;
16955                }
16956                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
16957                    __map.serialize_entry("pageToken", self.page_token)?;
16958                }
16959                __map.end()
16960            }
16961        }
16962        impl<'a> ::buffa::MessageName for ListTriggersRequestView<'a> {
16963            const PACKAGE: &'static str = "triggers.v1";
16964            const NAME: &'static str = "ListTriggersRequest";
16965            const FULL_NAME: &'static str = "triggers.v1.ListTriggersRequest";
16966            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersRequest";
16967        }
16968        ::buffa::impl_default_view_instance!(ListTriggersRequestView);
16969        ::buffa::impl_view_reborrow!(ListTriggersRequestView);
16970        /** Self-contained, `'static` owned view of a `ListTriggersRequest` message.
16971
16972 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.
16973
16974 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.*/
16975        #[derive(Clone, Debug)]
16976        pub struct ListTriggersRequestOwnedView(
16977            ::buffa::OwnedView<ListTriggersRequestView<'static>>,
16978        );
16979        impl ListTriggersRequestOwnedView {
16980            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
16981            ///
16982            /// The view borrows directly from the buffer's data; the buffer is
16983            /// retained inside the returned handle.
16984            ///
16985            /// # Errors
16986            ///
16987            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16988            /// protobuf data.
16989            pub fn decode(
16990                bytes: ::buffa::bytes::Bytes,
16991            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16992                ::core::result::Result::Ok(
16993                    ListTriggersRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
16994                )
16995            }
16996            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16997            /// max message size).
16998            ///
16999            /// # Errors
17000            ///
17001            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17002            /// exceeds the configured limits.
17003            pub fn decode_with_options(
17004                bytes: ::buffa::bytes::Bytes,
17005                opts: &::buffa::DecodeOptions,
17006            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17007                ::core::result::Result::Ok(
17008                    ListTriggersRequestOwnedView(
17009                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17010                    ),
17011                )
17012            }
17013            /// Build from an owned message via an encode → decode round-trip.
17014            ///
17015            /// # Errors
17016            ///
17017            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17018            /// somehow invalid (should not happen for well-formed messages).
17019            pub fn from_owned(
17020                msg: &super::super::ListTriggersRequest,
17021            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17022                ::core::result::Result::Ok(
17023                    ListTriggersRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
17024                )
17025            }
17026            /// Borrow the full [`ListTriggersRequestView`] with its lifetime tied to `&self`.
17027            #[must_use]
17028            pub fn view(&self) -> &ListTriggersRequestView<'_> {
17029                self.0.reborrow()
17030            }
17031            /// Convert to the owned message type.
17032            ///
17033            /// # Errors
17034            ///
17035            /// Returns an error if re-materializing preserved unknown fields
17036            /// fails (e.g. the unknown-field limit is exceeded).
17037            pub fn to_owned_message(
17038                &self,
17039            ) -> ::core::result::Result<
17040                super::super::ListTriggersRequest,
17041                ::buffa::DecodeError,
17042            > {
17043                self.0.to_owned_message()
17044            }
17045            /// The underlying bytes buffer.
17046            #[must_use]
17047            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17048                self.0.bytes()
17049            }
17050            /// Consume the handle, returning the underlying bytes buffer.
17051            #[must_use]
17052            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17053                self.0.into_bytes()
17054            }
17055            /// Optional sub-account to list triggers for. When empty or omitted, uses the
17056            /// caller's root account.
17057            ///
17058            /// Field 1: `subaccount_id`
17059            #[must_use]
17060            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
17061                self.0.reborrow().subaccount_id
17062            }
17063            /// Optional filter by symbol.
17064            ///
17065            /// Field 2: `symbol`
17066            #[must_use]
17067            pub fn symbol(&self) -> &'_ str {
17068                self.0.reborrow().symbol
17069            }
17070            /// Optional filter by status (can specify multiple).
17071            ///
17072            /// Field 3: `status`
17073            #[must_use]
17074            pub fn status(
17075                &self,
17076            ) -> &::buffa::RepeatedView<
17077                '_,
17078                ::buffa::EnumValue<super::super::TriggerStatus>,
17079            > {
17080                &self.0.reborrow().status
17081            }
17082            /// Optional filter by type.
17083            ///
17084            /// Field 4: `trigger_type`
17085            #[must_use]
17086            pub fn trigger_type(&self) -> ::buffa::EnumValue<super::super::TriggerType> {
17087                self.0.reborrow().trigger_type
17088            }
17089            /// Optional filter by attached parent order ID.
17090            ///
17091            /// Field 5: `parent_order_id`
17092            #[must_use]
17093            pub fn parent_order_id(&self) -> ::core::option::Option<u64> {
17094                self.0.reborrow().parent_order_id
17095            }
17096            /// Maximum number of triggers to return. Defaults to 100 when omitted;
17097            /// maximum is 1000.
17098            ///
17099            /// Field 10: `limit`
17100            #[must_use]
17101            pub fn limit(&self) -> u32 {
17102                self.0.reborrow().limit
17103            }
17104            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17105            /// bound to the authenticated account, sub-account scope, filters, and newest
17106            /// first sort order.
17107            ///
17108            /// Field 12: `page_token`
17109            #[must_use]
17110            pub fn page_token(&self) -> &'_ str {
17111                self.0.reborrow().page_token
17112            }
17113        }
17114        impl ::core::convert::From<::buffa::OwnedView<ListTriggersRequestView<'static>>>
17115        for ListTriggersRequestOwnedView {
17116            fn from(
17117                inner: ::buffa::OwnedView<ListTriggersRequestView<'static>>,
17118            ) -> Self {
17119                ListTriggersRequestOwnedView(inner)
17120            }
17121        }
17122        impl ::core::convert::From<ListTriggersRequestOwnedView>
17123        for ::buffa::OwnedView<ListTriggersRequestView<'static>> {
17124            fn from(wrapper: ListTriggersRequestOwnedView) -> Self {
17125                wrapper.0
17126            }
17127        }
17128        impl ::core::convert::AsRef<::buffa::OwnedView<ListTriggersRequestView<'static>>>
17129        for ListTriggersRequestOwnedView {
17130            fn as_ref(&self) -> &::buffa::OwnedView<ListTriggersRequestView<'static>> {
17131                &self.0
17132            }
17133        }
17134        impl ::buffa::HasMessageView for super::super::ListTriggersRequest {
17135            type View<'a> = ListTriggersRequestView<'a>;
17136            type ViewHandle = ListTriggersRequestOwnedView;
17137        }
17138        impl ::serde::Serialize for ListTriggersRequestOwnedView {
17139            fn serialize<__S: ::serde::Serializer>(
17140                &self,
17141                __s: __S,
17142            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17143                ::serde::Serialize::serialize(&self.0, __s)
17144            }
17145        }
17146        /// ListTriggersResponse returns triggers ordered newest-first.
17147        #[derive(Clone, Debug, Default)]
17148        pub struct ListTriggersResponseView<'a> {
17149            /// Triggers ordered by creation time descending, then trigger ID descending.
17150            ///
17151            /// Field 1: `triggers`
17152            pub triggers: ::buffa::RepeatedView<
17153                'a,
17154                super::super::__buffa::view::TriggerView<'a>,
17155            >,
17156            /// Opaque cursor for the next page. Empty when no more results exist.
17157            ///
17158            /// Field 3: `next_page_token`
17159            pub next_page_token: &'a str,
17160            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17161        }
17162        impl<'a> ::buffa::MessageView<'a> for ListTriggersResponseView<'a> {
17163            type Owned = super::super::ListTriggersResponse;
17164            fn decode_view(
17165                buf: &'a [u8],
17166            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17167                let __limit = ::core::cell::Cell::new(
17168                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17169                );
17170                <Self as ::buffa::MessageView>::decode_view_ctx(
17171                    buf,
17172                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17173                )
17174            }
17175            fn decode_view_with_ctx(
17176                buf: &'a [u8],
17177                ctx: ::buffa::DecodeContext<'_>,
17178            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17179                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17180            }
17181            fn merge_view_field(
17182                &mut self,
17183                tag: ::buffa::encoding::Tag,
17184                cur: &'a [u8],
17185                before_tag: &'a [u8],
17186                ctx: ::buffa::DecodeContext<'_>,
17187            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17188                let _ = ctx;
17189                #[allow(unused_variables)]
17190                let view = self;
17191                let mut cur = cur;
17192                match tag.field_number() {
17193                    3u32 => {
17194                        ::buffa::encoding::check_wire_type(
17195                            tag,
17196                            ::buffa::encoding::WireType::LengthDelimited,
17197                        )?;
17198                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
17199                    }
17200                    1u32 => {
17201                        ::buffa::encoding::check_wire_type(
17202                            tag,
17203                            ::buffa::encoding::WireType::LengthDelimited,
17204                        )?;
17205                        let __sub_ctx = ctx.descend()?;
17206                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
17207                        view.triggers
17208                            .push(
17209                                <super::super::__buffa::view::TriggerView as ::buffa::MessageView>::decode_view_ctx(
17210                                    sub,
17211                                    __sub_ctx,
17212                                )?,
17213                            );
17214                    }
17215                    _ => {
17216                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17217                        let span_len = before_tag.len() - cur.len();
17218                        view.__buffa_unknown_fields
17219                            .push_record(before_tag, span_len, ctx)?;
17220                    }
17221                }
17222                ::core::result::Result::Ok(cur)
17223            }
17224            fn to_owned_message(
17225                &self,
17226            ) -> ::core::result::Result<
17227                super::super::ListTriggersResponse,
17228                ::buffa::DecodeError,
17229            > {
17230                self.to_owned_from_source(None)
17231            }
17232            #[allow(clippy::useless_conversion, clippy::needless_update)]
17233            fn to_owned_from_source(
17234                &self,
17235                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17236            ) -> ::core::result::Result<
17237                super::super::ListTriggersResponse,
17238                ::buffa::DecodeError,
17239            > {
17240                #[allow(unused_imports)]
17241                use ::buffa::alloc::string::ToString as _;
17242                let _ = __buffa_src;
17243                ::core::result::Result::Ok(super::super::ListTriggersResponse {
17244                    triggers: self
17245                        .triggers
17246                        .iter()
17247                        .map(|v| v.to_owned_from_source(__buffa_src))
17248                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
17249                    next_page_token: self.next_page_token.to_string(),
17250                    __buffa_unknown_fields: self
17251                        .__buffa_unknown_fields
17252                        .to_owned()?
17253                        .into(),
17254                    ..::core::default::Default::default()
17255                })
17256            }
17257        }
17258        impl<'a> ::buffa::ViewEncode<'a> for ListTriggersResponseView<'a> {
17259            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17260            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
17261                #[allow(unused_imports)]
17262                use ::buffa::Enumeration as _;
17263                let mut size = 0u32;
17264                for v in &self.triggers {
17265                    let __slot = __cache.reserve();
17266                    let inner_size = v.compute_size(__cache);
17267                    __cache.set(__slot, inner_size);
17268                    size
17269                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
17270                            + inner_size;
17271                }
17272                if !self.next_page_token.is_empty() {
17273                    size
17274                        += 1u32
17275                            + ::buffa::types::string_encoded_len(&self.next_page_token)
17276                                as u32;
17277                }
17278                size += self.__buffa_unknown_fields.encoded_len() as u32;
17279                size
17280            }
17281            #[allow(clippy::needless_borrow)]
17282            fn write_to(
17283                &self,
17284                __cache: &mut ::buffa::SizeCache,
17285                buf: &mut impl ::buffa::bytes::BufMut,
17286            ) {
17287                #[allow(unused_imports)]
17288                use ::buffa::Enumeration as _;
17289                for v in &self.triggers {
17290                    ::buffa::types::put_len_delimited_header(
17291                        1u32,
17292                        __cache.consume_next(),
17293                        buf,
17294                    );
17295                    v.write_to(__cache, buf);
17296                }
17297                if !self.next_page_token.is_empty() {
17298                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
17299                }
17300                self.__buffa_unknown_fields.write_to(buf);
17301            }
17302        }
17303        /// Serializes this view as protobuf JSON.
17304        ///
17305        /// Implicit-presence fields with default values are omitted, `required`
17306        /// fields are always emitted, explicit-presence (`optional`) fields are
17307        /// emitted only when set, bytes fields are base64-encoded, and enum
17308        /// values are their proto name strings.
17309        ///
17310        /// This impl uses `serialize_map(None)` because the number of emitted
17311        /// fields depends on default-omission rules; serializers that require
17312        /// known map lengths (e.g. `bincode`) will return a runtime error.
17313        /// Use the owned message type for those formats.
17314        impl<'__a> ::serde::Serialize for ListTriggersResponseView<'__a> {
17315            fn serialize<__S: ::serde::Serializer>(
17316                &self,
17317                __s: __S,
17318            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17319                use ::serde::ser::SerializeMap as _;
17320                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17321                if !self.triggers.is_empty() {
17322                    __map.serialize_entry("triggers", &*self.triggers)?;
17323                }
17324                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
17325                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
17326                }
17327                __map.end()
17328            }
17329        }
17330        impl<'a> ::buffa::MessageName for ListTriggersResponseView<'a> {
17331            const PACKAGE: &'static str = "triggers.v1";
17332            const NAME: &'static str = "ListTriggersResponse";
17333            const FULL_NAME: &'static str = "triggers.v1.ListTriggersResponse";
17334            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggersResponse";
17335        }
17336        ::buffa::impl_default_view_instance!(ListTriggersResponseView);
17337        ::buffa::impl_view_reborrow!(ListTriggersResponseView);
17338        /** Self-contained, `'static` owned view of a `ListTriggersResponse` message.
17339
17340 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.
17341
17342 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.*/
17343        #[derive(Clone, Debug)]
17344        pub struct ListTriggersResponseOwnedView(
17345            ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17346        );
17347        impl ListTriggersResponseOwnedView {
17348            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17349            ///
17350            /// The view borrows directly from the buffer's data; the buffer is
17351            /// retained inside the returned handle.
17352            ///
17353            /// # Errors
17354            ///
17355            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17356            /// protobuf data.
17357            pub fn decode(
17358                bytes: ::buffa::bytes::Bytes,
17359            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17360                ::core::result::Result::Ok(
17361                    ListTriggersResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
17362                )
17363            }
17364            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17365            /// max message size).
17366            ///
17367            /// # Errors
17368            ///
17369            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17370            /// exceeds the configured limits.
17371            pub fn decode_with_options(
17372                bytes: ::buffa::bytes::Bytes,
17373                opts: &::buffa::DecodeOptions,
17374            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17375                ::core::result::Result::Ok(
17376                    ListTriggersResponseOwnedView(
17377                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17378                    ),
17379                )
17380            }
17381            /// Build from an owned message via an encode → decode round-trip.
17382            ///
17383            /// # Errors
17384            ///
17385            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17386            /// somehow invalid (should not happen for well-formed messages).
17387            pub fn from_owned(
17388                msg: &super::super::ListTriggersResponse,
17389            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17390                ::core::result::Result::Ok(
17391                    ListTriggersResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
17392                )
17393            }
17394            /// Borrow the full [`ListTriggersResponseView`] with its lifetime tied to `&self`.
17395            #[must_use]
17396            pub fn view(&self) -> &ListTriggersResponseView<'_> {
17397                self.0.reborrow()
17398            }
17399            /// Convert to the owned message type.
17400            ///
17401            /// # Errors
17402            ///
17403            /// Returns an error if re-materializing preserved unknown fields
17404            /// fails (e.g. the unknown-field limit is exceeded).
17405            pub fn to_owned_message(
17406                &self,
17407            ) -> ::core::result::Result<
17408                super::super::ListTriggersResponse,
17409                ::buffa::DecodeError,
17410            > {
17411                self.0.to_owned_message()
17412            }
17413            /// The underlying bytes buffer.
17414            #[must_use]
17415            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17416                self.0.bytes()
17417            }
17418            /// Consume the handle, returning the underlying bytes buffer.
17419            #[must_use]
17420            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17421                self.0.into_bytes()
17422            }
17423            /// Triggers ordered by creation time descending, then trigger ID descending.
17424            ///
17425            /// Field 1: `triggers`
17426            #[must_use]
17427            pub fn triggers(
17428                &self,
17429            ) -> &::buffa::RepeatedView<
17430                '_,
17431                super::super::__buffa::view::TriggerView<'_>,
17432            > {
17433                &self.0.reborrow().triggers
17434            }
17435            /// Opaque cursor for the next page. Empty when no more results exist.
17436            ///
17437            /// Field 3: `next_page_token`
17438            #[must_use]
17439            pub fn next_page_token(&self) -> &'_ str {
17440                self.0.reborrow().next_page_token
17441            }
17442        }
17443        impl ::core::convert::From<::buffa::OwnedView<ListTriggersResponseView<'static>>>
17444        for ListTriggersResponseOwnedView {
17445            fn from(
17446                inner: ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17447            ) -> Self {
17448                ListTriggersResponseOwnedView(inner)
17449            }
17450        }
17451        impl ::core::convert::From<ListTriggersResponseOwnedView>
17452        for ::buffa::OwnedView<ListTriggersResponseView<'static>> {
17453            fn from(wrapper: ListTriggersResponseOwnedView) -> Self {
17454                wrapper.0
17455            }
17456        }
17457        impl ::core::convert::AsRef<
17458            ::buffa::OwnedView<ListTriggersResponseView<'static>>,
17459        > for ListTriggersResponseOwnedView {
17460            fn as_ref(&self) -> &::buffa::OwnedView<ListTriggersResponseView<'static>> {
17461                &self.0
17462            }
17463        }
17464        impl ::buffa::HasMessageView for super::super::ListTriggersResponse {
17465            type View<'a> = ListTriggersResponseView<'a>;
17466            type ViewHandle = ListTriggersResponseOwnedView;
17467        }
17468        impl ::serde::Serialize for ListTriggersResponseOwnedView {
17469            fn serialize<__S: ::serde::Serializer>(
17470                &self,
17471                __s: __S,
17472            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17473                ::serde::Serialize::serialize(&self.0, __s)
17474            }
17475        }
17476        /// =============================================================================
17477        /// Trigger Events (History / Audit)
17478        /// =============================================================================
17479        ///
17480        /// ListTriggerEventsRequest lists historical events for one trigger.
17481        #[derive(Clone, Debug, Default)]
17482        pub struct ListTriggerEventsRequestView<'a> {
17483            /// Trigger ID to list events for.
17484            ///
17485            /// Field 1: `trigger_id`
17486            pub trigger_id: u64,
17487            /// Optional sub-account (authorization). When empty or omitted, uses the
17488            /// caller's root account.
17489            ///
17490            /// Field 2: `subaccount_id`
17491            pub subaccount_id: ::core::option::Option<u64>,
17492            /// Maximum number of events to return. Defaults to 100 when omitted; maximum
17493            /// is 1000.
17494            ///
17495            /// Field 3: `limit`
17496            pub limit: u32,
17497            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17498            /// bound to the authenticated account, trigger, sub-account scope, and newest
17499            /// first sort order.
17500            ///
17501            /// Field 5: `page_token`
17502            pub page_token: &'a str,
17503            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17504        }
17505        impl<'a> ::buffa::MessageView<'a> for ListTriggerEventsRequestView<'a> {
17506            type Owned = super::super::ListTriggerEventsRequest;
17507            fn decode_view(
17508                buf: &'a [u8],
17509            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17510                let __limit = ::core::cell::Cell::new(
17511                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17512                );
17513                <Self as ::buffa::MessageView>::decode_view_ctx(
17514                    buf,
17515                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17516                )
17517            }
17518            fn decode_view_with_ctx(
17519                buf: &'a [u8],
17520                ctx: ::buffa::DecodeContext<'_>,
17521            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17522                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17523            }
17524            fn merge_view_field(
17525                &mut self,
17526                tag: ::buffa::encoding::Tag,
17527                cur: &'a [u8],
17528                before_tag: &'a [u8],
17529                ctx: ::buffa::DecodeContext<'_>,
17530            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17531                let _ = ctx;
17532                #[allow(unused_variables)]
17533                let view = self;
17534                let mut cur = cur;
17535                match tag.field_number() {
17536                    1u32 => {
17537                        ::buffa::encoding::check_wire_type(
17538                            tag,
17539                            ::buffa::encoding::WireType::Fixed64,
17540                        )?;
17541                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
17542                    }
17543                    2u32 => {
17544                        ::buffa::encoding::check_wire_type(
17545                            tag,
17546                            ::buffa::encoding::WireType::Fixed64,
17547                        )?;
17548                        view.subaccount_id = Some(
17549                            ::buffa::types::decode_fixed64(&mut cur)?,
17550                        );
17551                    }
17552                    3u32 => {
17553                        ::buffa::encoding::check_wire_type(
17554                            tag,
17555                            ::buffa::encoding::WireType::Varint,
17556                        )?;
17557                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
17558                    }
17559                    5u32 => {
17560                        ::buffa::encoding::check_wire_type(
17561                            tag,
17562                            ::buffa::encoding::WireType::LengthDelimited,
17563                        )?;
17564                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
17565                    }
17566                    _ => {
17567                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17568                        let span_len = before_tag.len() - cur.len();
17569                        view.__buffa_unknown_fields
17570                            .push_record(before_tag, span_len, ctx)?;
17571                    }
17572                }
17573                ::core::result::Result::Ok(cur)
17574            }
17575            fn to_owned_message(
17576                &self,
17577            ) -> ::core::result::Result<
17578                super::super::ListTriggerEventsRequest,
17579                ::buffa::DecodeError,
17580            > {
17581                self.to_owned_from_source(None)
17582            }
17583            #[allow(clippy::useless_conversion, clippy::needless_update)]
17584            fn to_owned_from_source(
17585                &self,
17586                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17587            ) -> ::core::result::Result<
17588                super::super::ListTriggerEventsRequest,
17589                ::buffa::DecodeError,
17590            > {
17591                #[allow(unused_imports)]
17592                use ::buffa::alloc::string::ToString as _;
17593                let _ = __buffa_src;
17594                ::core::result::Result::Ok(super::super::ListTriggerEventsRequest {
17595                    trigger_id: self.trigger_id,
17596                    subaccount_id: self.subaccount_id,
17597                    limit: self.limit,
17598                    page_token: self.page_token.to_string(),
17599                    __buffa_unknown_fields: self
17600                        .__buffa_unknown_fields
17601                        .to_owned()?
17602                        .into(),
17603                    ..::core::default::Default::default()
17604                })
17605            }
17606        }
17607        impl<'a> ::buffa::ViewEncode<'a> for ListTriggerEventsRequestView<'a> {
17608            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17609            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17610                #[allow(unused_imports)]
17611                use ::buffa::Enumeration as _;
17612                let mut size = 0u32;
17613                if self.trigger_id != 0u64 {
17614                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17615                }
17616                if self.subaccount_id.is_some() {
17617                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
17618                }
17619                if self.limit != 0u32 {
17620                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
17621                }
17622                if !self.page_token.is_empty() {
17623                    size
17624                        += 1u32
17625                            + ::buffa::types::string_encoded_len(&self.page_token)
17626                                as u32;
17627                }
17628                size += self.__buffa_unknown_fields.encoded_len() as u32;
17629                size
17630            }
17631            #[allow(clippy::needless_borrow)]
17632            fn write_to(
17633                &self,
17634                _cache: &mut ::buffa::SizeCache,
17635                buf: &mut impl ::buffa::bytes::BufMut,
17636            ) {
17637                #[allow(unused_imports)]
17638                use ::buffa::Enumeration as _;
17639                if self.trigger_id != 0u64 {
17640                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
17641                }
17642                if let Some(v) = self.subaccount_id {
17643                    ::buffa::types::put_fixed64_field(2u32, v, buf);
17644                }
17645                if self.limit != 0u32 {
17646                    ::buffa::types::put_uint32_field(3u32, self.limit, buf);
17647                }
17648                if !self.page_token.is_empty() {
17649                    ::buffa::types::put_string_field(5u32, &self.page_token, buf);
17650                }
17651                self.__buffa_unknown_fields.write_to(buf);
17652            }
17653        }
17654        /// Serializes this view as protobuf JSON.
17655        ///
17656        /// Implicit-presence fields with default values are omitted, `required`
17657        /// fields are always emitted, explicit-presence (`optional`) fields are
17658        /// emitted only when set, bytes fields are base64-encoded, and enum
17659        /// values are their proto name strings.
17660        ///
17661        /// This impl uses `serialize_map(None)` because the number of emitted
17662        /// fields depends on default-omission rules; serializers that require
17663        /// known map lengths (e.g. `bincode`) will return a runtime error.
17664        /// Use the owned message type for those formats.
17665        impl<'__a> ::serde::Serialize for ListTriggerEventsRequestView<'__a> {
17666            fn serialize<__S: ::serde::Serializer>(
17667                &self,
17668                __s: __S,
17669            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17670                use ::serde::ser::SerializeMap as _;
17671                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17672                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
17673                    __map
17674                        .serialize_entry(
17675                            "triggerId",
17676                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
17677                        )?;
17678                }
17679                if let ::core::option::Option::Some(__v) = self.subaccount_id {
17680                    __map
17681                        .serialize_entry(
17682                            "subaccountId",
17683                            &::buffa::json_helpers::ProtoJson(&__v),
17684                        )?;
17685                }
17686                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
17687                    __map
17688                        .serialize_entry(
17689                            "limit",
17690                            &::buffa::json_helpers::ProtoJson(&self.limit),
17691                        )?;
17692                }
17693                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
17694                    __map.serialize_entry("pageToken", self.page_token)?;
17695                }
17696                __map.end()
17697            }
17698        }
17699        impl<'a> ::buffa::MessageName for ListTriggerEventsRequestView<'a> {
17700            const PACKAGE: &'static str = "triggers.v1";
17701            const NAME: &'static str = "ListTriggerEventsRequest";
17702            const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsRequest";
17703            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsRequest";
17704        }
17705        ::buffa::impl_default_view_instance!(ListTriggerEventsRequestView);
17706        ::buffa::impl_view_reborrow!(ListTriggerEventsRequestView);
17707        /** Self-contained, `'static` owned view of a `ListTriggerEventsRequest` message.
17708
17709 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.
17710
17711 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.*/
17712        #[derive(Clone, Debug)]
17713        pub struct ListTriggerEventsRequestOwnedView(
17714            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17715        );
17716        impl ListTriggerEventsRequestOwnedView {
17717            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17718            ///
17719            /// The view borrows directly from the buffer's data; the buffer is
17720            /// retained inside the returned handle.
17721            ///
17722            /// # Errors
17723            ///
17724            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17725            /// protobuf data.
17726            pub fn decode(
17727                bytes: ::buffa::bytes::Bytes,
17728            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17729                ::core::result::Result::Ok(
17730                    ListTriggerEventsRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
17731                )
17732            }
17733            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17734            /// max message size).
17735            ///
17736            /// # Errors
17737            ///
17738            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17739            /// exceeds the configured limits.
17740            pub fn decode_with_options(
17741                bytes: ::buffa::bytes::Bytes,
17742                opts: &::buffa::DecodeOptions,
17743            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17744                ::core::result::Result::Ok(
17745                    ListTriggerEventsRequestOwnedView(
17746                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17747                    ),
17748                )
17749            }
17750            /// Build from an owned message via an encode → decode round-trip.
17751            ///
17752            /// # Errors
17753            ///
17754            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17755            /// somehow invalid (should not happen for well-formed messages).
17756            pub fn from_owned(
17757                msg: &super::super::ListTriggerEventsRequest,
17758            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17759                ::core::result::Result::Ok(
17760                    ListTriggerEventsRequestOwnedView(
17761                        ::buffa::OwnedView::from_owned(msg)?,
17762                    ),
17763                )
17764            }
17765            /// Borrow the full [`ListTriggerEventsRequestView`] with its lifetime tied to `&self`.
17766            #[must_use]
17767            pub fn view(&self) -> &ListTriggerEventsRequestView<'_> {
17768                self.0.reborrow()
17769            }
17770            /// Convert to the owned message type.
17771            ///
17772            /// # Errors
17773            ///
17774            /// Returns an error if re-materializing preserved unknown fields
17775            /// fails (e.g. the unknown-field limit is exceeded).
17776            pub fn to_owned_message(
17777                &self,
17778            ) -> ::core::result::Result<
17779                super::super::ListTriggerEventsRequest,
17780                ::buffa::DecodeError,
17781            > {
17782                self.0.to_owned_message()
17783            }
17784            /// The underlying bytes buffer.
17785            #[must_use]
17786            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17787                self.0.bytes()
17788            }
17789            /// Consume the handle, returning the underlying bytes buffer.
17790            #[must_use]
17791            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17792                self.0.into_bytes()
17793            }
17794            /// Trigger ID to list events for.
17795            ///
17796            /// Field 1: `trigger_id`
17797            #[must_use]
17798            pub fn trigger_id(&self) -> u64 {
17799                self.0.reborrow().trigger_id
17800            }
17801            /// Optional sub-account (authorization). When empty or omitted, uses the
17802            /// caller's root account.
17803            ///
17804            /// Field 2: `subaccount_id`
17805            #[must_use]
17806            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
17807                self.0.reborrow().subaccount_id
17808            }
17809            /// Maximum number of events to return. Defaults to 100 when omitted; maximum
17810            /// is 1000.
17811            ///
17812            /// Field 3: `limit`
17813            #[must_use]
17814            pub fn limit(&self) -> u32 {
17815                self.0.reborrow().limit
17816            }
17817            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
17818            /// bound to the authenticated account, trigger, sub-account scope, and newest
17819            /// first sort order.
17820            ///
17821            /// Field 5: `page_token`
17822            #[must_use]
17823            pub fn page_token(&self) -> &'_ str {
17824                self.0.reborrow().page_token
17825            }
17826        }
17827        impl ::core::convert::From<
17828            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17829        > for ListTriggerEventsRequestOwnedView {
17830            fn from(
17831                inner: ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17832            ) -> Self {
17833                ListTriggerEventsRequestOwnedView(inner)
17834            }
17835        }
17836        impl ::core::convert::From<ListTriggerEventsRequestOwnedView>
17837        for ::buffa::OwnedView<ListTriggerEventsRequestView<'static>> {
17838            fn from(wrapper: ListTriggerEventsRequestOwnedView) -> Self {
17839                wrapper.0
17840            }
17841        }
17842        impl ::core::convert::AsRef<
17843            ::buffa::OwnedView<ListTriggerEventsRequestView<'static>>,
17844        > for ListTriggerEventsRequestOwnedView {
17845            fn as_ref(
17846                &self,
17847            ) -> &::buffa::OwnedView<ListTriggerEventsRequestView<'static>> {
17848                &self.0
17849            }
17850        }
17851        impl ::buffa::HasMessageView for super::super::ListTriggerEventsRequest {
17852            type View<'a> = ListTriggerEventsRequestView<'a>;
17853            type ViewHandle = ListTriggerEventsRequestOwnedView;
17854        }
17855        impl ::serde::Serialize for ListTriggerEventsRequestOwnedView {
17856            fn serialize<__S: ::serde::Serializer>(
17857                &self,
17858                __s: __S,
17859            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17860                ::serde::Serialize::serialize(&self.0, __s)
17861            }
17862        }
17863        /// TriggerEvent describes one historical trigger lifecycle event.
17864        #[derive(Clone, Debug, Default)]
17865        pub struct TriggerEventView<'a> {
17866            /// Trigger ID associated with the event.
17867            ///
17868            /// Field 1: `trigger_id`
17869            pub trigger_id: u64,
17870            /// Public account or sub-account ID associated with the trigger.
17871            ///
17872            /// Field 2: `subaccount_id`
17873            pub subaccount_id: u64,
17874            /// Trading symbol numeric identifier.
17875            ///
17876            /// Field 3: `symbol_id`
17877            pub symbol_id: u32,
17878            /// Trigger type at the time of the event.
17879            ///
17880            /// Field 4: `trigger_type`
17881            pub trigger_type: ::buffa::EnumValue<super::super::TriggerType>,
17882            /// Event category.
17883            ///
17884            /// Field 5: `event_type`
17885            pub event_type: ::buffa::EnumValue<super::super::TriggerEventType>,
17886            /// Event timestamp in nanoseconds since epoch (UTC).
17887            ///
17888            /// Field 10: `ts_ns`
17889            pub ts_ns: u64,
17890            /// Child sequence number for multi-child trigger strategies.
17891            ///
17892            /// Field 11: `child_seq`
17893            pub child_seq: i32,
17894            /// Child order ID created by this event, if any.
17895            ///
17896            /// Field 12: `child_order_id`
17897            pub child_order_id: u64,
17898            /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
17899            /// when not applicable.
17900            ///
17901            /// Field 13: `fire_price_ticks`
17902            pub fire_price_ticks: i64,
17903            /// Optional cancel reason.
17904            ///
17905            /// Field 20: `reason`
17906            pub reason: &'a str,
17907            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17908        }
17909        impl<'a> ::buffa::MessageView<'a> for TriggerEventView<'a> {
17910            type Owned = super::super::TriggerEvent;
17911            fn decode_view(
17912                buf: &'a [u8],
17913            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17914                let __limit = ::core::cell::Cell::new(
17915                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17916                );
17917                <Self as ::buffa::MessageView>::decode_view_ctx(
17918                    buf,
17919                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17920                )
17921            }
17922            fn decode_view_with_ctx(
17923                buf: &'a [u8],
17924                ctx: ::buffa::DecodeContext<'_>,
17925            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17926                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17927            }
17928            fn merge_view_field(
17929                &mut self,
17930                tag: ::buffa::encoding::Tag,
17931                cur: &'a [u8],
17932                before_tag: &'a [u8],
17933                ctx: ::buffa::DecodeContext<'_>,
17934            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17935                let _ = ctx;
17936                #[allow(unused_variables)]
17937                let view = self;
17938                let mut cur = cur;
17939                match tag.field_number() {
17940                    1u32 => {
17941                        ::buffa::encoding::check_wire_type(
17942                            tag,
17943                            ::buffa::encoding::WireType::Fixed64,
17944                        )?;
17945                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
17946                    }
17947                    2u32 => {
17948                        ::buffa::encoding::check_wire_type(
17949                            tag,
17950                            ::buffa::encoding::WireType::Fixed64,
17951                        )?;
17952                        view.subaccount_id = ::buffa::types::decode_fixed64(&mut cur)?;
17953                    }
17954                    3u32 => {
17955                        ::buffa::encoding::check_wire_type(
17956                            tag,
17957                            ::buffa::encoding::WireType::Varint,
17958                        )?;
17959                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
17960                    }
17961                    4u32 => {
17962                        ::buffa::encoding::check_wire_type(
17963                            tag,
17964                            ::buffa::encoding::WireType::Varint,
17965                        )?;
17966                        view.trigger_type = ::buffa::EnumValue::from(
17967                            ::buffa::types::decode_int32(&mut cur)?,
17968                        );
17969                    }
17970                    5u32 => {
17971                        ::buffa::encoding::check_wire_type(
17972                            tag,
17973                            ::buffa::encoding::WireType::Varint,
17974                        )?;
17975                        view.event_type = ::buffa::EnumValue::from(
17976                            ::buffa::types::decode_int32(&mut cur)?,
17977                        );
17978                    }
17979                    10u32 => {
17980                        ::buffa::encoding::check_wire_type(
17981                            tag,
17982                            ::buffa::encoding::WireType::Varint,
17983                        )?;
17984                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
17985                    }
17986                    11u32 => {
17987                        ::buffa::encoding::check_wire_type(
17988                            tag,
17989                            ::buffa::encoding::WireType::Varint,
17990                        )?;
17991                        view.child_seq = ::buffa::types::decode_int32(&mut cur)?;
17992                    }
17993                    12u32 => {
17994                        ::buffa::encoding::check_wire_type(
17995                            tag,
17996                            ::buffa::encoding::WireType::Fixed64,
17997                        )?;
17998                        view.child_order_id = ::buffa::types::decode_fixed64(&mut cur)?;
17999                    }
18000                    13u32 => {
18001                        ::buffa::encoding::check_wire_type(
18002                            tag,
18003                            ::buffa::encoding::WireType::Varint,
18004                        )?;
18005                        view.fire_price_ticks = ::buffa::types::decode_int64(&mut cur)?;
18006                    }
18007                    20u32 => {
18008                        ::buffa::encoding::check_wire_type(
18009                            tag,
18010                            ::buffa::encoding::WireType::LengthDelimited,
18011                        )?;
18012                        view.reason = ::buffa::types::borrow_str(&mut cur)?;
18013                    }
18014                    _ => {
18015                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18016                        let span_len = before_tag.len() - cur.len();
18017                        view.__buffa_unknown_fields
18018                            .push_record(before_tag, span_len, ctx)?;
18019                    }
18020                }
18021                ::core::result::Result::Ok(cur)
18022            }
18023            fn to_owned_message(
18024                &self,
18025            ) -> ::core::result::Result<
18026                super::super::TriggerEvent,
18027                ::buffa::DecodeError,
18028            > {
18029                self.to_owned_from_source(None)
18030            }
18031            #[allow(clippy::useless_conversion, clippy::needless_update)]
18032            fn to_owned_from_source(
18033                &self,
18034                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18035            ) -> ::core::result::Result<
18036                super::super::TriggerEvent,
18037                ::buffa::DecodeError,
18038            > {
18039                #[allow(unused_imports)]
18040                use ::buffa::alloc::string::ToString as _;
18041                let _ = __buffa_src;
18042                ::core::result::Result::Ok(super::super::TriggerEvent {
18043                    trigger_id: self.trigger_id,
18044                    subaccount_id: self.subaccount_id,
18045                    symbol_id: self.symbol_id,
18046                    trigger_type: self.trigger_type,
18047                    event_type: self.event_type,
18048                    ts_ns: self.ts_ns,
18049                    child_seq: self.child_seq,
18050                    child_order_id: self.child_order_id,
18051                    fire_price_ticks: self.fire_price_ticks,
18052                    reason: self.reason.to_string(),
18053                    __buffa_unknown_fields: self
18054                        .__buffa_unknown_fields
18055                        .to_owned()?
18056                        .into(),
18057                    ..::core::default::Default::default()
18058                })
18059            }
18060        }
18061        impl<'a> ::buffa::ViewEncode<'a> for TriggerEventView<'a> {
18062            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18063            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
18064                #[allow(unused_imports)]
18065                use ::buffa::Enumeration as _;
18066                let mut size = 0u32;
18067                if self.trigger_id != 0u64 {
18068                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18069                }
18070                if self.subaccount_id != 0u64 {
18071                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18072                }
18073                if self.symbol_id != 0u32 {
18074                    size
18075                        += 1u32
18076                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
18077                }
18078                {
18079                    let val = self.trigger_type.to_i32();
18080                    if val != 0 {
18081                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
18082                    }
18083                }
18084                {
18085                    let val = self.event_type.to_i32();
18086                    if val != 0 {
18087                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
18088                    }
18089                }
18090                if self.ts_ns != 0u64 {
18091                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
18092                }
18093                if self.child_seq != 0i32 {
18094                    size
18095                        += 1u32
18096                            + ::buffa::types::int32_encoded_len(self.child_seq) as u32;
18097                }
18098                if self.child_order_id != 0u64 {
18099                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18100                }
18101                if self.fire_price_ticks != 0i64 {
18102                    size
18103                        += 1u32
18104                            + ::buffa::types::int64_encoded_len(self.fire_price_ticks)
18105                                as u32;
18106                }
18107                if !self.reason.is_empty() {
18108                    size
18109                        += 2u32
18110                            + ::buffa::types::string_encoded_len(&self.reason) as u32;
18111                }
18112                size += self.__buffa_unknown_fields.encoded_len() as u32;
18113                size
18114            }
18115            #[allow(clippy::needless_borrow)]
18116            fn write_to(
18117                &self,
18118                _cache: &mut ::buffa::SizeCache,
18119                buf: &mut impl ::buffa::bytes::BufMut,
18120            ) {
18121                #[allow(unused_imports)]
18122                use ::buffa::Enumeration as _;
18123                if self.trigger_id != 0u64 {
18124                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
18125                }
18126                if self.subaccount_id != 0u64 {
18127                    ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
18128                }
18129                if self.symbol_id != 0u32 {
18130                    ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
18131                }
18132                {
18133                    let val = self.trigger_type.to_i32();
18134                    if val != 0 {
18135                        ::buffa::types::put_int32_field(4u32, val, buf);
18136                    }
18137                }
18138                {
18139                    let val = self.event_type.to_i32();
18140                    if val != 0 {
18141                        ::buffa::types::put_int32_field(5u32, val, buf);
18142                    }
18143                }
18144                if self.ts_ns != 0u64 {
18145                    ::buffa::types::put_uint64_field(10u32, self.ts_ns, buf);
18146                }
18147                if self.child_seq != 0i32 {
18148                    ::buffa::types::put_int32_field(11u32, self.child_seq, buf);
18149                }
18150                if self.child_order_id != 0u64 {
18151                    ::buffa::types::put_fixed64_field(12u32, self.child_order_id, buf);
18152                }
18153                if self.fire_price_ticks != 0i64 {
18154                    ::buffa::types::put_int64_field(13u32, self.fire_price_ticks, buf);
18155                }
18156                if !self.reason.is_empty() {
18157                    ::buffa::types::put_string_field(20u32, &self.reason, buf);
18158                }
18159                self.__buffa_unknown_fields.write_to(buf);
18160            }
18161        }
18162        /// Serializes this view as protobuf JSON.
18163        ///
18164        /// Implicit-presence fields with default values are omitted, `required`
18165        /// fields are always emitted, explicit-presence (`optional`) fields are
18166        /// emitted only when set, bytes fields are base64-encoded, and enum
18167        /// values are their proto name strings.
18168        ///
18169        /// This impl uses `serialize_map(None)` because the number of emitted
18170        /// fields depends on default-omission rules; serializers that require
18171        /// known map lengths (e.g. `bincode`) will return a runtime error.
18172        /// Use the owned message type for those formats.
18173        impl<'__a> ::serde::Serialize for TriggerEventView<'__a> {
18174            fn serialize<__S: ::serde::Serializer>(
18175                &self,
18176                __s: __S,
18177            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18178                use ::serde::ser::SerializeMap as _;
18179                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18180                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
18181                    __map
18182                        .serialize_entry(
18183                            "triggerId",
18184                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
18185                        )?;
18186                }
18187                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
18188                    __map
18189                        .serialize_entry(
18190                            "subaccountId",
18191                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
18192                        )?;
18193                }
18194                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
18195                    __map
18196                        .serialize_entry(
18197                            "symbolId",
18198                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
18199                        )?;
18200                }
18201                if !::buffa::json_helpers::skip_if::is_default_enum_value(
18202                    &self.trigger_type,
18203                ) {
18204                    __map.serialize_entry("triggerType", &self.trigger_type)?;
18205                }
18206                if !::buffa::json_helpers::skip_if::is_default_enum_value(
18207                    &self.event_type,
18208                ) {
18209                    __map.serialize_entry("eventType", &self.event_type)?;
18210                }
18211                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
18212                    __map
18213                        .serialize_entry(
18214                            "tsNs",
18215                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
18216                        )?;
18217                }
18218                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.child_seq) {
18219                    __map
18220                        .serialize_entry(
18221                            "childSeq",
18222                            &::buffa::json_helpers::ProtoJson(&self.child_seq),
18223                        )?;
18224                }
18225                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.child_order_id) {
18226                    __map
18227                        .serialize_entry(
18228                            "childOrderId",
18229                            &::buffa::json_helpers::ProtoJson(&self.child_order_id),
18230                        )?;
18231                }
18232                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.fire_price_ticks) {
18233                    __map
18234                        .serialize_entry(
18235                            "firePriceTicks",
18236                            &::buffa::json_helpers::ProtoJson(&self.fire_price_ticks),
18237                        )?;
18238                }
18239                if !::buffa::json_helpers::skip_if::is_empty_str(self.reason) {
18240                    __map.serialize_entry("reason", self.reason)?;
18241                }
18242                __map.end()
18243            }
18244        }
18245        impl<'a> ::buffa::MessageName for TriggerEventView<'a> {
18246            const PACKAGE: &'static str = "triggers.v1";
18247            const NAME: &'static str = "TriggerEvent";
18248            const FULL_NAME: &'static str = "triggers.v1.TriggerEvent";
18249            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TriggerEvent";
18250        }
18251        ::buffa::impl_default_view_instance!(TriggerEventView);
18252        ::buffa::impl_view_reborrow!(TriggerEventView);
18253        /** Self-contained, `'static` owned view of a `TriggerEvent` message.
18254
18255 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.
18256
18257 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.*/
18258        #[derive(Clone, Debug)]
18259        pub struct TriggerEventOwnedView(::buffa::OwnedView<TriggerEventView<'static>>);
18260        impl TriggerEventOwnedView {
18261            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18262            ///
18263            /// The view borrows directly from the buffer's data; the buffer is
18264            /// retained inside the returned handle.
18265            ///
18266            /// # Errors
18267            ///
18268            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18269            /// protobuf data.
18270            pub fn decode(
18271                bytes: ::buffa::bytes::Bytes,
18272            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18273                ::core::result::Result::Ok(
18274                    TriggerEventOwnedView(::buffa::OwnedView::decode(bytes)?),
18275                )
18276            }
18277            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18278            /// max message size).
18279            ///
18280            /// # Errors
18281            ///
18282            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18283            /// exceeds the configured limits.
18284            pub fn decode_with_options(
18285                bytes: ::buffa::bytes::Bytes,
18286                opts: &::buffa::DecodeOptions,
18287            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18288                ::core::result::Result::Ok(
18289                    TriggerEventOwnedView(
18290                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18291                    ),
18292                )
18293            }
18294            /// Build from an owned message via an encode → decode round-trip.
18295            ///
18296            /// # Errors
18297            ///
18298            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18299            /// somehow invalid (should not happen for well-formed messages).
18300            pub fn from_owned(
18301                msg: &super::super::TriggerEvent,
18302            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18303                ::core::result::Result::Ok(
18304                    TriggerEventOwnedView(::buffa::OwnedView::from_owned(msg)?),
18305                )
18306            }
18307            /// Borrow the full [`TriggerEventView`] with its lifetime tied to `&self`.
18308            #[must_use]
18309            pub fn view(&self) -> &TriggerEventView<'_> {
18310                self.0.reborrow()
18311            }
18312            /// Convert to the owned message type.
18313            ///
18314            /// # Errors
18315            ///
18316            /// Returns an error if re-materializing preserved unknown fields
18317            /// fails (e.g. the unknown-field limit is exceeded).
18318            pub fn to_owned_message(
18319                &self,
18320            ) -> ::core::result::Result<
18321                super::super::TriggerEvent,
18322                ::buffa::DecodeError,
18323            > {
18324                self.0.to_owned_message()
18325            }
18326            /// The underlying bytes buffer.
18327            #[must_use]
18328            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18329                self.0.bytes()
18330            }
18331            /// Consume the handle, returning the underlying bytes buffer.
18332            #[must_use]
18333            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18334                self.0.into_bytes()
18335            }
18336            /// Trigger ID associated with the event.
18337            ///
18338            /// Field 1: `trigger_id`
18339            #[must_use]
18340            pub fn trigger_id(&self) -> u64 {
18341                self.0.reborrow().trigger_id
18342            }
18343            /// Public account or sub-account ID associated with the trigger.
18344            ///
18345            /// Field 2: `subaccount_id`
18346            #[must_use]
18347            pub fn subaccount_id(&self) -> u64 {
18348                self.0.reborrow().subaccount_id
18349            }
18350            /// Trading symbol numeric identifier.
18351            ///
18352            /// Field 3: `symbol_id`
18353            #[must_use]
18354            pub fn symbol_id(&self) -> u32 {
18355                self.0.reborrow().symbol_id
18356            }
18357            /// Trigger type at the time of the event.
18358            ///
18359            /// Field 4: `trigger_type`
18360            #[must_use]
18361            pub fn trigger_type(&self) -> ::buffa::EnumValue<super::super::TriggerType> {
18362                self.0.reborrow().trigger_type
18363            }
18364            /// Event category.
18365            ///
18366            /// Field 5: `event_type`
18367            #[must_use]
18368            pub fn event_type(
18369                &self,
18370            ) -> ::buffa::EnumValue<super::super::TriggerEventType> {
18371                self.0.reborrow().event_type
18372            }
18373            /// Event timestamp in nanoseconds since epoch (UTC).
18374            ///
18375            /// Field 10: `ts_ns`
18376            #[must_use]
18377            pub fn ts_ns(&self) -> u64 {
18378                self.0.reborrow().ts_ns
18379            }
18380            /// Child sequence number for multi-child trigger strategies.
18381            ///
18382            /// Field 11: `child_seq`
18383            #[must_use]
18384            pub fn child_seq(&self) -> i32 {
18385                self.0.reborrow().child_seq
18386            }
18387            /// Child order ID created by this event, if any.
18388            ///
18389            /// Field 12: `child_order_id`
18390            #[must_use]
18391            pub fn child_order_id(&self) -> u64 {
18392                self.0.reborrow().child_order_id
18393            }
18394            /// Price that caused the trigger to fire, in quote units scaled by 1e6. Zero
18395            /// when not applicable.
18396            ///
18397            /// Field 13: `fire_price_ticks`
18398            #[must_use]
18399            pub fn fire_price_ticks(&self) -> i64 {
18400                self.0.reborrow().fire_price_ticks
18401            }
18402            /// Optional cancel reason.
18403            ///
18404            /// Field 20: `reason`
18405            #[must_use]
18406            pub fn reason(&self) -> &'_ str {
18407                self.0.reborrow().reason
18408            }
18409        }
18410        impl ::core::convert::From<::buffa::OwnedView<TriggerEventView<'static>>>
18411        for TriggerEventOwnedView {
18412            fn from(inner: ::buffa::OwnedView<TriggerEventView<'static>>) -> Self {
18413                TriggerEventOwnedView(inner)
18414            }
18415        }
18416        impl ::core::convert::From<TriggerEventOwnedView>
18417        for ::buffa::OwnedView<TriggerEventView<'static>> {
18418            fn from(wrapper: TriggerEventOwnedView) -> Self {
18419                wrapper.0
18420            }
18421        }
18422        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerEventView<'static>>>
18423        for TriggerEventOwnedView {
18424            fn as_ref(&self) -> &::buffa::OwnedView<TriggerEventView<'static>> {
18425                &self.0
18426            }
18427        }
18428        impl ::buffa::HasMessageView for super::super::TriggerEvent {
18429            type View<'a> = TriggerEventView<'a>;
18430            type ViewHandle = TriggerEventOwnedView;
18431        }
18432        impl ::serde::Serialize for TriggerEventOwnedView {
18433            fn serialize<__S: ::serde::Serializer>(
18434                &self,
18435                __s: __S,
18436            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18437                ::serde::Serialize::serialize(&self.0, __s)
18438            }
18439        }
18440        /// ListTriggerEventsResponse returns historical events ordered newest-first.
18441        #[derive(Clone, Debug, Default)]
18442        pub struct ListTriggerEventsResponseView<'a> {
18443            /// Events ordered by event time descending, child sequence descending, and
18444            /// stable event tie-breakers descending.
18445            ///
18446            /// Field 1: `events`
18447            pub events: ::buffa::RepeatedView<
18448                'a,
18449                super::super::__buffa::view::TriggerEventView<'a>,
18450            >,
18451            /// Opaque cursor for the next page. Empty when no more results exist.
18452            ///
18453            /// Field 3: `next_page_token`
18454            pub next_page_token: &'a str,
18455            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18456        }
18457        impl<'a> ::buffa::MessageView<'a> for ListTriggerEventsResponseView<'a> {
18458            type Owned = super::super::ListTriggerEventsResponse;
18459            fn decode_view(
18460                buf: &'a [u8],
18461            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18462                let __limit = ::core::cell::Cell::new(
18463                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18464                );
18465                <Self as ::buffa::MessageView>::decode_view_ctx(
18466                    buf,
18467                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18468                )
18469            }
18470            fn decode_view_with_ctx(
18471                buf: &'a [u8],
18472                ctx: ::buffa::DecodeContext<'_>,
18473            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18474                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18475            }
18476            fn merge_view_field(
18477                &mut self,
18478                tag: ::buffa::encoding::Tag,
18479                cur: &'a [u8],
18480                before_tag: &'a [u8],
18481                ctx: ::buffa::DecodeContext<'_>,
18482            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18483                let _ = ctx;
18484                #[allow(unused_variables)]
18485                let view = self;
18486                let mut cur = cur;
18487                match tag.field_number() {
18488                    3u32 => {
18489                        ::buffa::encoding::check_wire_type(
18490                            tag,
18491                            ::buffa::encoding::WireType::LengthDelimited,
18492                        )?;
18493                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
18494                    }
18495                    1u32 => {
18496                        ::buffa::encoding::check_wire_type(
18497                            tag,
18498                            ::buffa::encoding::WireType::LengthDelimited,
18499                        )?;
18500                        let __sub_ctx = ctx.descend()?;
18501                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
18502                        view.events
18503                            .push(
18504                                <super::super::__buffa::view::TriggerEventView as ::buffa::MessageView>::decode_view_ctx(
18505                                    sub,
18506                                    __sub_ctx,
18507                                )?,
18508                            );
18509                    }
18510                    _ => {
18511                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18512                        let span_len = before_tag.len() - cur.len();
18513                        view.__buffa_unknown_fields
18514                            .push_record(before_tag, span_len, ctx)?;
18515                    }
18516                }
18517                ::core::result::Result::Ok(cur)
18518            }
18519            fn to_owned_message(
18520                &self,
18521            ) -> ::core::result::Result<
18522                super::super::ListTriggerEventsResponse,
18523                ::buffa::DecodeError,
18524            > {
18525                self.to_owned_from_source(None)
18526            }
18527            #[allow(clippy::useless_conversion, clippy::needless_update)]
18528            fn to_owned_from_source(
18529                &self,
18530                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18531            ) -> ::core::result::Result<
18532                super::super::ListTriggerEventsResponse,
18533                ::buffa::DecodeError,
18534            > {
18535                #[allow(unused_imports)]
18536                use ::buffa::alloc::string::ToString as _;
18537                let _ = __buffa_src;
18538                ::core::result::Result::Ok(super::super::ListTriggerEventsResponse {
18539                    events: self
18540                        .events
18541                        .iter()
18542                        .map(|v| v.to_owned_from_source(__buffa_src))
18543                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
18544                    next_page_token: self.next_page_token.to_string(),
18545                    __buffa_unknown_fields: self
18546                        .__buffa_unknown_fields
18547                        .to_owned()?
18548                        .into(),
18549                    ..::core::default::Default::default()
18550                })
18551            }
18552        }
18553        impl<'a> ::buffa::ViewEncode<'a> for ListTriggerEventsResponseView<'a> {
18554            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18555            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
18556                #[allow(unused_imports)]
18557                use ::buffa::Enumeration as _;
18558                let mut size = 0u32;
18559                for v in &self.events {
18560                    let __slot = __cache.reserve();
18561                    let inner_size = v.compute_size(__cache);
18562                    __cache.set(__slot, inner_size);
18563                    size
18564                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18565                            + inner_size;
18566                }
18567                if !self.next_page_token.is_empty() {
18568                    size
18569                        += 1u32
18570                            + ::buffa::types::string_encoded_len(&self.next_page_token)
18571                                as u32;
18572                }
18573                size += self.__buffa_unknown_fields.encoded_len() as u32;
18574                size
18575            }
18576            #[allow(clippy::needless_borrow)]
18577            fn write_to(
18578                &self,
18579                __cache: &mut ::buffa::SizeCache,
18580                buf: &mut impl ::buffa::bytes::BufMut,
18581            ) {
18582                #[allow(unused_imports)]
18583                use ::buffa::Enumeration as _;
18584                for v in &self.events {
18585                    ::buffa::types::put_len_delimited_header(
18586                        1u32,
18587                        __cache.consume_next(),
18588                        buf,
18589                    );
18590                    v.write_to(__cache, buf);
18591                }
18592                if !self.next_page_token.is_empty() {
18593                    ::buffa::types::put_string_field(3u32, &self.next_page_token, buf);
18594                }
18595                self.__buffa_unknown_fields.write_to(buf);
18596            }
18597        }
18598        /// Serializes this view as protobuf JSON.
18599        ///
18600        /// Implicit-presence fields with default values are omitted, `required`
18601        /// fields are always emitted, explicit-presence (`optional`) fields are
18602        /// emitted only when set, bytes fields are base64-encoded, and enum
18603        /// values are their proto name strings.
18604        ///
18605        /// This impl uses `serialize_map(None)` because the number of emitted
18606        /// fields depends on default-omission rules; serializers that require
18607        /// known map lengths (e.g. `bincode`) will return a runtime error.
18608        /// Use the owned message type for those formats.
18609        impl<'__a> ::serde::Serialize for ListTriggerEventsResponseView<'__a> {
18610            fn serialize<__S: ::serde::Serializer>(
18611                &self,
18612                __s: __S,
18613            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18614                use ::serde::ser::SerializeMap as _;
18615                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18616                if !self.events.is_empty() {
18617                    __map.serialize_entry("events", &*self.events)?;
18618                }
18619                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
18620                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
18621                }
18622                __map.end()
18623            }
18624        }
18625        impl<'a> ::buffa::MessageName for ListTriggerEventsResponseView<'a> {
18626            const PACKAGE: &'static str = "triggers.v1";
18627            const NAME: &'static str = "ListTriggerEventsResponse";
18628            const FULL_NAME: &'static str = "triggers.v1.ListTriggerEventsResponse";
18629            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ListTriggerEventsResponse";
18630        }
18631        ::buffa::impl_default_view_instance!(ListTriggerEventsResponseView);
18632        ::buffa::impl_view_reborrow!(ListTriggerEventsResponseView);
18633        /** Self-contained, `'static` owned view of a `ListTriggerEventsResponse` message.
18634
18635 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.
18636
18637 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.*/
18638        #[derive(Clone, Debug)]
18639        pub struct ListTriggerEventsResponseOwnedView(
18640            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18641        );
18642        impl ListTriggerEventsResponseOwnedView {
18643            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18644            ///
18645            /// The view borrows directly from the buffer's data; the buffer is
18646            /// retained inside the returned handle.
18647            ///
18648            /// # Errors
18649            ///
18650            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18651            /// protobuf data.
18652            pub fn decode(
18653                bytes: ::buffa::bytes::Bytes,
18654            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18655                ::core::result::Result::Ok(
18656                    ListTriggerEventsResponseOwnedView(
18657                        ::buffa::OwnedView::decode(bytes)?,
18658                    ),
18659                )
18660            }
18661            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18662            /// max message size).
18663            ///
18664            /// # Errors
18665            ///
18666            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18667            /// exceeds the configured limits.
18668            pub fn decode_with_options(
18669                bytes: ::buffa::bytes::Bytes,
18670                opts: &::buffa::DecodeOptions,
18671            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18672                ::core::result::Result::Ok(
18673                    ListTriggerEventsResponseOwnedView(
18674                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18675                    ),
18676                )
18677            }
18678            /// Build from an owned message via an encode → decode round-trip.
18679            ///
18680            /// # Errors
18681            ///
18682            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18683            /// somehow invalid (should not happen for well-formed messages).
18684            pub fn from_owned(
18685                msg: &super::super::ListTriggerEventsResponse,
18686            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18687                ::core::result::Result::Ok(
18688                    ListTriggerEventsResponseOwnedView(
18689                        ::buffa::OwnedView::from_owned(msg)?,
18690                    ),
18691                )
18692            }
18693            /// Borrow the full [`ListTriggerEventsResponseView`] with its lifetime tied to `&self`.
18694            #[must_use]
18695            pub fn view(&self) -> &ListTriggerEventsResponseView<'_> {
18696                self.0.reborrow()
18697            }
18698            /// Convert to the owned message type.
18699            ///
18700            /// # Errors
18701            ///
18702            /// Returns an error if re-materializing preserved unknown fields
18703            /// fails (e.g. the unknown-field limit is exceeded).
18704            pub fn to_owned_message(
18705                &self,
18706            ) -> ::core::result::Result<
18707                super::super::ListTriggerEventsResponse,
18708                ::buffa::DecodeError,
18709            > {
18710                self.0.to_owned_message()
18711            }
18712            /// The underlying bytes buffer.
18713            #[must_use]
18714            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18715                self.0.bytes()
18716            }
18717            /// Consume the handle, returning the underlying bytes buffer.
18718            #[must_use]
18719            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18720                self.0.into_bytes()
18721            }
18722            /// Events ordered by event time descending, child sequence descending, and
18723            /// stable event tie-breakers descending.
18724            ///
18725            /// Field 1: `events`
18726            #[must_use]
18727            pub fn events(
18728                &self,
18729            ) -> &::buffa::RepeatedView<
18730                '_,
18731                super::super::__buffa::view::TriggerEventView<'_>,
18732            > {
18733                &self.0.reborrow().events
18734            }
18735            /// Opaque cursor for the next page. Empty when no more results exist.
18736            ///
18737            /// Field 3: `next_page_token`
18738            #[must_use]
18739            pub fn next_page_token(&self) -> &'_ str {
18740                self.0.reborrow().next_page_token
18741            }
18742        }
18743        impl ::core::convert::From<
18744            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18745        > for ListTriggerEventsResponseOwnedView {
18746            fn from(
18747                inner: ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18748            ) -> Self {
18749                ListTriggerEventsResponseOwnedView(inner)
18750            }
18751        }
18752        impl ::core::convert::From<ListTriggerEventsResponseOwnedView>
18753        for ::buffa::OwnedView<ListTriggerEventsResponseView<'static>> {
18754            fn from(wrapper: ListTriggerEventsResponseOwnedView) -> Self {
18755                wrapper.0
18756            }
18757        }
18758        impl ::core::convert::AsRef<
18759            ::buffa::OwnedView<ListTriggerEventsResponseView<'static>>,
18760        > for ListTriggerEventsResponseOwnedView {
18761            fn as_ref(
18762                &self,
18763            ) -> &::buffa::OwnedView<ListTriggerEventsResponseView<'static>> {
18764                &self.0
18765            }
18766        }
18767        impl ::buffa::HasMessageView for super::super::ListTriggerEventsResponse {
18768            type View<'a> = ListTriggerEventsResponseView<'a>;
18769            type ViewHandle = ListTriggerEventsResponseOwnedView;
18770        }
18771        impl ::serde::Serialize for ListTriggerEventsResponseOwnedView {
18772            fn serialize<__S: ::serde::Serializer>(
18773                &self,
18774                __s: __S,
18775            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18776                ::serde::Serialize::serialize(&self.0, __s)
18777            }
18778        }
18779        /// =============================================================================
18780        /// Cancel Trigger
18781        /// =============================================================================
18782        ///
18783        /// CancelTriggerRequest cancels an active trigger by ID.
18784        #[derive(Clone, Debug, Default)]
18785        pub struct CancelTriggerRequestView<'a> {
18786            /// Trigger ID to cancel.
18787            ///
18788            /// Field 1: `trigger_id`
18789            pub trigger_id: u64,
18790            /// Optional sub-account for authorization.
18791            ///
18792            /// Field 2: `subaccount_id`
18793            pub subaccount_id: ::core::option::Option<u64>,
18794            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18795        }
18796        impl<'a> ::buffa::MessageView<'a> for CancelTriggerRequestView<'a> {
18797            type Owned = super::super::CancelTriggerRequest;
18798            fn decode_view(
18799                buf: &'a [u8],
18800            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18801                let __limit = ::core::cell::Cell::new(
18802                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18803                );
18804                <Self as ::buffa::MessageView>::decode_view_ctx(
18805                    buf,
18806                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18807                )
18808            }
18809            fn decode_view_with_ctx(
18810                buf: &'a [u8],
18811                ctx: ::buffa::DecodeContext<'_>,
18812            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18813                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18814            }
18815            fn merge_view_field(
18816                &mut self,
18817                tag: ::buffa::encoding::Tag,
18818                cur: &'a [u8],
18819                before_tag: &'a [u8],
18820                ctx: ::buffa::DecodeContext<'_>,
18821            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18822                let _ = ctx;
18823                #[allow(unused_variables)]
18824                let view = self;
18825                let mut cur = cur;
18826                match tag.field_number() {
18827                    1u32 => {
18828                        ::buffa::encoding::check_wire_type(
18829                            tag,
18830                            ::buffa::encoding::WireType::Fixed64,
18831                        )?;
18832                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
18833                    }
18834                    2u32 => {
18835                        ::buffa::encoding::check_wire_type(
18836                            tag,
18837                            ::buffa::encoding::WireType::Fixed64,
18838                        )?;
18839                        view.subaccount_id = Some(
18840                            ::buffa::types::decode_fixed64(&mut cur)?,
18841                        );
18842                    }
18843                    _ => {
18844                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18845                        let span_len = before_tag.len() - cur.len();
18846                        view.__buffa_unknown_fields
18847                            .push_record(before_tag, span_len, ctx)?;
18848                    }
18849                }
18850                ::core::result::Result::Ok(cur)
18851            }
18852            fn to_owned_message(
18853                &self,
18854            ) -> ::core::result::Result<
18855                super::super::CancelTriggerRequest,
18856                ::buffa::DecodeError,
18857            > {
18858                self.to_owned_from_source(None)
18859            }
18860            #[allow(clippy::useless_conversion, clippy::needless_update)]
18861            fn to_owned_from_source(
18862                &self,
18863                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18864            ) -> ::core::result::Result<
18865                super::super::CancelTriggerRequest,
18866                ::buffa::DecodeError,
18867            > {
18868                #[allow(unused_imports)]
18869                use ::buffa::alloc::string::ToString as _;
18870                let _ = __buffa_src;
18871                ::core::result::Result::Ok(super::super::CancelTriggerRequest {
18872                    trigger_id: self.trigger_id,
18873                    subaccount_id: self.subaccount_id,
18874                    __buffa_unknown_fields: self
18875                        .__buffa_unknown_fields
18876                        .to_owned()?
18877                        .into(),
18878                    ..::core::default::Default::default()
18879                })
18880            }
18881        }
18882        impl<'a> ::buffa::ViewEncode<'a> for CancelTriggerRequestView<'a> {
18883            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18884            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
18885                #[allow(unused_imports)]
18886                use ::buffa::Enumeration as _;
18887                let mut size = 0u32;
18888                if self.trigger_id != 0u64 {
18889                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18890                }
18891                if self.subaccount_id.is_some() {
18892                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
18893                }
18894                size += self.__buffa_unknown_fields.encoded_len() as u32;
18895                size
18896            }
18897            #[allow(clippy::needless_borrow)]
18898            fn write_to(
18899                &self,
18900                _cache: &mut ::buffa::SizeCache,
18901                buf: &mut impl ::buffa::bytes::BufMut,
18902            ) {
18903                #[allow(unused_imports)]
18904                use ::buffa::Enumeration as _;
18905                if self.trigger_id != 0u64 {
18906                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
18907                }
18908                if let Some(v) = self.subaccount_id {
18909                    ::buffa::types::put_fixed64_field(2u32, v, buf);
18910                }
18911                self.__buffa_unknown_fields.write_to(buf);
18912            }
18913        }
18914        /// Serializes this view as protobuf JSON.
18915        ///
18916        /// Implicit-presence fields with default values are omitted, `required`
18917        /// fields are always emitted, explicit-presence (`optional`) fields are
18918        /// emitted only when set, bytes fields are base64-encoded, and enum
18919        /// values are their proto name strings.
18920        ///
18921        /// This impl uses `serialize_map(None)` because the number of emitted
18922        /// fields depends on default-omission rules; serializers that require
18923        /// known map lengths (e.g. `bincode`) will return a runtime error.
18924        /// Use the owned message type for those formats.
18925        impl<'__a> ::serde::Serialize for CancelTriggerRequestView<'__a> {
18926            fn serialize<__S: ::serde::Serializer>(
18927                &self,
18928                __s: __S,
18929            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18930                use ::serde::ser::SerializeMap as _;
18931                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18932                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
18933                    __map
18934                        .serialize_entry(
18935                            "triggerId",
18936                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
18937                        )?;
18938                }
18939                if let ::core::option::Option::Some(__v) = self.subaccount_id {
18940                    __map
18941                        .serialize_entry(
18942                            "subaccountId",
18943                            &::buffa::json_helpers::ProtoJson(&__v),
18944                        )?;
18945                }
18946                __map.end()
18947            }
18948        }
18949        impl<'a> ::buffa::MessageName for CancelTriggerRequestView<'a> {
18950            const PACKAGE: &'static str = "triggers.v1";
18951            const NAME: &'static str = "CancelTriggerRequest";
18952            const FULL_NAME: &'static str = "triggers.v1.CancelTriggerRequest";
18953            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerRequest";
18954        }
18955        ::buffa::impl_default_view_instance!(CancelTriggerRequestView);
18956        ::buffa::impl_view_reborrow!(CancelTriggerRequestView);
18957        /** Self-contained, `'static` owned view of a `CancelTriggerRequest` message.
18958
18959 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.
18960
18961 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.*/
18962        #[derive(Clone, Debug)]
18963        pub struct CancelTriggerRequestOwnedView(
18964            ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
18965        );
18966        impl CancelTriggerRequestOwnedView {
18967            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18968            ///
18969            /// The view borrows directly from the buffer's data; the buffer is
18970            /// retained inside the returned handle.
18971            ///
18972            /// # Errors
18973            ///
18974            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18975            /// protobuf data.
18976            pub fn decode(
18977                bytes: ::buffa::bytes::Bytes,
18978            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18979                ::core::result::Result::Ok(
18980                    CancelTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
18981                )
18982            }
18983            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18984            /// max message size).
18985            ///
18986            /// # Errors
18987            ///
18988            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18989            /// exceeds the configured limits.
18990            pub fn decode_with_options(
18991                bytes: ::buffa::bytes::Bytes,
18992                opts: &::buffa::DecodeOptions,
18993            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18994                ::core::result::Result::Ok(
18995                    CancelTriggerRequestOwnedView(
18996                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18997                    ),
18998                )
18999            }
19000            /// Build from an owned message via an encode → decode round-trip.
19001            ///
19002            /// # Errors
19003            ///
19004            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19005            /// somehow invalid (should not happen for well-formed messages).
19006            pub fn from_owned(
19007                msg: &super::super::CancelTriggerRequest,
19008            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19009                ::core::result::Result::Ok(
19010                    CancelTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
19011                )
19012            }
19013            /// Borrow the full [`CancelTriggerRequestView`] with its lifetime tied to `&self`.
19014            #[must_use]
19015            pub fn view(&self) -> &CancelTriggerRequestView<'_> {
19016                self.0.reborrow()
19017            }
19018            /// Convert to the owned message type.
19019            ///
19020            /// # Errors
19021            ///
19022            /// Returns an error if re-materializing preserved unknown fields
19023            /// fails (e.g. the unknown-field limit is exceeded).
19024            pub fn to_owned_message(
19025                &self,
19026            ) -> ::core::result::Result<
19027                super::super::CancelTriggerRequest,
19028                ::buffa::DecodeError,
19029            > {
19030                self.0.to_owned_message()
19031            }
19032            /// The underlying bytes buffer.
19033            #[must_use]
19034            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19035                self.0.bytes()
19036            }
19037            /// Consume the handle, returning the underlying bytes buffer.
19038            #[must_use]
19039            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19040                self.0.into_bytes()
19041            }
19042            /// Trigger ID to cancel.
19043            ///
19044            /// Field 1: `trigger_id`
19045            #[must_use]
19046            pub fn trigger_id(&self) -> u64 {
19047                self.0.reborrow().trigger_id
19048            }
19049            /// Optional sub-account for authorization.
19050            ///
19051            /// Field 2: `subaccount_id`
19052            #[must_use]
19053            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
19054                self.0.reborrow().subaccount_id
19055            }
19056        }
19057        impl ::core::convert::From<::buffa::OwnedView<CancelTriggerRequestView<'static>>>
19058        for CancelTriggerRequestOwnedView {
19059            fn from(
19060                inner: ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
19061            ) -> Self {
19062                CancelTriggerRequestOwnedView(inner)
19063            }
19064        }
19065        impl ::core::convert::From<CancelTriggerRequestOwnedView>
19066        for ::buffa::OwnedView<CancelTriggerRequestView<'static>> {
19067            fn from(wrapper: CancelTriggerRequestOwnedView) -> Self {
19068                wrapper.0
19069            }
19070        }
19071        impl ::core::convert::AsRef<
19072            ::buffa::OwnedView<CancelTriggerRequestView<'static>>,
19073        > for CancelTriggerRequestOwnedView {
19074            fn as_ref(&self) -> &::buffa::OwnedView<CancelTriggerRequestView<'static>> {
19075                &self.0
19076            }
19077        }
19078        impl ::buffa::HasMessageView for super::super::CancelTriggerRequest {
19079            type View<'a> = CancelTriggerRequestView<'a>;
19080            type ViewHandle = CancelTriggerRequestOwnedView;
19081        }
19082        impl ::serde::Serialize for CancelTriggerRequestOwnedView {
19083            fn serialize<__S: ::serde::Serializer>(
19084                &self,
19085                __s: __S,
19086            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19087                ::serde::Serialize::serialize(&self.0, __s)
19088            }
19089        }
19090        /// CancelTriggerResponse returns the final status after cancellation.
19091        #[derive(Clone, Debug, Default)]
19092        pub struct CancelTriggerResponseView<'a> {
19093            /// Trigger ID that was canceled.
19094            ///
19095            /// Field 1: `trigger_id`
19096            pub trigger_id: u64,
19097            /// Final status (should be STATUS_CANCELED).
19098            ///
19099            /// Field 2: `status`
19100            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
19101            /// Server timestamp.
19102            ///
19103            /// Field 3: `ts`
19104            pub ts: ::buffa::MessageFieldView<
19105                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
19106            >,
19107            /// Server timestamp in nanoseconds since epoch (UTC).
19108            ///
19109            /// Field 4: `ts_ns`
19110            pub ts_ns: u64,
19111            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19112        }
19113        impl<'a> ::buffa::MessageView<'a> for CancelTriggerResponseView<'a> {
19114            type Owned = super::super::CancelTriggerResponse;
19115            fn decode_view(
19116                buf: &'a [u8],
19117            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19118                let __limit = ::core::cell::Cell::new(
19119                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19120                );
19121                <Self as ::buffa::MessageView>::decode_view_ctx(
19122                    buf,
19123                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19124                )
19125            }
19126            fn decode_view_with_ctx(
19127                buf: &'a [u8],
19128                ctx: ::buffa::DecodeContext<'_>,
19129            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19130                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19131            }
19132            fn merge_view_field(
19133                &mut self,
19134                tag: ::buffa::encoding::Tag,
19135                cur: &'a [u8],
19136                before_tag: &'a [u8],
19137                ctx: ::buffa::DecodeContext<'_>,
19138            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19139                let _ = ctx;
19140                #[allow(unused_variables)]
19141                let view = self;
19142                let mut cur = cur;
19143                match tag.field_number() {
19144                    1u32 => {
19145                        ::buffa::encoding::check_wire_type(
19146                            tag,
19147                            ::buffa::encoding::WireType::Fixed64,
19148                        )?;
19149                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
19150                    }
19151                    2u32 => {
19152                        ::buffa::encoding::check_wire_type(
19153                            tag,
19154                            ::buffa::encoding::WireType::Varint,
19155                        )?;
19156                        view.status = ::buffa::EnumValue::from(
19157                            ::buffa::types::decode_int32(&mut cur)?,
19158                        );
19159                    }
19160                    3u32 => {
19161                        ::buffa::encoding::check_wire_type(
19162                            tag,
19163                            ::buffa::encoding::WireType::LengthDelimited,
19164                        )?;
19165                        let __sub_ctx = ctx.descend()?;
19166                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
19167                        match view.ts.as_mut() {
19168                            Some(existing) => {
19169                                ::buffa::MessageView::merge_into_view(
19170                                    existing,
19171                                    sub,
19172                                    __sub_ctx,
19173                                )?
19174                            }
19175                            None => {
19176                                view.ts = ::buffa::MessageFieldView::set(
19177                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
19178                                        sub,
19179                                        __sub_ctx,
19180                                    )?,
19181                                );
19182                            }
19183                        }
19184                    }
19185                    4u32 => {
19186                        ::buffa::encoding::check_wire_type(
19187                            tag,
19188                            ::buffa::encoding::WireType::Varint,
19189                        )?;
19190                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
19191                    }
19192                    _ => {
19193                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19194                        let span_len = before_tag.len() - cur.len();
19195                        view.__buffa_unknown_fields
19196                            .push_record(before_tag, span_len, ctx)?;
19197                    }
19198                }
19199                ::core::result::Result::Ok(cur)
19200            }
19201            fn to_owned_message(
19202                &self,
19203            ) -> ::core::result::Result<
19204                super::super::CancelTriggerResponse,
19205                ::buffa::DecodeError,
19206            > {
19207                self.to_owned_from_source(None)
19208            }
19209            #[allow(clippy::useless_conversion, clippy::needless_update)]
19210            fn to_owned_from_source(
19211                &self,
19212                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19213            ) -> ::core::result::Result<
19214                super::super::CancelTriggerResponse,
19215                ::buffa::DecodeError,
19216            > {
19217                #[allow(unused_imports)]
19218                use ::buffa::alloc::string::ToString as _;
19219                let _ = __buffa_src;
19220                ::core::result::Result::Ok(super::super::CancelTriggerResponse {
19221                    trigger_id: self.trigger_id,
19222                    status: self.status,
19223                    ts: match self.ts.as_option() {
19224                        Some(v) => {
19225                            ::buffa::MessageField::<
19226                                ::buffa_types::google::protobuf::Timestamp,
19227                            >::some(v.to_owned_from_source(__buffa_src)?)
19228                        }
19229                        None => ::buffa::MessageField::none(),
19230                    },
19231                    ts_ns: self.ts_ns,
19232                    __buffa_unknown_fields: self
19233                        .__buffa_unknown_fields
19234                        .to_owned()?
19235                        .into(),
19236                    ..::core::default::Default::default()
19237                })
19238            }
19239        }
19240        impl<'a> ::buffa::ViewEncode<'a> for CancelTriggerResponseView<'a> {
19241            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19242            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
19243                #[allow(unused_imports)]
19244                use ::buffa::Enumeration as _;
19245                let mut size = 0u32;
19246                if self.trigger_id != 0u64 {
19247                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19248                }
19249                {
19250                    let val = self.status.to_i32();
19251                    if val != 0 {
19252                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
19253                    }
19254                }
19255                if self.ts.is_set() {
19256                    let __slot = __cache.reserve();
19257                    let inner_size = self.ts.compute_size(__cache);
19258                    __cache.set(__slot, inner_size);
19259                    size
19260                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19261                            + inner_size;
19262                }
19263                if self.ts_ns != 0u64 {
19264                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
19265                }
19266                size += self.__buffa_unknown_fields.encoded_len() as u32;
19267                size
19268            }
19269            #[allow(clippy::needless_borrow)]
19270            fn write_to(
19271                &self,
19272                __cache: &mut ::buffa::SizeCache,
19273                buf: &mut impl ::buffa::bytes::BufMut,
19274            ) {
19275                #[allow(unused_imports)]
19276                use ::buffa::Enumeration as _;
19277                if self.trigger_id != 0u64 {
19278                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
19279                }
19280                {
19281                    let val = self.status.to_i32();
19282                    if val != 0 {
19283                        ::buffa::types::put_int32_field(2u32, val, buf);
19284                    }
19285                }
19286                if self.ts.is_set() {
19287                    ::buffa::types::put_len_delimited_header(
19288                        3u32,
19289                        __cache.consume_next(),
19290                        buf,
19291                    );
19292                    self.ts.write_to(__cache, buf);
19293                }
19294                if self.ts_ns != 0u64 {
19295                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
19296                }
19297                self.__buffa_unknown_fields.write_to(buf);
19298            }
19299        }
19300        /// Serializes this view as protobuf JSON.
19301        ///
19302        /// Implicit-presence fields with default values are omitted, `required`
19303        /// fields are always emitted, explicit-presence (`optional`) fields are
19304        /// emitted only when set, bytes fields are base64-encoded, and enum
19305        /// values are their proto name strings.
19306        ///
19307        /// This impl uses `serialize_map(None)` because the number of emitted
19308        /// fields depends on default-omission rules; serializers that require
19309        /// known map lengths (e.g. `bincode`) will return a runtime error.
19310        /// Use the owned message type for those formats.
19311        impl<'__a> ::serde::Serialize for CancelTriggerResponseView<'__a> {
19312            fn serialize<__S: ::serde::Serializer>(
19313                &self,
19314                __s: __S,
19315            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19316                use ::serde::ser::SerializeMap as _;
19317                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19318                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
19319                    __map
19320                        .serialize_entry(
19321                            "triggerId",
19322                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
19323                        )?;
19324                }
19325                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
19326                    __map.serialize_entry("status", &self.status)?;
19327                }
19328                {
19329                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
19330                        __map.serialize_entry("ts", __v)?;
19331                    }
19332                }
19333                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
19334                    __map
19335                        .serialize_entry(
19336                            "tsNs",
19337                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
19338                        )?;
19339                }
19340                __map.end()
19341            }
19342        }
19343        impl<'a> ::buffa::MessageName for CancelTriggerResponseView<'a> {
19344            const PACKAGE: &'static str = "triggers.v1";
19345            const NAME: &'static str = "CancelTriggerResponse";
19346            const FULL_NAME: &'static str = "triggers.v1.CancelTriggerResponse";
19347            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.CancelTriggerResponse";
19348        }
19349        ::buffa::impl_default_view_instance!(CancelTriggerResponseView);
19350        ::buffa::impl_view_reborrow!(CancelTriggerResponseView);
19351        /** Self-contained, `'static` owned view of a `CancelTriggerResponse` message.
19352
19353 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.
19354
19355 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.*/
19356        #[derive(Clone, Debug)]
19357        pub struct CancelTriggerResponseOwnedView(
19358            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19359        );
19360        impl CancelTriggerResponseOwnedView {
19361            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19362            ///
19363            /// The view borrows directly from the buffer's data; the buffer is
19364            /// retained inside the returned handle.
19365            ///
19366            /// # Errors
19367            ///
19368            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19369            /// protobuf data.
19370            pub fn decode(
19371                bytes: ::buffa::bytes::Bytes,
19372            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19373                ::core::result::Result::Ok(
19374                    CancelTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
19375                )
19376            }
19377            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19378            /// max message size).
19379            ///
19380            /// # Errors
19381            ///
19382            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19383            /// exceeds the configured limits.
19384            pub fn decode_with_options(
19385                bytes: ::buffa::bytes::Bytes,
19386                opts: &::buffa::DecodeOptions,
19387            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19388                ::core::result::Result::Ok(
19389                    CancelTriggerResponseOwnedView(
19390                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19391                    ),
19392                )
19393            }
19394            /// Build from an owned message via an encode → decode round-trip.
19395            ///
19396            /// # Errors
19397            ///
19398            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19399            /// somehow invalid (should not happen for well-formed messages).
19400            pub fn from_owned(
19401                msg: &super::super::CancelTriggerResponse,
19402            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19403                ::core::result::Result::Ok(
19404                    CancelTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
19405                )
19406            }
19407            /// Borrow the full [`CancelTriggerResponseView`] with its lifetime tied to `&self`.
19408            #[must_use]
19409            pub fn view(&self) -> &CancelTriggerResponseView<'_> {
19410                self.0.reborrow()
19411            }
19412            /// Convert to the owned message type.
19413            ///
19414            /// # Errors
19415            ///
19416            /// Returns an error if re-materializing preserved unknown fields
19417            /// fails (e.g. the unknown-field limit is exceeded).
19418            pub fn to_owned_message(
19419                &self,
19420            ) -> ::core::result::Result<
19421                super::super::CancelTriggerResponse,
19422                ::buffa::DecodeError,
19423            > {
19424                self.0.to_owned_message()
19425            }
19426            /// The underlying bytes buffer.
19427            #[must_use]
19428            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19429                self.0.bytes()
19430            }
19431            /// Consume the handle, returning the underlying bytes buffer.
19432            #[must_use]
19433            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19434                self.0.into_bytes()
19435            }
19436            /// Trigger ID that was canceled.
19437            ///
19438            /// Field 1: `trigger_id`
19439            #[must_use]
19440            pub fn trigger_id(&self) -> u64 {
19441                self.0.reborrow().trigger_id
19442            }
19443            /// Final status (should be STATUS_CANCELED).
19444            ///
19445            /// Field 2: `status`
19446            #[must_use]
19447            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
19448                self.0.reborrow().status
19449            }
19450            /// Server timestamp.
19451            ///
19452            /// Field 3: `ts`
19453            #[must_use]
19454            pub fn ts(
19455                &self,
19456            ) -> &::buffa::MessageFieldView<
19457                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
19458            > {
19459                &self.0.reborrow().ts
19460            }
19461            /// Server timestamp in nanoseconds since epoch (UTC).
19462            ///
19463            /// Field 4: `ts_ns`
19464            #[must_use]
19465            pub fn ts_ns(&self) -> u64 {
19466                self.0.reborrow().ts_ns
19467            }
19468        }
19469        impl ::core::convert::From<
19470            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19471        > for CancelTriggerResponseOwnedView {
19472            fn from(
19473                inner: ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19474            ) -> Self {
19475                CancelTriggerResponseOwnedView(inner)
19476            }
19477        }
19478        impl ::core::convert::From<CancelTriggerResponseOwnedView>
19479        for ::buffa::OwnedView<CancelTriggerResponseView<'static>> {
19480            fn from(wrapper: CancelTriggerResponseOwnedView) -> Self {
19481                wrapper.0
19482            }
19483        }
19484        impl ::core::convert::AsRef<
19485            ::buffa::OwnedView<CancelTriggerResponseView<'static>>,
19486        > for CancelTriggerResponseOwnedView {
19487            fn as_ref(&self) -> &::buffa::OwnedView<CancelTriggerResponseView<'static>> {
19488                &self.0
19489            }
19490        }
19491        impl ::buffa::HasMessageView for super::super::CancelTriggerResponse {
19492            type View<'a> = CancelTriggerResponseView<'a>;
19493            type ViewHandle = CancelTriggerResponseOwnedView;
19494        }
19495        impl ::serde::Serialize for CancelTriggerResponseOwnedView {
19496            fn serialize<__S: ::serde::Serializer>(
19497                &self,
19498                __s: __S,
19499            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19500                ::serde::Serialize::serialize(&self.0, __s)
19501            }
19502        }
19503        /// =============================================================================
19504        /// Modify / Pause / Resume Trigger
19505        /// =============================================================================
19506        ///
19507        /// ModifyTriggerRequest applies a limited patch to an existing trigger.
19508        #[derive(Clone, Debug, Default)]
19509        pub struct ModifyTriggerRequestView<'a> {
19510            /// Trigger ID to modify.
19511            ///
19512            /// Field 1: `trigger_id`
19513            pub trigger_id: u64,
19514            /// Optional sub-account for authorization.
19515            ///
19516            /// Field 2: `subaccount_id`
19517            pub subaccount_id: ::core::option::Option<u64>,
19518            /// Patch fields for safe price, trailing-distance, and slippage edits.
19519            /// For stop/take-profit:
19520            /// Updated trigger price in quote units scaled by 1e6.
19521            ///
19522            /// Field 10: `trigger_price_ticks`
19523            pub trigger_price_ticks: ::core::option::Option<i64>,
19524            /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
19525            ///
19526            /// Field 11: `limit_price_ticks`
19527            pub limit_price_ticks: ::core::option::Option<i64>,
19528            /// Updated activation price in quote units scaled by 1e6.
19529            ///
19530            /// Field 14: `activation_price_ticks`
19531            pub activation_price_ticks: ::core::option::Option<i64>,
19532            pub trailing_distance: ::core::option::Option<
19533                super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance,
19534            >,
19535            pub max_slippage: ::core::option::Option<
19536                super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage,
19537            >,
19538            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19539        }
19540        impl<'a> ::buffa::MessageView<'a> for ModifyTriggerRequestView<'a> {
19541            type Owned = super::super::ModifyTriggerRequest;
19542            fn decode_view(
19543                buf: &'a [u8],
19544            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19545                let __limit = ::core::cell::Cell::new(
19546                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19547                );
19548                <Self as ::buffa::MessageView>::decode_view_ctx(
19549                    buf,
19550                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19551                )
19552            }
19553            fn decode_view_with_ctx(
19554                buf: &'a [u8],
19555                ctx: ::buffa::DecodeContext<'_>,
19556            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19557                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19558            }
19559            fn merge_view_field(
19560                &mut self,
19561                tag: ::buffa::encoding::Tag,
19562                cur: &'a [u8],
19563                before_tag: &'a [u8],
19564                ctx: ::buffa::DecodeContext<'_>,
19565            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19566                let _ = ctx;
19567                #[allow(unused_variables)]
19568                let view = self;
19569                let mut cur = cur;
19570                match tag.field_number() {
19571                    1u32 => {
19572                        ::buffa::encoding::check_wire_type(
19573                            tag,
19574                            ::buffa::encoding::WireType::Fixed64,
19575                        )?;
19576                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
19577                    }
19578                    2u32 => {
19579                        ::buffa::encoding::check_wire_type(
19580                            tag,
19581                            ::buffa::encoding::WireType::Fixed64,
19582                        )?;
19583                        view.subaccount_id = Some(
19584                            ::buffa::types::decode_fixed64(&mut cur)?,
19585                        );
19586                    }
19587                    10u32 => {
19588                        ::buffa::encoding::check_wire_type(
19589                            tag,
19590                            ::buffa::encoding::WireType::Varint,
19591                        )?;
19592                        view.trigger_price_ticks = Some(
19593                            ::buffa::types::decode_int64(&mut cur)?,
19594                        );
19595                    }
19596                    11u32 => {
19597                        ::buffa::encoding::check_wire_type(
19598                            tag,
19599                            ::buffa::encoding::WireType::Varint,
19600                        )?;
19601                        view.limit_price_ticks = Some(
19602                            ::buffa::types::decode_int64(&mut cur)?,
19603                        );
19604                    }
19605                    14u32 => {
19606                        ::buffa::encoding::check_wire_type(
19607                            tag,
19608                            ::buffa::encoding::WireType::Varint,
19609                        )?;
19610                        view.activation_price_ticks = Some(
19611                            ::buffa::types::decode_int64(&mut cur)?,
19612                        );
19613                    }
19614                    12u32 => {
19615                        ::buffa::encoding::check_wire_type(
19616                            tag,
19617                            ::buffa::encoding::WireType::Varint,
19618                        )?;
19619                        view.trailing_distance = Some(
19620                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19621                                ::buffa::types::decode_int64(&mut cur)?,
19622                            ),
19623                        );
19624                    }
19625                    13u32 => {
19626                        ::buffa::encoding::check_wire_type(
19627                            tag,
19628                            ::buffa::encoding::WireType::Varint,
19629                        )?;
19630                        view.trailing_distance = Some(
19631                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19632                                ::buffa::types::decode_int32(&mut cur)?,
19633                            ),
19634                        );
19635                    }
19636                    15u32 => {
19637                        ::buffa::encoding::check_wire_type(
19638                            tag,
19639                            ::buffa::encoding::WireType::Varint,
19640                        )?;
19641                        view.max_slippage = Some(
19642                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19643                                ::buffa::types::decode_int32(&mut cur)?,
19644                            ),
19645                        );
19646                    }
19647                    16u32 => {
19648                        ::buffa::encoding::check_wire_type(
19649                            tag,
19650                            ::buffa::encoding::WireType::Varint,
19651                        )?;
19652                        view.max_slippage = Some(
19653                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19654                                ::buffa::types::decode_int32(&mut cur)?,
19655                            ),
19656                        );
19657                    }
19658                    _ => {
19659                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19660                        let span_len = before_tag.len() - cur.len();
19661                        view.__buffa_unknown_fields
19662                            .push_record(before_tag, span_len, ctx)?;
19663                    }
19664                }
19665                ::core::result::Result::Ok(cur)
19666            }
19667            fn to_owned_message(
19668                &self,
19669            ) -> ::core::result::Result<
19670                super::super::ModifyTriggerRequest,
19671                ::buffa::DecodeError,
19672            > {
19673                self.to_owned_from_source(None)
19674            }
19675            #[allow(clippy::useless_conversion, clippy::needless_update)]
19676            fn to_owned_from_source(
19677                &self,
19678                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19679            ) -> ::core::result::Result<
19680                super::super::ModifyTriggerRequest,
19681                ::buffa::DecodeError,
19682            > {
19683                #[allow(unused_imports)]
19684                use ::buffa::alloc::string::ToString as _;
19685                let _ = __buffa_src;
19686                ::core::result::Result::Ok(super::super::ModifyTriggerRequest {
19687                    trigger_id: self.trigger_id,
19688                    subaccount_id: self.subaccount_id,
19689                    trigger_price_ticks: self.trigger_price_ticks,
19690                    limit_price_ticks: self.limit_price_ticks,
19691                    activation_price_ticks: self.activation_price_ticks,
19692                    trailing_distance: self
19693                        .trailing_distance
19694                        .as_ref()
19695                        .map(|v| match v {
19696                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19697                                v,
19698                            ) => {
19699                                super::super::__buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19700                                    *v,
19701                                )
19702                            }
19703                            super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19704                                v,
19705                            ) => {
19706                                super::super::__buffa::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19707                                    *v,
19708                                )
19709                            }
19710                        }),
19711                    max_slippage: self
19712                        .max_slippage
19713                        .as_ref()
19714                        .map(|v| match v {
19715                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19716                                v,
19717                            ) => {
19718                                super::super::__buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19719                                    *v,
19720                                )
19721                            }
19722                            super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19723                                v,
19724                            ) => {
19725                                super::super::__buffa::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19726                                    *v,
19727                                )
19728                            }
19729                        }),
19730                    __buffa_unknown_fields: self
19731                        .__buffa_unknown_fields
19732                        .to_owned()?
19733                        .into(),
19734                    ..::core::default::Default::default()
19735                })
19736            }
19737        }
19738        impl<'a> ::buffa::ViewEncode<'a> for ModifyTriggerRequestView<'a> {
19739            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19740            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
19741                #[allow(unused_imports)]
19742                use ::buffa::Enumeration as _;
19743                let mut size = 0u32;
19744                if self.trigger_id != 0u64 {
19745                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19746                }
19747                if self.subaccount_id.is_some() {
19748                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
19749                }
19750                if let Some(v) = self.trigger_price_ticks {
19751                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19752                }
19753                if let Some(v) = self.limit_price_ticks {
19754                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19755                }
19756                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
19757                    match v {
19758                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19759                            v,
19760                        ) => {
19761                            size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
19762                        }
19763                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19764                            v,
19765                        ) => {
19766                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19767                        }
19768                    }
19769                }
19770                if let Some(v) = self.activation_price_ticks {
19771                    size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
19772                }
19773                if let ::core::option::Option::Some(ref v) = self.max_slippage {
19774                    match v {
19775                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19776                            v,
19777                        ) => {
19778                            size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19779                        }
19780                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19781                            v,
19782                        ) => {
19783                            size += 2u32 + ::buffa::types::int32_encoded_len(*v) as u32;
19784                        }
19785                    }
19786                }
19787                size += self.__buffa_unknown_fields.encoded_len() as u32;
19788                size
19789            }
19790            #[allow(clippy::needless_borrow)]
19791            fn write_to(
19792                &self,
19793                _cache: &mut ::buffa::SizeCache,
19794                buf: &mut impl ::buffa::bytes::BufMut,
19795            ) {
19796                #[allow(unused_imports)]
19797                use ::buffa::Enumeration as _;
19798                if self.trigger_id != 0u64 {
19799                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
19800                }
19801                if let Some(v) = self.subaccount_id {
19802                    ::buffa::types::put_fixed64_field(2u32, v, buf);
19803                }
19804                if let Some(v) = self.trigger_price_ticks {
19805                    ::buffa::types::put_int64_field(10u32, v, buf);
19806                }
19807                if let Some(v) = self.limit_price_ticks {
19808                    ::buffa::types::put_int64_field(11u32, v, buf);
19809                }
19810                if let ::core::option::Option::Some(ref v) = self.trailing_distance {
19811                    match v {
19812                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19813                            x,
19814                        ) => {
19815                            ::buffa::types::put_int64_field(12u32, *x, buf);
19816                        }
19817                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19818                            x,
19819                        ) => {
19820                            ::buffa::types::put_int32_field(13u32, *x, buf);
19821                        }
19822                    }
19823                }
19824                if let Some(v) = self.activation_price_ticks {
19825                    ::buffa::types::put_int64_field(14u32, v, buf);
19826                }
19827                if let ::core::option::Option::Some(ref v) = self.max_slippage {
19828                    match v {
19829                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19830                            x,
19831                        ) => {
19832                            ::buffa::types::put_int32_field(15u32, *x, buf);
19833                        }
19834                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19835                            x,
19836                        ) => {
19837                            ::buffa::types::put_int32_field(16u32, *x, buf);
19838                        }
19839                    }
19840                }
19841                self.__buffa_unknown_fields.write_to(buf);
19842            }
19843        }
19844        /// Serializes this view as protobuf JSON.
19845        ///
19846        /// Implicit-presence fields with default values are omitted, `required`
19847        /// fields are always emitted, explicit-presence (`optional`) fields are
19848        /// emitted only when set, bytes fields are base64-encoded, and enum
19849        /// values are their proto name strings.
19850        ///
19851        /// This impl uses `serialize_map(None)` because the number of emitted
19852        /// fields depends on default-omission rules; serializers that require
19853        /// known map lengths (e.g. `bincode`) will return a runtime error.
19854        /// Use the owned message type for those formats.
19855        impl<'__a> ::serde::Serialize for ModifyTriggerRequestView<'__a> {
19856            fn serialize<__S: ::serde::Serializer>(
19857                &self,
19858                __s: __S,
19859            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19860                use ::serde::ser::SerializeMap as _;
19861                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19862                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
19863                    __map
19864                        .serialize_entry(
19865                            "triggerId",
19866                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
19867                        )?;
19868                }
19869                if let ::core::option::Option::Some(__v) = self.subaccount_id {
19870                    __map
19871                        .serialize_entry(
19872                            "subaccountId",
19873                            &::buffa::json_helpers::ProtoJson(&__v),
19874                        )?;
19875                }
19876                if let ::core::option::Option::Some(__v) = self.trigger_price_ticks {
19877                    __map
19878                        .serialize_entry(
19879                            "triggerPriceTicks",
19880                            &::buffa::json_helpers::ProtoJson(&__v),
19881                        )?;
19882                }
19883                if let ::core::option::Option::Some(__v) = self.limit_price_ticks {
19884                    __map
19885                        .serialize_entry(
19886                            "limitPriceTicks",
19887                            &::buffa::json_helpers::ProtoJson(&__v),
19888                        )?;
19889                }
19890                if let ::core::option::Option::Some(__v) = self.activation_price_ticks {
19891                    __map
19892                        .serialize_entry(
19893                            "activationPriceTicks",
19894                            &::buffa::json_helpers::ProtoJson(&__v),
19895                        )?;
19896                }
19897                if let ::core::option::Option::Some(ref __ov) = self.trailing_distance {
19898                    match __ov {
19899                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceTicks(
19900                            v,
19901                        ) => {
19902                            __map
19903                                .serialize_entry(
19904                                    "trailingDistanceTicks",
19905                                    &::buffa::json_helpers::ProtoJson(v),
19906                                )?;
19907                        }
19908                        super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance::TrailingDistanceBps(
19909                            v,
19910                        ) => {
19911                            __map
19912                                .serialize_entry(
19913                                    "trailingDistanceBps",
19914                                    &::buffa::json_helpers::ProtoJson(v),
19915                                )?;
19916                        }
19917                    }
19918                }
19919                if let ::core::option::Option::Some(ref __ov) = self.max_slippage {
19920                    match __ov {
19921                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageTicks(
19922                            v,
19923                        ) => {
19924                            __map
19925                                .serialize_entry(
19926                                    "maxSlippageTicks",
19927                                    &::buffa::json_helpers::ProtoJson(v),
19928                                )?;
19929                        }
19930                        super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage::MaxSlippageBps(
19931                            v,
19932                        ) => {
19933                            __map
19934                                .serialize_entry(
19935                                    "maxSlippageBps",
19936                                    &::buffa::json_helpers::ProtoJson(v),
19937                                )?;
19938                        }
19939                    }
19940                }
19941                __map.end()
19942            }
19943        }
19944        impl<'a> ::buffa::MessageName for ModifyTriggerRequestView<'a> {
19945            const PACKAGE: &'static str = "triggers.v1";
19946            const NAME: &'static str = "ModifyTriggerRequest";
19947            const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerRequest";
19948            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerRequest";
19949        }
19950        ::buffa::impl_default_view_instance!(ModifyTriggerRequestView);
19951        ::buffa::impl_view_reborrow!(ModifyTriggerRequestView);
19952        /** Self-contained, `'static` owned view of a `ModifyTriggerRequest` message.
19953
19954 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.
19955
19956 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.*/
19957        #[derive(Clone, Debug)]
19958        pub struct ModifyTriggerRequestOwnedView(
19959            ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
19960        );
19961        impl ModifyTriggerRequestOwnedView {
19962            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19963            ///
19964            /// The view borrows directly from the buffer's data; the buffer is
19965            /// retained inside the returned handle.
19966            ///
19967            /// # Errors
19968            ///
19969            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19970            /// protobuf data.
19971            pub fn decode(
19972                bytes: ::buffa::bytes::Bytes,
19973            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19974                ::core::result::Result::Ok(
19975                    ModifyTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
19976                )
19977            }
19978            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19979            /// max message size).
19980            ///
19981            /// # Errors
19982            ///
19983            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19984            /// exceeds the configured limits.
19985            pub fn decode_with_options(
19986                bytes: ::buffa::bytes::Bytes,
19987                opts: &::buffa::DecodeOptions,
19988            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19989                ::core::result::Result::Ok(
19990                    ModifyTriggerRequestOwnedView(
19991                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19992                    ),
19993                )
19994            }
19995            /// Build from an owned message via an encode → decode round-trip.
19996            ///
19997            /// # Errors
19998            ///
19999            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20000            /// somehow invalid (should not happen for well-formed messages).
20001            pub fn from_owned(
20002                msg: &super::super::ModifyTriggerRequest,
20003            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20004                ::core::result::Result::Ok(
20005                    ModifyTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
20006                )
20007            }
20008            /// Borrow the full [`ModifyTriggerRequestView`] with its lifetime tied to `&self`.
20009            #[must_use]
20010            pub fn view(&self) -> &ModifyTriggerRequestView<'_> {
20011                self.0.reborrow()
20012            }
20013            /// Convert to the owned message type.
20014            ///
20015            /// # Errors
20016            ///
20017            /// Returns an error if re-materializing preserved unknown fields
20018            /// fails (e.g. the unknown-field limit is exceeded).
20019            pub fn to_owned_message(
20020                &self,
20021            ) -> ::core::result::Result<
20022                super::super::ModifyTriggerRequest,
20023                ::buffa::DecodeError,
20024            > {
20025                self.0.to_owned_message()
20026            }
20027            /// The underlying bytes buffer.
20028            #[must_use]
20029            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20030                self.0.bytes()
20031            }
20032            /// Consume the handle, returning the underlying bytes buffer.
20033            #[must_use]
20034            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20035                self.0.into_bytes()
20036            }
20037            /// Trigger ID to modify.
20038            ///
20039            /// Field 1: `trigger_id`
20040            #[must_use]
20041            pub fn trigger_id(&self) -> u64 {
20042                self.0.reborrow().trigger_id
20043            }
20044            /// Optional sub-account for authorization.
20045            ///
20046            /// Field 2: `subaccount_id`
20047            #[must_use]
20048            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
20049                self.0.reborrow().subaccount_id
20050            }
20051            /// Patch fields for safe price, trailing-distance, and slippage edits.
20052            /// For stop/take-profit:
20053            /// Updated trigger price in quote units scaled by 1e6.
20054            ///
20055            /// Field 10: `trigger_price_ticks`
20056            #[must_use]
20057            pub fn trigger_price_ticks(&self) -> ::core::option::Option<i64> {
20058                self.0.reborrow().trigger_price_ticks
20059            }
20060            /// Updated limit price in quote units scaled by 1e6 for LIMIT child orders.
20061            ///
20062            /// Field 11: `limit_price_ticks`
20063            #[must_use]
20064            pub fn limit_price_ticks(&self) -> ::core::option::Option<i64> {
20065                self.0.reborrow().limit_price_ticks
20066            }
20067            /// Updated activation price in quote units scaled by 1e6.
20068            ///
20069            /// Field 14: `activation_price_ticks`
20070            #[must_use]
20071            pub fn activation_price_ticks(&self) -> ::core::option::Option<i64> {
20072                self.0.reborrow().activation_price_ticks
20073            }
20074            /// Oneof `trailing_distance`.
20075            #[must_use]
20076            pub fn trailing_distance(
20077                &self,
20078            ) -> ::core::option::Option<
20079                &super::super::__buffa::view::oneof::modify_trigger_request::TrailingDistance,
20080            > {
20081                self.0.reborrow().trailing_distance.as_ref()
20082            }
20083            /// Oneof `max_slippage`.
20084            #[must_use]
20085            pub fn max_slippage(
20086                &self,
20087            ) -> ::core::option::Option<
20088                &super::super::__buffa::view::oneof::modify_trigger_request::MaxSlippage,
20089            > {
20090                self.0.reborrow().max_slippage.as_ref()
20091            }
20092        }
20093        impl ::core::convert::From<::buffa::OwnedView<ModifyTriggerRequestView<'static>>>
20094        for ModifyTriggerRequestOwnedView {
20095            fn from(
20096                inner: ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
20097            ) -> Self {
20098                ModifyTriggerRequestOwnedView(inner)
20099            }
20100        }
20101        impl ::core::convert::From<ModifyTriggerRequestOwnedView>
20102        for ::buffa::OwnedView<ModifyTriggerRequestView<'static>> {
20103            fn from(wrapper: ModifyTriggerRequestOwnedView) -> Self {
20104                wrapper.0
20105            }
20106        }
20107        impl ::core::convert::AsRef<
20108            ::buffa::OwnedView<ModifyTriggerRequestView<'static>>,
20109        > for ModifyTriggerRequestOwnedView {
20110            fn as_ref(&self) -> &::buffa::OwnedView<ModifyTriggerRequestView<'static>> {
20111                &self.0
20112            }
20113        }
20114        impl ::buffa::HasMessageView for super::super::ModifyTriggerRequest {
20115            type View<'a> = ModifyTriggerRequestView<'a>;
20116            type ViewHandle = ModifyTriggerRequestOwnedView;
20117        }
20118        impl ::serde::Serialize for ModifyTriggerRequestOwnedView {
20119            fn serialize<__S: ::serde::Serializer>(
20120                &self,
20121                __s: __S,
20122            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20123                ::serde::Serialize::serialize(&self.0, __s)
20124            }
20125        }
20126        /// ModifyTriggerResponse returns the trigger status after modification.
20127        #[derive(Clone, Debug, Default)]
20128        pub struct ModifyTriggerResponseView<'a> {
20129            /// Modified trigger ID.
20130            ///
20131            /// Field 1: `trigger_id`
20132            pub trigger_id: u64,
20133            /// Current trigger status after modification.
20134            ///
20135            /// Field 2: `status`
20136            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
20137            /// Server timestamp.
20138            ///
20139            /// Field 3: `ts`
20140            pub ts: ::buffa::MessageFieldView<
20141                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
20142            >,
20143            /// Server timestamp in nanoseconds since epoch (UTC).
20144            ///
20145            /// Field 4: `ts_ns`
20146            pub ts_ns: u64,
20147            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20148        }
20149        impl<'a> ::buffa::MessageView<'a> for ModifyTriggerResponseView<'a> {
20150            type Owned = super::super::ModifyTriggerResponse;
20151            fn decode_view(
20152                buf: &'a [u8],
20153            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20154                let __limit = ::core::cell::Cell::new(
20155                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20156                );
20157                <Self as ::buffa::MessageView>::decode_view_ctx(
20158                    buf,
20159                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20160                )
20161            }
20162            fn decode_view_with_ctx(
20163                buf: &'a [u8],
20164                ctx: ::buffa::DecodeContext<'_>,
20165            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20166                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20167            }
20168            fn merge_view_field(
20169                &mut self,
20170                tag: ::buffa::encoding::Tag,
20171                cur: &'a [u8],
20172                before_tag: &'a [u8],
20173                ctx: ::buffa::DecodeContext<'_>,
20174            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20175                let _ = ctx;
20176                #[allow(unused_variables)]
20177                let view = self;
20178                let mut cur = cur;
20179                match tag.field_number() {
20180                    1u32 => {
20181                        ::buffa::encoding::check_wire_type(
20182                            tag,
20183                            ::buffa::encoding::WireType::Fixed64,
20184                        )?;
20185                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20186                    }
20187                    2u32 => {
20188                        ::buffa::encoding::check_wire_type(
20189                            tag,
20190                            ::buffa::encoding::WireType::Varint,
20191                        )?;
20192                        view.status = ::buffa::EnumValue::from(
20193                            ::buffa::types::decode_int32(&mut cur)?,
20194                        );
20195                    }
20196                    3u32 => {
20197                        ::buffa::encoding::check_wire_type(
20198                            tag,
20199                            ::buffa::encoding::WireType::LengthDelimited,
20200                        )?;
20201                        let __sub_ctx = ctx.descend()?;
20202                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
20203                        match view.ts.as_mut() {
20204                            Some(existing) => {
20205                                ::buffa::MessageView::merge_into_view(
20206                                    existing,
20207                                    sub,
20208                                    __sub_ctx,
20209                                )?
20210                            }
20211                            None => {
20212                                view.ts = ::buffa::MessageFieldView::set(
20213                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
20214                                        sub,
20215                                        __sub_ctx,
20216                                    )?,
20217                                );
20218                            }
20219                        }
20220                    }
20221                    4u32 => {
20222                        ::buffa::encoding::check_wire_type(
20223                            tag,
20224                            ::buffa::encoding::WireType::Varint,
20225                        )?;
20226                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
20227                    }
20228                    _ => {
20229                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20230                        let span_len = before_tag.len() - cur.len();
20231                        view.__buffa_unknown_fields
20232                            .push_record(before_tag, span_len, ctx)?;
20233                    }
20234                }
20235                ::core::result::Result::Ok(cur)
20236            }
20237            fn to_owned_message(
20238                &self,
20239            ) -> ::core::result::Result<
20240                super::super::ModifyTriggerResponse,
20241                ::buffa::DecodeError,
20242            > {
20243                self.to_owned_from_source(None)
20244            }
20245            #[allow(clippy::useless_conversion, clippy::needless_update)]
20246            fn to_owned_from_source(
20247                &self,
20248                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20249            ) -> ::core::result::Result<
20250                super::super::ModifyTriggerResponse,
20251                ::buffa::DecodeError,
20252            > {
20253                #[allow(unused_imports)]
20254                use ::buffa::alloc::string::ToString as _;
20255                let _ = __buffa_src;
20256                ::core::result::Result::Ok(super::super::ModifyTriggerResponse {
20257                    trigger_id: self.trigger_id,
20258                    status: self.status,
20259                    ts: match self.ts.as_option() {
20260                        Some(v) => {
20261                            ::buffa::MessageField::<
20262                                ::buffa_types::google::protobuf::Timestamp,
20263                            >::some(v.to_owned_from_source(__buffa_src)?)
20264                        }
20265                        None => ::buffa::MessageField::none(),
20266                    },
20267                    ts_ns: self.ts_ns,
20268                    __buffa_unknown_fields: self
20269                        .__buffa_unknown_fields
20270                        .to_owned()?
20271                        .into(),
20272                    ..::core::default::Default::default()
20273                })
20274            }
20275        }
20276        impl<'a> ::buffa::ViewEncode<'a> for ModifyTriggerResponseView<'a> {
20277            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20278            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
20279                #[allow(unused_imports)]
20280                use ::buffa::Enumeration as _;
20281                let mut size = 0u32;
20282                if self.trigger_id != 0u64 {
20283                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20284                }
20285                {
20286                    let val = self.status.to_i32();
20287                    if val != 0 {
20288                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
20289                    }
20290                }
20291                if self.ts.is_set() {
20292                    let __slot = __cache.reserve();
20293                    let inner_size = self.ts.compute_size(__cache);
20294                    __cache.set(__slot, inner_size);
20295                    size
20296                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
20297                            + inner_size;
20298                }
20299                if self.ts_ns != 0u64 {
20300                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
20301                }
20302                size += self.__buffa_unknown_fields.encoded_len() as u32;
20303                size
20304            }
20305            #[allow(clippy::needless_borrow)]
20306            fn write_to(
20307                &self,
20308                __cache: &mut ::buffa::SizeCache,
20309                buf: &mut impl ::buffa::bytes::BufMut,
20310            ) {
20311                #[allow(unused_imports)]
20312                use ::buffa::Enumeration as _;
20313                if self.trigger_id != 0u64 {
20314                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20315                }
20316                {
20317                    let val = self.status.to_i32();
20318                    if val != 0 {
20319                        ::buffa::types::put_int32_field(2u32, val, buf);
20320                    }
20321                }
20322                if self.ts.is_set() {
20323                    ::buffa::types::put_len_delimited_header(
20324                        3u32,
20325                        __cache.consume_next(),
20326                        buf,
20327                    );
20328                    self.ts.write_to(__cache, buf);
20329                }
20330                if self.ts_ns != 0u64 {
20331                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
20332                }
20333                self.__buffa_unknown_fields.write_to(buf);
20334            }
20335        }
20336        /// Serializes this view as protobuf JSON.
20337        ///
20338        /// Implicit-presence fields with default values are omitted, `required`
20339        /// fields are always emitted, explicit-presence (`optional`) fields are
20340        /// emitted only when set, bytes fields are base64-encoded, and enum
20341        /// values are their proto name strings.
20342        ///
20343        /// This impl uses `serialize_map(None)` because the number of emitted
20344        /// fields depends on default-omission rules; serializers that require
20345        /// known map lengths (e.g. `bincode`) will return a runtime error.
20346        /// Use the owned message type for those formats.
20347        impl<'__a> ::serde::Serialize for ModifyTriggerResponseView<'__a> {
20348            fn serialize<__S: ::serde::Serializer>(
20349                &self,
20350                __s: __S,
20351            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20352                use ::serde::ser::SerializeMap as _;
20353                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20354                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20355                    __map
20356                        .serialize_entry(
20357                            "triggerId",
20358                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20359                        )?;
20360                }
20361                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
20362                    __map.serialize_entry("status", &self.status)?;
20363                }
20364                {
20365                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
20366                        __map.serialize_entry("ts", __v)?;
20367                    }
20368                }
20369                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
20370                    __map
20371                        .serialize_entry(
20372                            "tsNs",
20373                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
20374                        )?;
20375                }
20376                __map.end()
20377            }
20378        }
20379        impl<'a> ::buffa::MessageName for ModifyTriggerResponseView<'a> {
20380            const PACKAGE: &'static str = "triggers.v1";
20381            const NAME: &'static str = "ModifyTriggerResponse";
20382            const FULL_NAME: &'static str = "triggers.v1.ModifyTriggerResponse";
20383            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ModifyTriggerResponse";
20384        }
20385        ::buffa::impl_default_view_instance!(ModifyTriggerResponseView);
20386        ::buffa::impl_view_reborrow!(ModifyTriggerResponseView);
20387        /** Self-contained, `'static` owned view of a `ModifyTriggerResponse` message.
20388
20389 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.
20390
20391 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.*/
20392        #[derive(Clone, Debug)]
20393        pub struct ModifyTriggerResponseOwnedView(
20394            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20395        );
20396        impl ModifyTriggerResponseOwnedView {
20397            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20398            ///
20399            /// The view borrows directly from the buffer's data; the buffer is
20400            /// retained inside the returned handle.
20401            ///
20402            /// # Errors
20403            ///
20404            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20405            /// protobuf data.
20406            pub fn decode(
20407                bytes: ::buffa::bytes::Bytes,
20408            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20409                ::core::result::Result::Ok(
20410                    ModifyTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
20411                )
20412            }
20413            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20414            /// max message size).
20415            ///
20416            /// # Errors
20417            ///
20418            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20419            /// exceeds the configured limits.
20420            pub fn decode_with_options(
20421                bytes: ::buffa::bytes::Bytes,
20422                opts: &::buffa::DecodeOptions,
20423            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20424                ::core::result::Result::Ok(
20425                    ModifyTriggerResponseOwnedView(
20426                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20427                    ),
20428                )
20429            }
20430            /// Build from an owned message via an encode → decode round-trip.
20431            ///
20432            /// # Errors
20433            ///
20434            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20435            /// somehow invalid (should not happen for well-formed messages).
20436            pub fn from_owned(
20437                msg: &super::super::ModifyTriggerResponse,
20438            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20439                ::core::result::Result::Ok(
20440                    ModifyTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
20441                )
20442            }
20443            /// Borrow the full [`ModifyTriggerResponseView`] with its lifetime tied to `&self`.
20444            #[must_use]
20445            pub fn view(&self) -> &ModifyTriggerResponseView<'_> {
20446                self.0.reborrow()
20447            }
20448            /// Convert to the owned message type.
20449            ///
20450            /// # Errors
20451            ///
20452            /// Returns an error if re-materializing preserved unknown fields
20453            /// fails (e.g. the unknown-field limit is exceeded).
20454            pub fn to_owned_message(
20455                &self,
20456            ) -> ::core::result::Result<
20457                super::super::ModifyTriggerResponse,
20458                ::buffa::DecodeError,
20459            > {
20460                self.0.to_owned_message()
20461            }
20462            /// The underlying bytes buffer.
20463            #[must_use]
20464            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20465                self.0.bytes()
20466            }
20467            /// Consume the handle, returning the underlying bytes buffer.
20468            #[must_use]
20469            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20470                self.0.into_bytes()
20471            }
20472            /// Modified trigger ID.
20473            ///
20474            /// Field 1: `trigger_id`
20475            #[must_use]
20476            pub fn trigger_id(&self) -> u64 {
20477                self.0.reborrow().trigger_id
20478            }
20479            /// Current trigger status after modification.
20480            ///
20481            /// Field 2: `status`
20482            #[must_use]
20483            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
20484                self.0.reborrow().status
20485            }
20486            /// Server timestamp.
20487            ///
20488            /// Field 3: `ts`
20489            #[must_use]
20490            pub fn ts(
20491                &self,
20492            ) -> &::buffa::MessageFieldView<
20493                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
20494            > {
20495                &self.0.reborrow().ts
20496            }
20497            /// Server timestamp in nanoseconds since epoch (UTC).
20498            ///
20499            /// Field 4: `ts_ns`
20500            #[must_use]
20501            pub fn ts_ns(&self) -> u64 {
20502                self.0.reborrow().ts_ns
20503            }
20504        }
20505        impl ::core::convert::From<
20506            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20507        > for ModifyTriggerResponseOwnedView {
20508            fn from(
20509                inner: ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20510            ) -> Self {
20511                ModifyTriggerResponseOwnedView(inner)
20512            }
20513        }
20514        impl ::core::convert::From<ModifyTriggerResponseOwnedView>
20515        for ::buffa::OwnedView<ModifyTriggerResponseView<'static>> {
20516            fn from(wrapper: ModifyTriggerResponseOwnedView) -> Self {
20517                wrapper.0
20518            }
20519        }
20520        impl ::core::convert::AsRef<
20521            ::buffa::OwnedView<ModifyTriggerResponseView<'static>>,
20522        > for ModifyTriggerResponseOwnedView {
20523            fn as_ref(&self) -> &::buffa::OwnedView<ModifyTriggerResponseView<'static>> {
20524                &self.0
20525            }
20526        }
20527        impl ::buffa::HasMessageView for super::super::ModifyTriggerResponse {
20528            type View<'a> = ModifyTriggerResponseView<'a>;
20529            type ViewHandle = ModifyTriggerResponseOwnedView;
20530        }
20531        impl ::serde::Serialize for ModifyTriggerResponseOwnedView {
20532            fn serialize<__S: ::serde::Serializer>(
20533                &self,
20534                __s: __S,
20535            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20536                ::serde::Serialize::serialize(&self.0, __s)
20537            }
20538        }
20539        /// PauseTriggerRequest pauses an active trigger by ID.
20540        #[derive(Clone, Debug, Default)]
20541        pub struct PauseTriggerRequestView<'a> {
20542            /// Trigger ID to pause.
20543            ///
20544            /// Field 1: `trigger_id`
20545            pub trigger_id: u64,
20546            /// Optional sub-account for authorization.
20547            ///
20548            /// Field 2: `subaccount_id`
20549            pub subaccount_id: ::core::option::Option<u64>,
20550            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20551        }
20552        impl<'a> ::buffa::MessageView<'a> for PauseTriggerRequestView<'a> {
20553            type Owned = super::super::PauseTriggerRequest;
20554            fn decode_view(
20555                buf: &'a [u8],
20556            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20557                let __limit = ::core::cell::Cell::new(
20558                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20559                );
20560                <Self as ::buffa::MessageView>::decode_view_ctx(
20561                    buf,
20562                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20563                )
20564            }
20565            fn decode_view_with_ctx(
20566                buf: &'a [u8],
20567                ctx: ::buffa::DecodeContext<'_>,
20568            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20569                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20570            }
20571            fn merge_view_field(
20572                &mut self,
20573                tag: ::buffa::encoding::Tag,
20574                cur: &'a [u8],
20575                before_tag: &'a [u8],
20576                ctx: ::buffa::DecodeContext<'_>,
20577            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20578                let _ = ctx;
20579                #[allow(unused_variables)]
20580                let view = self;
20581                let mut cur = cur;
20582                match tag.field_number() {
20583                    1u32 => {
20584                        ::buffa::encoding::check_wire_type(
20585                            tag,
20586                            ::buffa::encoding::WireType::Fixed64,
20587                        )?;
20588                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20589                    }
20590                    2u32 => {
20591                        ::buffa::encoding::check_wire_type(
20592                            tag,
20593                            ::buffa::encoding::WireType::Fixed64,
20594                        )?;
20595                        view.subaccount_id = Some(
20596                            ::buffa::types::decode_fixed64(&mut cur)?,
20597                        );
20598                    }
20599                    _ => {
20600                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20601                        let span_len = before_tag.len() - cur.len();
20602                        view.__buffa_unknown_fields
20603                            .push_record(before_tag, span_len, ctx)?;
20604                    }
20605                }
20606                ::core::result::Result::Ok(cur)
20607            }
20608            fn to_owned_message(
20609                &self,
20610            ) -> ::core::result::Result<
20611                super::super::PauseTriggerRequest,
20612                ::buffa::DecodeError,
20613            > {
20614                self.to_owned_from_source(None)
20615            }
20616            #[allow(clippy::useless_conversion, clippy::needless_update)]
20617            fn to_owned_from_source(
20618                &self,
20619                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20620            ) -> ::core::result::Result<
20621                super::super::PauseTriggerRequest,
20622                ::buffa::DecodeError,
20623            > {
20624                #[allow(unused_imports)]
20625                use ::buffa::alloc::string::ToString as _;
20626                let _ = __buffa_src;
20627                ::core::result::Result::Ok(super::super::PauseTriggerRequest {
20628                    trigger_id: self.trigger_id,
20629                    subaccount_id: self.subaccount_id,
20630                    __buffa_unknown_fields: self
20631                        .__buffa_unknown_fields
20632                        .to_owned()?
20633                        .into(),
20634                    ..::core::default::Default::default()
20635                })
20636            }
20637        }
20638        impl<'a> ::buffa::ViewEncode<'a> for PauseTriggerRequestView<'a> {
20639            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20640            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
20641                #[allow(unused_imports)]
20642                use ::buffa::Enumeration as _;
20643                let mut size = 0u32;
20644                if self.trigger_id != 0u64 {
20645                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20646                }
20647                if self.subaccount_id.is_some() {
20648                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
20649                }
20650                size += self.__buffa_unknown_fields.encoded_len() as u32;
20651                size
20652            }
20653            #[allow(clippy::needless_borrow)]
20654            fn write_to(
20655                &self,
20656                _cache: &mut ::buffa::SizeCache,
20657                buf: &mut impl ::buffa::bytes::BufMut,
20658            ) {
20659                #[allow(unused_imports)]
20660                use ::buffa::Enumeration as _;
20661                if self.trigger_id != 0u64 {
20662                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
20663                }
20664                if let Some(v) = self.subaccount_id {
20665                    ::buffa::types::put_fixed64_field(2u32, v, buf);
20666                }
20667                self.__buffa_unknown_fields.write_to(buf);
20668            }
20669        }
20670        /// Serializes this view as protobuf JSON.
20671        ///
20672        /// Implicit-presence fields with default values are omitted, `required`
20673        /// fields are always emitted, explicit-presence (`optional`) fields are
20674        /// emitted only when set, bytes fields are base64-encoded, and enum
20675        /// values are their proto name strings.
20676        ///
20677        /// This impl uses `serialize_map(None)` because the number of emitted
20678        /// fields depends on default-omission rules; serializers that require
20679        /// known map lengths (e.g. `bincode`) will return a runtime error.
20680        /// Use the owned message type for those formats.
20681        impl<'__a> ::serde::Serialize for PauseTriggerRequestView<'__a> {
20682            fn serialize<__S: ::serde::Serializer>(
20683                &self,
20684                __s: __S,
20685            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20686                use ::serde::ser::SerializeMap as _;
20687                let mut __map = __s.serialize_map(::core::option::Option::None)?;
20688                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
20689                    __map
20690                        .serialize_entry(
20691                            "triggerId",
20692                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
20693                        )?;
20694                }
20695                if let ::core::option::Option::Some(__v) = self.subaccount_id {
20696                    __map
20697                        .serialize_entry(
20698                            "subaccountId",
20699                            &::buffa::json_helpers::ProtoJson(&__v),
20700                        )?;
20701                }
20702                __map.end()
20703            }
20704        }
20705        impl<'a> ::buffa::MessageName for PauseTriggerRequestView<'a> {
20706            const PACKAGE: &'static str = "triggers.v1";
20707            const NAME: &'static str = "PauseTriggerRequest";
20708            const FULL_NAME: &'static str = "triggers.v1.PauseTriggerRequest";
20709            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerRequest";
20710        }
20711        ::buffa::impl_default_view_instance!(PauseTriggerRequestView);
20712        ::buffa::impl_view_reborrow!(PauseTriggerRequestView);
20713        /** Self-contained, `'static` owned view of a `PauseTriggerRequest` message.
20714
20715 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.
20716
20717 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.*/
20718        #[derive(Clone, Debug)]
20719        pub struct PauseTriggerRequestOwnedView(
20720            ::buffa::OwnedView<PauseTriggerRequestView<'static>>,
20721        );
20722        impl PauseTriggerRequestOwnedView {
20723            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20724            ///
20725            /// The view borrows directly from the buffer's data; the buffer is
20726            /// retained inside the returned handle.
20727            ///
20728            /// # Errors
20729            ///
20730            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20731            /// protobuf data.
20732            pub fn decode(
20733                bytes: ::buffa::bytes::Bytes,
20734            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20735                ::core::result::Result::Ok(
20736                    PauseTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
20737                )
20738            }
20739            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20740            /// max message size).
20741            ///
20742            /// # Errors
20743            ///
20744            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20745            /// exceeds the configured limits.
20746            pub fn decode_with_options(
20747                bytes: ::buffa::bytes::Bytes,
20748                opts: &::buffa::DecodeOptions,
20749            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20750                ::core::result::Result::Ok(
20751                    PauseTriggerRequestOwnedView(
20752                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20753                    ),
20754                )
20755            }
20756            /// Build from an owned message via an encode → decode round-trip.
20757            ///
20758            /// # Errors
20759            ///
20760            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20761            /// somehow invalid (should not happen for well-formed messages).
20762            pub fn from_owned(
20763                msg: &super::super::PauseTriggerRequest,
20764            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20765                ::core::result::Result::Ok(
20766                    PauseTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
20767                )
20768            }
20769            /// Borrow the full [`PauseTriggerRequestView`] with its lifetime tied to `&self`.
20770            #[must_use]
20771            pub fn view(&self) -> &PauseTriggerRequestView<'_> {
20772                self.0.reborrow()
20773            }
20774            /// Convert to the owned message type.
20775            ///
20776            /// # Errors
20777            ///
20778            /// Returns an error if re-materializing preserved unknown fields
20779            /// fails (e.g. the unknown-field limit is exceeded).
20780            pub fn to_owned_message(
20781                &self,
20782            ) -> ::core::result::Result<
20783                super::super::PauseTriggerRequest,
20784                ::buffa::DecodeError,
20785            > {
20786                self.0.to_owned_message()
20787            }
20788            /// The underlying bytes buffer.
20789            #[must_use]
20790            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20791                self.0.bytes()
20792            }
20793            /// Consume the handle, returning the underlying bytes buffer.
20794            #[must_use]
20795            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20796                self.0.into_bytes()
20797            }
20798            /// Trigger ID to pause.
20799            ///
20800            /// Field 1: `trigger_id`
20801            #[must_use]
20802            pub fn trigger_id(&self) -> u64 {
20803                self.0.reborrow().trigger_id
20804            }
20805            /// Optional sub-account for authorization.
20806            ///
20807            /// Field 2: `subaccount_id`
20808            #[must_use]
20809            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
20810                self.0.reborrow().subaccount_id
20811            }
20812        }
20813        impl ::core::convert::From<::buffa::OwnedView<PauseTriggerRequestView<'static>>>
20814        for PauseTriggerRequestOwnedView {
20815            fn from(
20816                inner: ::buffa::OwnedView<PauseTriggerRequestView<'static>>,
20817            ) -> Self {
20818                PauseTriggerRequestOwnedView(inner)
20819            }
20820        }
20821        impl ::core::convert::From<PauseTriggerRequestOwnedView>
20822        for ::buffa::OwnedView<PauseTriggerRequestView<'static>> {
20823            fn from(wrapper: PauseTriggerRequestOwnedView) -> Self {
20824                wrapper.0
20825            }
20826        }
20827        impl ::core::convert::AsRef<::buffa::OwnedView<PauseTriggerRequestView<'static>>>
20828        for PauseTriggerRequestOwnedView {
20829            fn as_ref(&self) -> &::buffa::OwnedView<PauseTriggerRequestView<'static>> {
20830                &self.0
20831            }
20832        }
20833        impl ::buffa::HasMessageView for super::super::PauseTriggerRequest {
20834            type View<'a> = PauseTriggerRequestView<'a>;
20835            type ViewHandle = PauseTriggerRequestOwnedView;
20836        }
20837        impl ::serde::Serialize for PauseTriggerRequestOwnedView {
20838            fn serialize<__S: ::serde::Serializer>(
20839                &self,
20840                __s: __S,
20841            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20842                ::serde::Serialize::serialize(&self.0, __s)
20843            }
20844        }
20845        /// PauseTriggerResponse returns the trigger status after pausing.
20846        #[derive(Clone, Debug, Default)]
20847        pub struct PauseTriggerResponseView<'a> {
20848            /// Paused trigger ID.
20849            ///
20850            /// Field 1: `trigger_id`
20851            pub trigger_id: u64,
20852            /// Current trigger status after pausing.
20853            ///
20854            /// Field 2: `status`
20855            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
20856            /// Server timestamp.
20857            ///
20858            /// Field 3: `ts`
20859            pub ts: ::buffa::MessageFieldView<
20860                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
20861            >,
20862            /// Server timestamp in nanoseconds since epoch (UTC).
20863            ///
20864            /// Field 4: `ts_ns`
20865            pub ts_ns: u64,
20866            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
20867        }
20868        impl<'a> ::buffa::MessageView<'a> for PauseTriggerResponseView<'a> {
20869            type Owned = super::super::PauseTriggerResponse;
20870            fn decode_view(
20871                buf: &'a [u8],
20872            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20873                let __limit = ::core::cell::Cell::new(
20874                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
20875                );
20876                <Self as ::buffa::MessageView>::decode_view_ctx(
20877                    buf,
20878                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
20879                )
20880            }
20881            fn decode_view_with_ctx(
20882                buf: &'a [u8],
20883                ctx: ::buffa::DecodeContext<'_>,
20884            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20885                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
20886            }
20887            fn merge_view_field(
20888                &mut self,
20889                tag: ::buffa::encoding::Tag,
20890                cur: &'a [u8],
20891                before_tag: &'a [u8],
20892                ctx: ::buffa::DecodeContext<'_>,
20893            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
20894                let _ = ctx;
20895                #[allow(unused_variables)]
20896                let view = self;
20897                let mut cur = cur;
20898                match tag.field_number() {
20899                    1u32 => {
20900                        ::buffa::encoding::check_wire_type(
20901                            tag,
20902                            ::buffa::encoding::WireType::Fixed64,
20903                        )?;
20904                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
20905                    }
20906                    2u32 => {
20907                        ::buffa::encoding::check_wire_type(
20908                            tag,
20909                            ::buffa::encoding::WireType::Varint,
20910                        )?;
20911                        view.status = ::buffa::EnumValue::from(
20912                            ::buffa::types::decode_int32(&mut cur)?,
20913                        );
20914                    }
20915                    3u32 => {
20916                        ::buffa::encoding::check_wire_type(
20917                            tag,
20918                            ::buffa::encoding::WireType::LengthDelimited,
20919                        )?;
20920                        let __sub_ctx = ctx.descend()?;
20921                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
20922                        match view.ts.as_mut() {
20923                            Some(existing) => {
20924                                ::buffa::MessageView::merge_into_view(
20925                                    existing,
20926                                    sub,
20927                                    __sub_ctx,
20928                                )?
20929                            }
20930                            None => {
20931                                view.ts = ::buffa::MessageFieldView::set(
20932                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
20933                                        sub,
20934                                        __sub_ctx,
20935                                    )?,
20936                                );
20937                            }
20938                        }
20939                    }
20940                    4u32 => {
20941                        ::buffa::encoding::check_wire_type(
20942                            tag,
20943                            ::buffa::encoding::WireType::Varint,
20944                        )?;
20945                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
20946                    }
20947                    _ => {
20948                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
20949                        let span_len = before_tag.len() - cur.len();
20950                        view.__buffa_unknown_fields
20951                            .push_record(before_tag, span_len, ctx)?;
20952                    }
20953                }
20954                ::core::result::Result::Ok(cur)
20955            }
20956            fn to_owned_message(
20957                &self,
20958            ) -> ::core::result::Result<
20959                super::super::PauseTriggerResponse,
20960                ::buffa::DecodeError,
20961            > {
20962                self.to_owned_from_source(None)
20963            }
20964            #[allow(clippy::useless_conversion, clippy::needless_update)]
20965            fn to_owned_from_source(
20966                &self,
20967                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
20968            ) -> ::core::result::Result<
20969                super::super::PauseTriggerResponse,
20970                ::buffa::DecodeError,
20971            > {
20972                #[allow(unused_imports)]
20973                use ::buffa::alloc::string::ToString as _;
20974                let _ = __buffa_src;
20975                ::core::result::Result::Ok(super::super::PauseTriggerResponse {
20976                    trigger_id: self.trigger_id,
20977                    status: self.status,
20978                    ts: match self.ts.as_option() {
20979                        Some(v) => {
20980                            ::buffa::MessageField::<
20981                                ::buffa_types::google::protobuf::Timestamp,
20982                            >::some(v.to_owned_from_source(__buffa_src)?)
20983                        }
20984                        None => ::buffa::MessageField::none(),
20985                    },
20986                    ts_ns: self.ts_ns,
20987                    __buffa_unknown_fields: self
20988                        .__buffa_unknown_fields
20989                        .to_owned()?
20990                        .into(),
20991                    ..::core::default::Default::default()
20992                })
20993            }
20994        }
20995        impl<'a> ::buffa::ViewEncode<'a> for PauseTriggerResponseView<'a> {
20996            #[allow(clippy::needless_borrow, clippy::let_and_return)]
20997            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
20998                #[allow(unused_imports)]
20999                use ::buffa::Enumeration as _;
21000                let mut size = 0u32;
21001                if self.trigger_id != 0u64 {
21002                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21003                }
21004                {
21005                    let val = self.status.to_i32();
21006                    if val != 0 {
21007                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
21008                    }
21009                }
21010                if self.ts.is_set() {
21011                    let __slot = __cache.reserve();
21012                    let inner_size = self.ts.compute_size(__cache);
21013                    __cache.set(__slot, inner_size);
21014                    size
21015                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
21016                            + inner_size;
21017                }
21018                if self.ts_ns != 0u64 {
21019                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
21020                }
21021                size += self.__buffa_unknown_fields.encoded_len() as u32;
21022                size
21023            }
21024            #[allow(clippy::needless_borrow)]
21025            fn write_to(
21026                &self,
21027                __cache: &mut ::buffa::SizeCache,
21028                buf: &mut impl ::buffa::bytes::BufMut,
21029            ) {
21030                #[allow(unused_imports)]
21031                use ::buffa::Enumeration as _;
21032                if self.trigger_id != 0u64 {
21033                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21034                }
21035                {
21036                    let val = self.status.to_i32();
21037                    if val != 0 {
21038                        ::buffa::types::put_int32_field(2u32, val, buf);
21039                    }
21040                }
21041                if self.ts.is_set() {
21042                    ::buffa::types::put_len_delimited_header(
21043                        3u32,
21044                        __cache.consume_next(),
21045                        buf,
21046                    );
21047                    self.ts.write_to(__cache, buf);
21048                }
21049                if self.ts_ns != 0u64 {
21050                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
21051                }
21052                self.__buffa_unknown_fields.write_to(buf);
21053            }
21054        }
21055        /// Serializes this view as protobuf JSON.
21056        ///
21057        /// Implicit-presence fields with default values are omitted, `required`
21058        /// fields are always emitted, explicit-presence (`optional`) fields are
21059        /// emitted only when set, bytes fields are base64-encoded, and enum
21060        /// values are their proto name strings.
21061        ///
21062        /// This impl uses `serialize_map(None)` because the number of emitted
21063        /// fields depends on default-omission rules; serializers that require
21064        /// known map lengths (e.g. `bincode`) will return a runtime error.
21065        /// Use the owned message type for those formats.
21066        impl<'__a> ::serde::Serialize for PauseTriggerResponseView<'__a> {
21067            fn serialize<__S: ::serde::Serializer>(
21068                &self,
21069                __s: __S,
21070            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21071                use ::serde::ser::SerializeMap as _;
21072                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21073                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21074                    __map
21075                        .serialize_entry(
21076                            "triggerId",
21077                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21078                        )?;
21079                }
21080                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
21081                    __map.serialize_entry("status", &self.status)?;
21082                }
21083                {
21084                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
21085                        __map.serialize_entry("ts", __v)?;
21086                    }
21087                }
21088                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
21089                    __map
21090                        .serialize_entry(
21091                            "tsNs",
21092                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
21093                        )?;
21094                }
21095                __map.end()
21096            }
21097        }
21098        impl<'a> ::buffa::MessageName for PauseTriggerResponseView<'a> {
21099            const PACKAGE: &'static str = "triggers.v1";
21100            const NAME: &'static str = "PauseTriggerResponse";
21101            const FULL_NAME: &'static str = "triggers.v1.PauseTriggerResponse";
21102            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.PauseTriggerResponse";
21103        }
21104        ::buffa::impl_default_view_instance!(PauseTriggerResponseView);
21105        ::buffa::impl_view_reborrow!(PauseTriggerResponseView);
21106        /** Self-contained, `'static` owned view of a `PauseTriggerResponse` message.
21107
21108 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.
21109
21110 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.*/
21111        #[derive(Clone, Debug)]
21112        pub struct PauseTriggerResponseOwnedView(
21113            ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21114        );
21115        impl PauseTriggerResponseOwnedView {
21116            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21117            ///
21118            /// The view borrows directly from the buffer's data; the buffer is
21119            /// retained inside the returned handle.
21120            ///
21121            /// # Errors
21122            ///
21123            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21124            /// protobuf data.
21125            pub fn decode(
21126                bytes: ::buffa::bytes::Bytes,
21127            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21128                ::core::result::Result::Ok(
21129                    PauseTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
21130                )
21131            }
21132            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21133            /// max message size).
21134            ///
21135            /// # Errors
21136            ///
21137            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21138            /// exceeds the configured limits.
21139            pub fn decode_with_options(
21140                bytes: ::buffa::bytes::Bytes,
21141                opts: &::buffa::DecodeOptions,
21142            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21143                ::core::result::Result::Ok(
21144                    PauseTriggerResponseOwnedView(
21145                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21146                    ),
21147                )
21148            }
21149            /// Build from an owned message via an encode → decode round-trip.
21150            ///
21151            /// # Errors
21152            ///
21153            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21154            /// somehow invalid (should not happen for well-formed messages).
21155            pub fn from_owned(
21156                msg: &super::super::PauseTriggerResponse,
21157            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21158                ::core::result::Result::Ok(
21159                    PauseTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
21160                )
21161            }
21162            /// Borrow the full [`PauseTriggerResponseView`] with its lifetime tied to `&self`.
21163            #[must_use]
21164            pub fn view(&self) -> &PauseTriggerResponseView<'_> {
21165                self.0.reborrow()
21166            }
21167            /// Convert to the owned message type.
21168            ///
21169            /// # Errors
21170            ///
21171            /// Returns an error if re-materializing preserved unknown fields
21172            /// fails (e.g. the unknown-field limit is exceeded).
21173            pub fn to_owned_message(
21174                &self,
21175            ) -> ::core::result::Result<
21176                super::super::PauseTriggerResponse,
21177                ::buffa::DecodeError,
21178            > {
21179                self.0.to_owned_message()
21180            }
21181            /// The underlying bytes buffer.
21182            #[must_use]
21183            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21184                self.0.bytes()
21185            }
21186            /// Consume the handle, returning the underlying bytes buffer.
21187            #[must_use]
21188            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21189                self.0.into_bytes()
21190            }
21191            /// Paused trigger ID.
21192            ///
21193            /// Field 1: `trigger_id`
21194            #[must_use]
21195            pub fn trigger_id(&self) -> u64 {
21196                self.0.reborrow().trigger_id
21197            }
21198            /// Current trigger status after pausing.
21199            ///
21200            /// Field 2: `status`
21201            #[must_use]
21202            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
21203                self.0.reborrow().status
21204            }
21205            /// Server timestamp.
21206            ///
21207            /// Field 3: `ts`
21208            #[must_use]
21209            pub fn ts(
21210                &self,
21211            ) -> &::buffa::MessageFieldView<
21212                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
21213            > {
21214                &self.0.reborrow().ts
21215            }
21216            /// Server timestamp in nanoseconds since epoch (UTC).
21217            ///
21218            /// Field 4: `ts_ns`
21219            #[must_use]
21220            pub fn ts_ns(&self) -> u64 {
21221                self.0.reborrow().ts_ns
21222            }
21223        }
21224        impl ::core::convert::From<::buffa::OwnedView<PauseTriggerResponseView<'static>>>
21225        for PauseTriggerResponseOwnedView {
21226            fn from(
21227                inner: ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21228            ) -> Self {
21229                PauseTriggerResponseOwnedView(inner)
21230            }
21231        }
21232        impl ::core::convert::From<PauseTriggerResponseOwnedView>
21233        for ::buffa::OwnedView<PauseTriggerResponseView<'static>> {
21234            fn from(wrapper: PauseTriggerResponseOwnedView) -> Self {
21235                wrapper.0
21236            }
21237        }
21238        impl ::core::convert::AsRef<
21239            ::buffa::OwnedView<PauseTriggerResponseView<'static>>,
21240        > for PauseTriggerResponseOwnedView {
21241            fn as_ref(&self) -> &::buffa::OwnedView<PauseTriggerResponseView<'static>> {
21242                &self.0
21243            }
21244        }
21245        impl ::buffa::HasMessageView for super::super::PauseTriggerResponse {
21246            type View<'a> = PauseTriggerResponseView<'a>;
21247            type ViewHandle = PauseTriggerResponseOwnedView;
21248        }
21249        impl ::serde::Serialize for PauseTriggerResponseOwnedView {
21250            fn serialize<__S: ::serde::Serializer>(
21251                &self,
21252                __s: __S,
21253            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21254                ::serde::Serialize::serialize(&self.0, __s)
21255            }
21256        }
21257        /// ResumeTriggerRequest resumes a paused trigger by ID.
21258        #[derive(Clone, Debug, Default)]
21259        pub struct ResumeTriggerRequestView<'a> {
21260            /// Trigger ID to resume.
21261            ///
21262            /// Field 1: `trigger_id`
21263            pub trigger_id: u64,
21264            /// Optional sub-account for authorization.
21265            ///
21266            /// Field 2: `subaccount_id`
21267            pub subaccount_id: ::core::option::Option<u64>,
21268            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21269        }
21270        impl<'a> ::buffa::MessageView<'a> for ResumeTriggerRequestView<'a> {
21271            type Owned = super::super::ResumeTriggerRequest;
21272            fn decode_view(
21273                buf: &'a [u8],
21274            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21275                let __limit = ::core::cell::Cell::new(
21276                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21277                );
21278                <Self as ::buffa::MessageView>::decode_view_ctx(
21279                    buf,
21280                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21281                )
21282            }
21283            fn decode_view_with_ctx(
21284                buf: &'a [u8],
21285                ctx: ::buffa::DecodeContext<'_>,
21286            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21287                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21288            }
21289            fn merge_view_field(
21290                &mut self,
21291                tag: ::buffa::encoding::Tag,
21292                cur: &'a [u8],
21293                before_tag: &'a [u8],
21294                ctx: ::buffa::DecodeContext<'_>,
21295            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21296                let _ = ctx;
21297                #[allow(unused_variables)]
21298                let view = self;
21299                let mut cur = cur;
21300                match tag.field_number() {
21301                    1u32 => {
21302                        ::buffa::encoding::check_wire_type(
21303                            tag,
21304                            ::buffa::encoding::WireType::Fixed64,
21305                        )?;
21306                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
21307                    }
21308                    2u32 => {
21309                        ::buffa::encoding::check_wire_type(
21310                            tag,
21311                            ::buffa::encoding::WireType::Fixed64,
21312                        )?;
21313                        view.subaccount_id = Some(
21314                            ::buffa::types::decode_fixed64(&mut cur)?,
21315                        );
21316                    }
21317                    _ => {
21318                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21319                        let span_len = before_tag.len() - cur.len();
21320                        view.__buffa_unknown_fields
21321                            .push_record(before_tag, span_len, ctx)?;
21322                    }
21323                }
21324                ::core::result::Result::Ok(cur)
21325            }
21326            fn to_owned_message(
21327                &self,
21328            ) -> ::core::result::Result<
21329                super::super::ResumeTriggerRequest,
21330                ::buffa::DecodeError,
21331            > {
21332                self.to_owned_from_source(None)
21333            }
21334            #[allow(clippy::useless_conversion, clippy::needless_update)]
21335            fn to_owned_from_source(
21336                &self,
21337                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21338            ) -> ::core::result::Result<
21339                super::super::ResumeTriggerRequest,
21340                ::buffa::DecodeError,
21341            > {
21342                #[allow(unused_imports)]
21343                use ::buffa::alloc::string::ToString as _;
21344                let _ = __buffa_src;
21345                ::core::result::Result::Ok(super::super::ResumeTriggerRequest {
21346                    trigger_id: self.trigger_id,
21347                    subaccount_id: self.subaccount_id,
21348                    __buffa_unknown_fields: self
21349                        .__buffa_unknown_fields
21350                        .to_owned()?
21351                        .into(),
21352                    ..::core::default::Default::default()
21353                })
21354            }
21355        }
21356        impl<'a> ::buffa::ViewEncode<'a> for ResumeTriggerRequestView<'a> {
21357            #[allow(clippy::needless_borrow, clippy::let_and_return)]
21358            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
21359                #[allow(unused_imports)]
21360                use ::buffa::Enumeration as _;
21361                let mut size = 0u32;
21362                if self.trigger_id != 0u64 {
21363                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21364                }
21365                if self.subaccount_id.is_some() {
21366                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21367                }
21368                size += self.__buffa_unknown_fields.encoded_len() as u32;
21369                size
21370            }
21371            #[allow(clippy::needless_borrow)]
21372            fn write_to(
21373                &self,
21374                _cache: &mut ::buffa::SizeCache,
21375                buf: &mut impl ::buffa::bytes::BufMut,
21376            ) {
21377                #[allow(unused_imports)]
21378                use ::buffa::Enumeration as _;
21379                if self.trigger_id != 0u64 {
21380                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21381                }
21382                if let Some(v) = self.subaccount_id {
21383                    ::buffa::types::put_fixed64_field(2u32, v, buf);
21384                }
21385                self.__buffa_unknown_fields.write_to(buf);
21386            }
21387        }
21388        /// Serializes this view as protobuf JSON.
21389        ///
21390        /// Implicit-presence fields with default values are omitted, `required`
21391        /// fields are always emitted, explicit-presence (`optional`) fields are
21392        /// emitted only when set, bytes fields are base64-encoded, and enum
21393        /// values are their proto name strings.
21394        ///
21395        /// This impl uses `serialize_map(None)` because the number of emitted
21396        /// fields depends on default-omission rules; serializers that require
21397        /// known map lengths (e.g. `bincode`) will return a runtime error.
21398        /// Use the owned message type for those formats.
21399        impl<'__a> ::serde::Serialize for ResumeTriggerRequestView<'__a> {
21400            fn serialize<__S: ::serde::Serializer>(
21401                &self,
21402                __s: __S,
21403            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21404                use ::serde::ser::SerializeMap as _;
21405                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21406                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21407                    __map
21408                        .serialize_entry(
21409                            "triggerId",
21410                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21411                        )?;
21412                }
21413                if let ::core::option::Option::Some(__v) = self.subaccount_id {
21414                    __map
21415                        .serialize_entry(
21416                            "subaccountId",
21417                            &::buffa::json_helpers::ProtoJson(&__v),
21418                        )?;
21419                }
21420                __map.end()
21421            }
21422        }
21423        impl<'a> ::buffa::MessageName for ResumeTriggerRequestView<'a> {
21424            const PACKAGE: &'static str = "triggers.v1";
21425            const NAME: &'static str = "ResumeTriggerRequest";
21426            const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerRequest";
21427            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerRequest";
21428        }
21429        ::buffa::impl_default_view_instance!(ResumeTriggerRequestView);
21430        ::buffa::impl_view_reborrow!(ResumeTriggerRequestView);
21431        /** Self-contained, `'static` owned view of a `ResumeTriggerRequest` message.
21432
21433 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.
21434
21435 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.*/
21436        #[derive(Clone, Debug)]
21437        pub struct ResumeTriggerRequestOwnedView(
21438            ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21439        );
21440        impl ResumeTriggerRequestOwnedView {
21441            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21442            ///
21443            /// The view borrows directly from the buffer's data; the buffer is
21444            /// retained inside the returned handle.
21445            ///
21446            /// # Errors
21447            ///
21448            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21449            /// protobuf data.
21450            pub fn decode(
21451                bytes: ::buffa::bytes::Bytes,
21452            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21453                ::core::result::Result::Ok(
21454                    ResumeTriggerRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
21455                )
21456            }
21457            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21458            /// max message size).
21459            ///
21460            /// # Errors
21461            ///
21462            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21463            /// exceeds the configured limits.
21464            pub fn decode_with_options(
21465                bytes: ::buffa::bytes::Bytes,
21466                opts: &::buffa::DecodeOptions,
21467            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21468                ::core::result::Result::Ok(
21469                    ResumeTriggerRequestOwnedView(
21470                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21471                    ),
21472                )
21473            }
21474            /// Build from an owned message via an encode → decode round-trip.
21475            ///
21476            /// # Errors
21477            ///
21478            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21479            /// somehow invalid (should not happen for well-formed messages).
21480            pub fn from_owned(
21481                msg: &super::super::ResumeTriggerRequest,
21482            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21483                ::core::result::Result::Ok(
21484                    ResumeTriggerRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
21485                )
21486            }
21487            /// Borrow the full [`ResumeTriggerRequestView`] with its lifetime tied to `&self`.
21488            #[must_use]
21489            pub fn view(&self) -> &ResumeTriggerRequestView<'_> {
21490                self.0.reborrow()
21491            }
21492            /// Convert to the owned message type.
21493            ///
21494            /// # Errors
21495            ///
21496            /// Returns an error if re-materializing preserved unknown fields
21497            /// fails (e.g. the unknown-field limit is exceeded).
21498            pub fn to_owned_message(
21499                &self,
21500            ) -> ::core::result::Result<
21501                super::super::ResumeTriggerRequest,
21502                ::buffa::DecodeError,
21503            > {
21504                self.0.to_owned_message()
21505            }
21506            /// The underlying bytes buffer.
21507            #[must_use]
21508            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21509                self.0.bytes()
21510            }
21511            /// Consume the handle, returning the underlying bytes buffer.
21512            #[must_use]
21513            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21514                self.0.into_bytes()
21515            }
21516            /// Trigger ID to resume.
21517            ///
21518            /// Field 1: `trigger_id`
21519            #[must_use]
21520            pub fn trigger_id(&self) -> u64 {
21521                self.0.reborrow().trigger_id
21522            }
21523            /// Optional sub-account for authorization.
21524            ///
21525            /// Field 2: `subaccount_id`
21526            #[must_use]
21527            pub fn subaccount_id(&self) -> ::core::option::Option<u64> {
21528                self.0.reborrow().subaccount_id
21529            }
21530        }
21531        impl ::core::convert::From<::buffa::OwnedView<ResumeTriggerRequestView<'static>>>
21532        for ResumeTriggerRequestOwnedView {
21533            fn from(
21534                inner: ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21535            ) -> Self {
21536                ResumeTriggerRequestOwnedView(inner)
21537            }
21538        }
21539        impl ::core::convert::From<ResumeTriggerRequestOwnedView>
21540        for ::buffa::OwnedView<ResumeTriggerRequestView<'static>> {
21541            fn from(wrapper: ResumeTriggerRequestOwnedView) -> Self {
21542                wrapper.0
21543            }
21544        }
21545        impl ::core::convert::AsRef<
21546            ::buffa::OwnedView<ResumeTriggerRequestView<'static>>,
21547        > for ResumeTriggerRequestOwnedView {
21548            fn as_ref(&self) -> &::buffa::OwnedView<ResumeTriggerRequestView<'static>> {
21549                &self.0
21550            }
21551        }
21552        impl ::buffa::HasMessageView for super::super::ResumeTriggerRequest {
21553            type View<'a> = ResumeTriggerRequestView<'a>;
21554            type ViewHandle = ResumeTriggerRequestOwnedView;
21555        }
21556        impl ::serde::Serialize for ResumeTriggerRequestOwnedView {
21557            fn serialize<__S: ::serde::Serializer>(
21558                &self,
21559                __s: __S,
21560            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21561                ::serde::Serialize::serialize(&self.0, __s)
21562            }
21563        }
21564        /// ResumeTriggerResponse returns the trigger status after resuming.
21565        #[derive(Clone, Debug, Default)]
21566        pub struct ResumeTriggerResponseView<'a> {
21567            /// Resumed trigger ID.
21568            ///
21569            /// Field 1: `trigger_id`
21570            pub trigger_id: u64,
21571            /// Current trigger status after resuming.
21572            ///
21573            /// Field 2: `status`
21574            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
21575            /// Server timestamp.
21576            ///
21577            /// Field 3: `ts`
21578            pub ts: ::buffa::MessageFieldView<
21579                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
21580            >,
21581            /// Server timestamp in nanoseconds since epoch (UTC).
21582            ///
21583            /// Field 4: `ts_ns`
21584            pub ts_ns: u64,
21585            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
21586        }
21587        impl<'a> ::buffa::MessageView<'a> for ResumeTriggerResponseView<'a> {
21588            type Owned = super::super::ResumeTriggerResponse;
21589            fn decode_view(
21590                buf: &'a [u8],
21591            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21592                let __limit = ::core::cell::Cell::new(
21593                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
21594                );
21595                <Self as ::buffa::MessageView>::decode_view_ctx(
21596                    buf,
21597                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
21598                )
21599            }
21600            fn decode_view_with_ctx(
21601                buf: &'a [u8],
21602                ctx: ::buffa::DecodeContext<'_>,
21603            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21604                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
21605            }
21606            fn merge_view_field(
21607                &mut self,
21608                tag: ::buffa::encoding::Tag,
21609                cur: &'a [u8],
21610                before_tag: &'a [u8],
21611                ctx: ::buffa::DecodeContext<'_>,
21612            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
21613                let _ = ctx;
21614                #[allow(unused_variables)]
21615                let view = self;
21616                let mut cur = cur;
21617                match tag.field_number() {
21618                    1u32 => {
21619                        ::buffa::encoding::check_wire_type(
21620                            tag,
21621                            ::buffa::encoding::WireType::Fixed64,
21622                        )?;
21623                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
21624                    }
21625                    2u32 => {
21626                        ::buffa::encoding::check_wire_type(
21627                            tag,
21628                            ::buffa::encoding::WireType::Varint,
21629                        )?;
21630                        view.status = ::buffa::EnumValue::from(
21631                            ::buffa::types::decode_int32(&mut cur)?,
21632                        );
21633                    }
21634                    3u32 => {
21635                        ::buffa::encoding::check_wire_type(
21636                            tag,
21637                            ::buffa::encoding::WireType::LengthDelimited,
21638                        )?;
21639                        let __sub_ctx = ctx.descend()?;
21640                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
21641                        match view.ts.as_mut() {
21642                            Some(existing) => {
21643                                ::buffa::MessageView::merge_into_view(
21644                                    existing,
21645                                    sub,
21646                                    __sub_ctx,
21647                                )?
21648                            }
21649                            None => {
21650                                view.ts = ::buffa::MessageFieldView::set(
21651                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
21652                                        sub,
21653                                        __sub_ctx,
21654                                    )?,
21655                                );
21656                            }
21657                        }
21658                    }
21659                    4u32 => {
21660                        ::buffa::encoding::check_wire_type(
21661                            tag,
21662                            ::buffa::encoding::WireType::Varint,
21663                        )?;
21664                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
21665                    }
21666                    _ => {
21667                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
21668                        let span_len = before_tag.len() - cur.len();
21669                        view.__buffa_unknown_fields
21670                            .push_record(before_tag, span_len, ctx)?;
21671                    }
21672                }
21673                ::core::result::Result::Ok(cur)
21674            }
21675            fn to_owned_message(
21676                &self,
21677            ) -> ::core::result::Result<
21678                super::super::ResumeTriggerResponse,
21679                ::buffa::DecodeError,
21680            > {
21681                self.to_owned_from_source(None)
21682            }
21683            #[allow(clippy::useless_conversion, clippy::needless_update)]
21684            fn to_owned_from_source(
21685                &self,
21686                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
21687            ) -> ::core::result::Result<
21688                super::super::ResumeTriggerResponse,
21689                ::buffa::DecodeError,
21690            > {
21691                #[allow(unused_imports)]
21692                use ::buffa::alloc::string::ToString as _;
21693                let _ = __buffa_src;
21694                ::core::result::Result::Ok(super::super::ResumeTriggerResponse {
21695                    trigger_id: self.trigger_id,
21696                    status: self.status,
21697                    ts: match self.ts.as_option() {
21698                        Some(v) => {
21699                            ::buffa::MessageField::<
21700                                ::buffa_types::google::protobuf::Timestamp,
21701                            >::some(v.to_owned_from_source(__buffa_src)?)
21702                        }
21703                        None => ::buffa::MessageField::none(),
21704                    },
21705                    ts_ns: self.ts_ns,
21706                    __buffa_unknown_fields: self
21707                        .__buffa_unknown_fields
21708                        .to_owned()?
21709                        .into(),
21710                    ..::core::default::Default::default()
21711                })
21712            }
21713        }
21714        impl<'a> ::buffa::ViewEncode<'a> for ResumeTriggerResponseView<'a> {
21715            #[allow(clippy::needless_borrow, clippy::let_and_return)]
21716            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
21717                #[allow(unused_imports)]
21718                use ::buffa::Enumeration as _;
21719                let mut size = 0u32;
21720                if self.trigger_id != 0u64 {
21721                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
21722                }
21723                {
21724                    let val = self.status.to_i32();
21725                    if val != 0 {
21726                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
21727                    }
21728                }
21729                if self.ts.is_set() {
21730                    let __slot = __cache.reserve();
21731                    let inner_size = self.ts.compute_size(__cache);
21732                    __cache.set(__slot, inner_size);
21733                    size
21734                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
21735                            + inner_size;
21736                }
21737                if self.ts_ns != 0u64 {
21738                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
21739                }
21740                size += self.__buffa_unknown_fields.encoded_len() as u32;
21741                size
21742            }
21743            #[allow(clippy::needless_borrow)]
21744            fn write_to(
21745                &self,
21746                __cache: &mut ::buffa::SizeCache,
21747                buf: &mut impl ::buffa::bytes::BufMut,
21748            ) {
21749                #[allow(unused_imports)]
21750                use ::buffa::Enumeration as _;
21751                if self.trigger_id != 0u64 {
21752                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
21753                }
21754                {
21755                    let val = self.status.to_i32();
21756                    if val != 0 {
21757                        ::buffa::types::put_int32_field(2u32, val, buf);
21758                    }
21759                }
21760                if self.ts.is_set() {
21761                    ::buffa::types::put_len_delimited_header(
21762                        3u32,
21763                        __cache.consume_next(),
21764                        buf,
21765                    );
21766                    self.ts.write_to(__cache, buf);
21767                }
21768                if self.ts_ns != 0u64 {
21769                    ::buffa::types::put_uint64_field(4u32, self.ts_ns, buf);
21770                }
21771                self.__buffa_unknown_fields.write_to(buf);
21772            }
21773        }
21774        /// Serializes this view as protobuf JSON.
21775        ///
21776        /// Implicit-presence fields with default values are omitted, `required`
21777        /// fields are always emitted, explicit-presence (`optional`) fields are
21778        /// emitted only when set, bytes fields are base64-encoded, and enum
21779        /// values are their proto name strings.
21780        ///
21781        /// This impl uses `serialize_map(None)` because the number of emitted
21782        /// fields depends on default-omission rules; serializers that require
21783        /// known map lengths (e.g. `bincode`) will return a runtime error.
21784        /// Use the owned message type for those formats.
21785        impl<'__a> ::serde::Serialize for ResumeTriggerResponseView<'__a> {
21786            fn serialize<__S: ::serde::Serializer>(
21787                &self,
21788                __s: __S,
21789            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21790                use ::serde::ser::SerializeMap as _;
21791                let mut __map = __s.serialize_map(::core::option::Option::None)?;
21792                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
21793                    __map
21794                        .serialize_entry(
21795                            "triggerId",
21796                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
21797                        )?;
21798                }
21799                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
21800                    __map.serialize_entry("status", &self.status)?;
21801                }
21802                {
21803                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
21804                        __map.serialize_entry("ts", __v)?;
21805                    }
21806                }
21807                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
21808                    __map
21809                        .serialize_entry(
21810                            "tsNs",
21811                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
21812                        )?;
21813                }
21814                __map.end()
21815            }
21816        }
21817        impl<'a> ::buffa::MessageName for ResumeTriggerResponseView<'a> {
21818            const PACKAGE: &'static str = "triggers.v1";
21819            const NAME: &'static str = "ResumeTriggerResponse";
21820            const FULL_NAME: &'static str = "triggers.v1.ResumeTriggerResponse";
21821            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.ResumeTriggerResponse";
21822        }
21823        ::buffa::impl_default_view_instance!(ResumeTriggerResponseView);
21824        ::buffa::impl_view_reborrow!(ResumeTriggerResponseView);
21825        /** Self-contained, `'static` owned view of a `ResumeTriggerResponse` message.
21826
21827 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.
21828
21829 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.*/
21830        #[derive(Clone, Debug)]
21831        pub struct ResumeTriggerResponseOwnedView(
21832            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21833        );
21834        impl ResumeTriggerResponseOwnedView {
21835            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
21836            ///
21837            /// The view borrows directly from the buffer's data; the buffer is
21838            /// retained inside the returned handle.
21839            ///
21840            /// # Errors
21841            ///
21842            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
21843            /// protobuf data.
21844            pub fn decode(
21845                bytes: ::buffa::bytes::Bytes,
21846            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21847                ::core::result::Result::Ok(
21848                    ResumeTriggerResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
21849                )
21850            }
21851            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
21852            /// max message size).
21853            ///
21854            /// # Errors
21855            ///
21856            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
21857            /// exceeds the configured limits.
21858            pub fn decode_with_options(
21859                bytes: ::buffa::bytes::Bytes,
21860                opts: &::buffa::DecodeOptions,
21861            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21862                ::core::result::Result::Ok(
21863                    ResumeTriggerResponseOwnedView(
21864                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
21865                    ),
21866                )
21867            }
21868            /// Build from an owned message via an encode → decode round-trip.
21869            ///
21870            /// # Errors
21871            ///
21872            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
21873            /// somehow invalid (should not happen for well-formed messages).
21874            pub fn from_owned(
21875                msg: &super::super::ResumeTriggerResponse,
21876            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
21877                ::core::result::Result::Ok(
21878                    ResumeTriggerResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
21879                )
21880            }
21881            /// Borrow the full [`ResumeTriggerResponseView`] with its lifetime tied to `&self`.
21882            #[must_use]
21883            pub fn view(&self) -> &ResumeTriggerResponseView<'_> {
21884                self.0.reborrow()
21885            }
21886            /// Convert to the owned message type.
21887            ///
21888            /// # Errors
21889            ///
21890            /// Returns an error if re-materializing preserved unknown fields
21891            /// fails (e.g. the unknown-field limit is exceeded).
21892            pub fn to_owned_message(
21893                &self,
21894            ) -> ::core::result::Result<
21895                super::super::ResumeTriggerResponse,
21896                ::buffa::DecodeError,
21897            > {
21898                self.0.to_owned_message()
21899            }
21900            /// The underlying bytes buffer.
21901            #[must_use]
21902            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
21903                self.0.bytes()
21904            }
21905            /// Consume the handle, returning the underlying bytes buffer.
21906            #[must_use]
21907            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
21908                self.0.into_bytes()
21909            }
21910            /// Resumed trigger ID.
21911            ///
21912            /// Field 1: `trigger_id`
21913            #[must_use]
21914            pub fn trigger_id(&self) -> u64 {
21915                self.0.reborrow().trigger_id
21916            }
21917            /// Current trigger status after resuming.
21918            ///
21919            /// Field 2: `status`
21920            #[must_use]
21921            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
21922                self.0.reborrow().status
21923            }
21924            /// Server timestamp.
21925            ///
21926            /// Field 3: `ts`
21927            #[must_use]
21928            pub fn ts(
21929                &self,
21930            ) -> &::buffa::MessageFieldView<
21931                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
21932            > {
21933                &self.0.reborrow().ts
21934            }
21935            /// Server timestamp in nanoseconds since epoch (UTC).
21936            ///
21937            /// Field 4: `ts_ns`
21938            #[must_use]
21939            pub fn ts_ns(&self) -> u64 {
21940                self.0.reborrow().ts_ns
21941            }
21942        }
21943        impl ::core::convert::From<
21944            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21945        > for ResumeTriggerResponseOwnedView {
21946            fn from(
21947                inner: ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21948            ) -> Self {
21949                ResumeTriggerResponseOwnedView(inner)
21950            }
21951        }
21952        impl ::core::convert::From<ResumeTriggerResponseOwnedView>
21953        for ::buffa::OwnedView<ResumeTriggerResponseView<'static>> {
21954            fn from(wrapper: ResumeTriggerResponseOwnedView) -> Self {
21955                wrapper.0
21956            }
21957        }
21958        impl ::core::convert::AsRef<
21959            ::buffa::OwnedView<ResumeTriggerResponseView<'static>>,
21960        > for ResumeTriggerResponseOwnedView {
21961            fn as_ref(&self) -> &::buffa::OwnedView<ResumeTriggerResponseView<'static>> {
21962                &self.0
21963            }
21964        }
21965        impl ::buffa::HasMessageView for super::super::ResumeTriggerResponse {
21966            type View<'a> = ResumeTriggerResponseView<'a>;
21967            type ViewHandle = ResumeTriggerResponseOwnedView;
21968        }
21969        impl ::serde::Serialize for ResumeTriggerResponseOwnedView {
21970            fn serialize<__S: ::serde::Serializer>(
21971                &self,
21972                __s: __S,
21973            ) -> ::core::result::Result<__S::Ok, __S::Error> {
21974                ::serde::Serialize::serialize(&self.0, __s)
21975            }
21976        }
21977        /// =============================================================================
21978        /// Trigger Model
21979        /// =============================================================================
21980        ///
21981        /// StopDetails contains configuration for STOP_LOSS and TAKE_PROFIT triggers.
21982        #[derive(Clone, Debug, Default)]
21983        pub struct StopDetailsView<'a> {
21984            /// Trigger threshold price in quote units scaled by 1e6.
21985            ///
21986            /// Field 1: `trigger_price_ticks`
21987            pub trigger_price_ticks: i64,
21988            /// Price source used for trigger evaluation.
21989            ///
21990            /// Field 2: `trigger_price_source`
21991            pub trigger_price_source: ::buffa::EnumValue<
21992                super::super::super::super::orders::v1::TriggerPriceSource,
21993            >,
21994            /// Direction the price must cross to fire the trigger.
21995            ///
21996            /// Field 3: `trigger_direction`
21997            pub trigger_direction: ::buffa::EnumValue<
21998                super::super::super::super::orders::v1::TriggerDirection,
21999            >,
22000            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22001        }
22002        impl<'a> ::buffa::MessageView<'a> for StopDetailsView<'a> {
22003            type Owned = super::super::StopDetails;
22004            fn decode_view(
22005                buf: &'a [u8],
22006            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22007                let __limit = ::core::cell::Cell::new(
22008                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
22009                );
22010                <Self as ::buffa::MessageView>::decode_view_ctx(
22011                    buf,
22012                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
22013                )
22014            }
22015            fn decode_view_with_ctx(
22016                buf: &'a [u8],
22017                ctx: ::buffa::DecodeContext<'_>,
22018            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22019                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
22020            }
22021            fn merge_view_field(
22022                &mut self,
22023                tag: ::buffa::encoding::Tag,
22024                cur: &'a [u8],
22025                before_tag: &'a [u8],
22026                ctx: ::buffa::DecodeContext<'_>,
22027            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
22028                let _ = ctx;
22029                #[allow(unused_variables)]
22030                let view = self;
22031                let mut cur = cur;
22032                match tag.field_number() {
22033                    1u32 => {
22034                        ::buffa::encoding::check_wire_type(
22035                            tag,
22036                            ::buffa::encoding::WireType::Varint,
22037                        )?;
22038                        view.trigger_price_ticks = ::buffa::types::decode_int64(
22039                            &mut cur,
22040                        )?;
22041                    }
22042                    2u32 => {
22043                        ::buffa::encoding::check_wire_type(
22044                            tag,
22045                            ::buffa::encoding::WireType::Varint,
22046                        )?;
22047                        view.trigger_price_source = ::buffa::EnumValue::from(
22048                            ::buffa::types::decode_int32(&mut cur)?,
22049                        );
22050                    }
22051                    3u32 => {
22052                        ::buffa::encoding::check_wire_type(
22053                            tag,
22054                            ::buffa::encoding::WireType::Varint,
22055                        )?;
22056                        view.trigger_direction = ::buffa::EnumValue::from(
22057                            ::buffa::types::decode_int32(&mut cur)?,
22058                        );
22059                    }
22060                    _ => {
22061                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
22062                        let span_len = before_tag.len() - cur.len();
22063                        view.__buffa_unknown_fields
22064                            .push_record(before_tag, span_len, ctx)?;
22065                    }
22066                }
22067                ::core::result::Result::Ok(cur)
22068            }
22069            fn to_owned_message(
22070                &self,
22071            ) -> ::core::result::Result<
22072                super::super::StopDetails,
22073                ::buffa::DecodeError,
22074            > {
22075                self.to_owned_from_source(None)
22076            }
22077            #[allow(clippy::useless_conversion, clippy::needless_update)]
22078            fn to_owned_from_source(
22079                &self,
22080                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
22081            ) -> ::core::result::Result<
22082                super::super::StopDetails,
22083                ::buffa::DecodeError,
22084            > {
22085                #[allow(unused_imports)]
22086                use ::buffa::alloc::string::ToString as _;
22087                let _ = __buffa_src;
22088                ::core::result::Result::Ok(super::super::StopDetails {
22089                    trigger_price_ticks: self.trigger_price_ticks,
22090                    trigger_price_source: self.trigger_price_source,
22091                    trigger_direction: self.trigger_direction,
22092                    __buffa_unknown_fields: self
22093                        .__buffa_unknown_fields
22094                        .to_owned()?
22095                        .into(),
22096                    ..::core::default::Default::default()
22097                })
22098            }
22099        }
22100        impl<'a> ::buffa::ViewEncode<'a> for StopDetailsView<'a> {
22101            #[allow(clippy::needless_borrow, clippy::let_and_return)]
22102            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
22103                #[allow(unused_imports)]
22104                use ::buffa::Enumeration as _;
22105                let mut size = 0u32;
22106                if self.trigger_price_ticks != 0i64 {
22107                    size
22108                        += 1u32
22109                            + ::buffa::types::int64_encoded_len(self.trigger_price_ticks)
22110                                as u32;
22111                }
22112                {
22113                    let val = self.trigger_price_source.to_i32();
22114                    if val != 0 {
22115                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22116                    }
22117                }
22118                {
22119                    let val = self.trigger_direction.to_i32();
22120                    if val != 0 {
22121                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22122                    }
22123                }
22124                size += self.__buffa_unknown_fields.encoded_len() as u32;
22125                size
22126            }
22127            #[allow(clippy::needless_borrow)]
22128            fn write_to(
22129                &self,
22130                _cache: &mut ::buffa::SizeCache,
22131                buf: &mut impl ::buffa::bytes::BufMut,
22132            ) {
22133                #[allow(unused_imports)]
22134                use ::buffa::Enumeration as _;
22135                if self.trigger_price_ticks != 0i64 {
22136                    ::buffa::types::put_int64_field(1u32, self.trigger_price_ticks, buf);
22137                }
22138                {
22139                    let val = self.trigger_price_source.to_i32();
22140                    if val != 0 {
22141                        ::buffa::types::put_int32_field(2u32, val, buf);
22142                    }
22143                }
22144                {
22145                    let val = self.trigger_direction.to_i32();
22146                    if val != 0 {
22147                        ::buffa::types::put_int32_field(3u32, val, buf);
22148                    }
22149                }
22150                self.__buffa_unknown_fields.write_to(buf);
22151            }
22152        }
22153        /// Serializes this view as protobuf JSON.
22154        ///
22155        /// Implicit-presence fields with default values are omitted, `required`
22156        /// fields are always emitted, explicit-presence (`optional`) fields are
22157        /// emitted only when set, bytes fields are base64-encoded, and enum
22158        /// values are their proto name strings.
22159        ///
22160        /// This impl uses `serialize_map(None)` because the number of emitted
22161        /// fields depends on default-omission rules; serializers that require
22162        /// known map lengths (e.g. `bincode`) will return a runtime error.
22163        /// Use the owned message type for those formats.
22164        impl<'__a> ::serde::Serialize for StopDetailsView<'__a> {
22165            fn serialize<__S: ::serde::Serializer>(
22166                &self,
22167                __s: __S,
22168            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22169                use ::serde::ser::SerializeMap as _;
22170                let mut __map = __s.serialize_map(::core::option::Option::None)?;
22171                if !::buffa::json_helpers::skip_if::is_zero_i64(
22172                    &self.trigger_price_ticks,
22173                ) {
22174                    __map
22175                        .serialize_entry(
22176                            "triggerPriceTicks",
22177                            &::buffa::json_helpers::ProtoJson(&self.trigger_price_ticks),
22178                        )?;
22179                }
22180                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22181                    &self.trigger_price_source,
22182                ) {
22183                    __map
22184                        .serialize_entry(
22185                            "triggerPriceSource",
22186                            &self.trigger_price_source,
22187                        )?;
22188                }
22189                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22190                    &self.trigger_direction,
22191                ) {
22192                    __map.serialize_entry("triggerDirection", &self.trigger_direction)?;
22193                }
22194                __map.end()
22195            }
22196        }
22197        impl<'a> ::buffa::MessageName for StopDetailsView<'a> {
22198            const PACKAGE: &'static str = "triggers.v1";
22199            const NAME: &'static str = "StopDetails";
22200            const FULL_NAME: &'static str = "triggers.v1.StopDetails";
22201            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.StopDetails";
22202        }
22203        ::buffa::impl_default_view_instance!(StopDetailsView);
22204        ::buffa::impl_view_reborrow!(StopDetailsView);
22205        /** Self-contained, `'static` owned view of a `StopDetails` message.
22206
22207 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.
22208
22209 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.*/
22210        #[derive(Clone, Debug)]
22211        pub struct StopDetailsOwnedView(::buffa::OwnedView<StopDetailsView<'static>>);
22212        impl StopDetailsOwnedView {
22213            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
22214            ///
22215            /// The view borrows directly from the buffer's data; the buffer is
22216            /// retained inside the returned handle.
22217            ///
22218            /// # Errors
22219            ///
22220            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
22221            /// protobuf data.
22222            pub fn decode(
22223                bytes: ::buffa::bytes::Bytes,
22224            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22225                ::core::result::Result::Ok(
22226                    StopDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
22227                )
22228            }
22229            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
22230            /// max message size).
22231            ///
22232            /// # Errors
22233            ///
22234            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
22235            /// exceeds the configured limits.
22236            pub fn decode_with_options(
22237                bytes: ::buffa::bytes::Bytes,
22238                opts: &::buffa::DecodeOptions,
22239            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22240                ::core::result::Result::Ok(
22241                    StopDetailsOwnedView(
22242                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
22243                    ),
22244                )
22245            }
22246            /// Build from an owned message via an encode → decode round-trip.
22247            ///
22248            /// # Errors
22249            ///
22250            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
22251            /// somehow invalid (should not happen for well-formed messages).
22252            pub fn from_owned(
22253                msg: &super::super::StopDetails,
22254            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22255                ::core::result::Result::Ok(
22256                    StopDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
22257                )
22258            }
22259            /// Borrow the full [`StopDetailsView`] with its lifetime tied to `&self`.
22260            #[must_use]
22261            pub fn view(&self) -> &StopDetailsView<'_> {
22262                self.0.reborrow()
22263            }
22264            /// Convert to the owned message type.
22265            ///
22266            /// # Errors
22267            ///
22268            /// Returns an error if re-materializing preserved unknown fields
22269            /// fails (e.g. the unknown-field limit is exceeded).
22270            pub fn to_owned_message(
22271                &self,
22272            ) -> ::core::result::Result<
22273                super::super::StopDetails,
22274                ::buffa::DecodeError,
22275            > {
22276                self.0.to_owned_message()
22277            }
22278            /// The underlying bytes buffer.
22279            #[must_use]
22280            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
22281                self.0.bytes()
22282            }
22283            /// Consume the handle, returning the underlying bytes buffer.
22284            #[must_use]
22285            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
22286                self.0.into_bytes()
22287            }
22288            /// Trigger threshold price in quote units scaled by 1e6.
22289            ///
22290            /// Field 1: `trigger_price_ticks`
22291            #[must_use]
22292            pub fn trigger_price_ticks(&self) -> i64 {
22293                self.0.reborrow().trigger_price_ticks
22294            }
22295            /// Price source used for trigger evaluation.
22296            ///
22297            /// Field 2: `trigger_price_source`
22298            #[must_use]
22299            pub fn trigger_price_source(
22300                &self,
22301            ) -> ::buffa::EnumValue<
22302                super::super::super::super::orders::v1::TriggerPriceSource,
22303            > {
22304                self.0.reborrow().trigger_price_source
22305            }
22306            /// Direction the price must cross to fire the trigger.
22307            ///
22308            /// Field 3: `trigger_direction`
22309            #[must_use]
22310            pub fn trigger_direction(
22311                &self,
22312            ) -> ::buffa::EnumValue<
22313                super::super::super::super::orders::v1::TriggerDirection,
22314            > {
22315                self.0.reborrow().trigger_direction
22316            }
22317        }
22318        impl ::core::convert::From<::buffa::OwnedView<StopDetailsView<'static>>>
22319        for StopDetailsOwnedView {
22320            fn from(inner: ::buffa::OwnedView<StopDetailsView<'static>>) -> Self {
22321                StopDetailsOwnedView(inner)
22322            }
22323        }
22324        impl ::core::convert::From<StopDetailsOwnedView>
22325        for ::buffa::OwnedView<StopDetailsView<'static>> {
22326            fn from(wrapper: StopDetailsOwnedView) -> Self {
22327                wrapper.0
22328            }
22329        }
22330        impl ::core::convert::AsRef<::buffa::OwnedView<StopDetailsView<'static>>>
22331        for StopDetailsOwnedView {
22332            fn as_ref(&self) -> &::buffa::OwnedView<StopDetailsView<'static>> {
22333                &self.0
22334            }
22335        }
22336        impl ::buffa::HasMessageView for super::super::StopDetails {
22337            type View<'a> = StopDetailsView<'a>;
22338            type ViewHandle = StopDetailsOwnedView;
22339        }
22340        impl ::serde::Serialize for StopDetailsOwnedView {
22341            fn serialize<__S: ::serde::Serializer>(
22342                &self,
22343                __s: __S,
22344            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22345                ::serde::Serialize::serialize(&self.0, __s)
22346            }
22347        }
22348        /// TrailingDetails contains configuration and runtime state for TRAILING_STOP
22349        /// triggers.
22350        #[derive(Clone, Debug, Default)]
22351        pub struct TrailingDetailsView<'a> {
22352            /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
22353            ///
22354            /// Field 1: `trailing_distance_ticks`
22355            pub trailing_distance_ticks: i64,
22356            /// Optional activation price: trailing only starts after this price is
22357            /// reached. Expressed in quote units scaled by 1e6.
22358            ///
22359            /// Field 2: `activation_price_ticks`
22360            pub activation_price_ticks: i64,
22361            /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
22362            ///
22363            /// Field 3: `peak_price_ticks`
22364            pub peak_price_ticks: i64,
22365            /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
22366            ///
22367            /// Field 4: `trough_price_ticks`
22368            pub trough_price_ticks: i64,
22369            /// Trailing distance in basis points (1 bp = 0.01%).
22370            ///
22371            /// Field 5: `trailing_distance_bps`
22372            pub trailing_distance_bps: i32,
22373            /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
22374            ///
22375            /// Field 6: `max_slippage_ticks`
22376            pub max_slippage_ticks: i32,
22377            /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
22378            ///
22379            /// Field 7: `max_slippage_bps`
22380            pub max_slippage_bps: i32,
22381            /// Price source used for trigger evaluation. Fixed for the lifetime of the
22382            /// trigger and exposed for completeness.
22383            ///
22384            /// Field 8: `trigger_price_source`
22385            pub trigger_price_source: ::buffa::EnumValue<
22386                super::super::super::super::orders::v1::TriggerPriceSource,
22387            >,
22388            /// Direction the price must cross to fire the trigger. Fixed for the lifetime
22389            /// of the trigger and exposed for completeness.
22390            ///
22391            /// Field 9: `trigger_direction`
22392            pub trigger_direction: ::buffa::EnumValue<
22393                super::super::super::super::orders::v1::TriggerDirection,
22394            >,
22395            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22396        }
22397        impl<'a> ::buffa::MessageView<'a> for TrailingDetailsView<'a> {
22398            type Owned = super::super::TrailingDetails;
22399            fn decode_view(
22400                buf: &'a [u8],
22401            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22402                let __limit = ::core::cell::Cell::new(
22403                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
22404                );
22405                <Self as ::buffa::MessageView>::decode_view_ctx(
22406                    buf,
22407                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
22408                )
22409            }
22410            fn decode_view_with_ctx(
22411                buf: &'a [u8],
22412                ctx: ::buffa::DecodeContext<'_>,
22413            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22414                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
22415            }
22416            fn merge_view_field(
22417                &mut self,
22418                tag: ::buffa::encoding::Tag,
22419                cur: &'a [u8],
22420                before_tag: &'a [u8],
22421                ctx: ::buffa::DecodeContext<'_>,
22422            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
22423                let _ = ctx;
22424                #[allow(unused_variables)]
22425                let view = self;
22426                let mut cur = cur;
22427                match tag.field_number() {
22428                    1u32 => {
22429                        ::buffa::encoding::check_wire_type(
22430                            tag,
22431                            ::buffa::encoding::WireType::Varint,
22432                        )?;
22433                        view.trailing_distance_ticks = ::buffa::types::decode_int64(
22434                            &mut cur,
22435                        )?;
22436                    }
22437                    2u32 => {
22438                        ::buffa::encoding::check_wire_type(
22439                            tag,
22440                            ::buffa::encoding::WireType::Varint,
22441                        )?;
22442                        view.activation_price_ticks = ::buffa::types::decode_int64(
22443                            &mut cur,
22444                        )?;
22445                    }
22446                    3u32 => {
22447                        ::buffa::encoding::check_wire_type(
22448                            tag,
22449                            ::buffa::encoding::WireType::Varint,
22450                        )?;
22451                        view.peak_price_ticks = ::buffa::types::decode_int64(&mut cur)?;
22452                    }
22453                    4u32 => {
22454                        ::buffa::encoding::check_wire_type(
22455                            tag,
22456                            ::buffa::encoding::WireType::Varint,
22457                        )?;
22458                        view.trough_price_ticks = ::buffa::types::decode_int64(
22459                            &mut cur,
22460                        )?;
22461                    }
22462                    5u32 => {
22463                        ::buffa::encoding::check_wire_type(
22464                            tag,
22465                            ::buffa::encoding::WireType::Varint,
22466                        )?;
22467                        view.trailing_distance_bps = ::buffa::types::decode_int32(
22468                            &mut cur,
22469                        )?;
22470                    }
22471                    6u32 => {
22472                        ::buffa::encoding::check_wire_type(
22473                            tag,
22474                            ::buffa::encoding::WireType::Varint,
22475                        )?;
22476                        view.max_slippage_ticks = ::buffa::types::decode_int32(
22477                            &mut cur,
22478                        )?;
22479                    }
22480                    7u32 => {
22481                        ::buffa::encoding::check_wire_type(
22482                            tag,
22483                            ::buffa::encoding::WireType::Varint,
22484                        )?;
22485                        view.max_slippage_bps = ::buffa::types::decode_int32(&mut cur)?;
22486                    }
22487                    8u32 => {
22488                        ::buffa::encoding::check_wire_type(
22489                            tag,
22490                            ::buffa::encoding::WireType::Varint,
22491                        )?;
22492                        view.trigger_price_source = ::buffa::EnumValue::from(
22493                            ::buffa::types::decode_int32(&mut cur)?,
22494                        );
22495                    }
22496                    9u32 => {
22497                        ::buffa::encoding::check_wire_type(
22498                            tag,
22499                            ::buffa::encoding::WireType::Varint,
22500                        )?;
22501                        view.trigger_direction = ::buffa::EnumValue::from(
22502                            ::buffa::types::decode_int32(&mut cur)?,
22503                        );
22504                    }
22505                    _ => {
22506                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
22507                        let span_len = before_tag.len() - cur.len();
22508                        view.__buffa_unknown_fields
22509                            .push_record(before_tag, span_len, ctx)?;
22510                    }
22511                }
22512                ::core::result::Result::Ok(cur)
22513            }
22514            fn to_owned_message(
22515                &self,
22516            ) -> ::core::result::Result<
22517                super::super::TrailingDetails,
22518                ::buffa::DecodeError,
22519            > {
22520                self.to_owned_from_source(None)
22521            }
22522            #[allow(clippy::useless_conversion, clippy::needless_update)]
22523            fn to_owned_from_source(
22524                &self,
22525                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
22526            ) -> ::core::result::Result<
22527                super::super::TrailingDetails,
22528                ::buffa::DecodeError,
22529            > {
22530                #[allow(unused_imports)]
22531                use ::buffa::alloc::string::ToString as _;
22532                let _ = __buffa_src;
22533                ::core::result::Result::Ok(super::super::TrailingDetails {
22534                    trailing_distance_ticks: self.trailing_distance_ticks,
22535                    activation_price_ticks: self.activation_price_ticks,
22536                    peak_price_ticks: self.peak_price_ticks,
22537                    trough_price_ticks: self.trough_price_ticks,
22538                    trailing_distance_bps: self.trailing_distance_bps,
22539                    max_slippage_ticks: self.max_slippage_ticks,
22540                    max_slippage_bps: self.max_slippage_bps,
22541                    trigger_price_source: self.trigger_price_source,
22542                    trigger_direction: self.trigger_direction,
22543                    __buffa_unknown_fields: self
22544                        .__buffa_unknown_fields
22545                        .to_owned()?
22546                        .into(),
22547                    ..::core::default::Default::default()
22548                })
22549            }
22550        }
22551        impl<'a> ::buffa::ViewEncode<'a> for TrailingDetailsView<'a> {
22552            #[allow(clippy::needless_borrow, clippy::let_and_return)]
22553            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
22554                #[allow(unused_imports)]
22555                use ::buffa::Enumeration as _;
22556                let mut size = 0u32;
22557                if self.trailing_distance_ticks != 0i64 {
22558                    size
22559                        += 1u32
22560                            + ::buffa::types::int64_encoded_len(
22561                                self.trailing_distance_ticks,
22562                            ) as u32;
22563                }
22564                if self.activation_price_ticks != 0i64 {
22565                    size
22566                        += 1u32
22567                            + ::buffa::types::int64_encoded_len(
22568                                self.activation_price_ticks,
22569                            ) as u32;
22570                }
22571                if self.peak_price_ticks != 0i64 {
22572                    size
22573                        += 1u32
22574                            + ::buffa::types::int64_encoded_len(self.peak_price_ticks)
22575                                as u32;
22576                }
22577                if self.trough_price_ticks != 0i64 {
22578                    size
22579                        += 1u32
22580                            + ::buffa::types::int64_encoded_len(self.trough_price_ticks)
22581                                as u32;
22582                }
22583                if self.trailing_distance_bps != 0i32 {
22584                    size
22585                        += 1u32
22586                            + ::buffa::types::int32_encoded_len(
22587                                self.trailing_distance_bps,
22588                            ) as u32;
22589                }
22590                if self.max_slippage_ticks != 0i32 {
22591                    size
22592                        += 1u32
22593                            + ::buffa::types::int32_encoded_len(self.max_slippage_ticks)
22594                                as u32;
22595                }
22596                if self.max_slippage_bps != 0i32 {
22597                    size
22598                        += 1u32
22599                            + ::buffa::types::int32_encoded_len(self.max_slippage_bps)
22600                                as u32;
22601                }
22602                {
22603                    let val = self.trigger_price_source.to_i32();
22604                    if val != 0 {
22605                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22606                    }
22607                }
22608                {
22609                    let val = self.trigger_direction.to_i32();
22610                    if val != 0 {
22611                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
22612                    }
22613                }
22614                size += self.__buffa_unknown_fields.encoded_len() as u32;
22615                size
22616            }
22617            #[allow(clippy::needless_borrow)]
22618            fn write_to(
22619                &self,
22620                _cache: &mut ::buffa::SizeCache,
22621                buf: &mut impl ::buffa::bytes::BufMut,
22622            ) {
22623                #[allow(unused_imports)]
22624                use ::buffa::Enumeration as _;
22625                if self.trailing_distance_ticks != 0i64 {
22626                    ::buffa::types::put_int64_field(
22627                        1u32,
22628                        self.trailing_distance_ticks,
22629                        buf,
22630                    );
22631                }
22632                if self.activation_price_ticks != 0i64 {
22633                    ::buffa::types::put_int64_field(
22634                        2u32,
22635                        self.activation_price_ticks,
22636                        buf,
22637                    );
22638                }
22639                if self.peak_price_ticks != 0i64 {
22640                    ::buffa::types::put_int64_field(3u32, self.peak_price_ticks, buf);
22641                }
22642                if self.trough_price_ticks != 0i64 {
22643                    ::buffa::types::put_int64_field(4u32, self.trough_price_ticks, buf);
22644                }
22645                if self.trailing_distance_bps != 0i32 {
22646                    ::buffa::types::put_int32_field(
22647                        5u32,
22648                        self.trailing_distance_bps,
22649                        buf,
22650                    );
22651                }
22652                if self.max_slippage_ticks != 0i32 {
22653                    ::buffa::types::put_int32_field(6u32, self.max_slippage_ticks, buf);
22654                }
22655                if self.max_slippage_bps != 0i32 {
22656                    ::buffa::types::put_int32_field(7u32, self.max_slippage_bps, buf);
22657                }
22658                {
22659                    let val = self.trigger_price_source.to_i32();
22660                    if val != 0 {
22661                        ::buffa::types::put_int32_field(8u32, val, buf);
22662                    }
22663                }
22664                {
22665                    let val = self.trigger_direction.to_i32();
22666                    if val != 0 {
22667                        ::buffa::types::put_int32_field(9u32, val, buf);
22668                    }
22669                }
22670                self.__buffa_unknown_fields.write_to(buf);
22671            }
22672        }
22673        /// Serializes this view as protobuf JSON.
22674        ///
22675        /// Implicit-presence fields with default values are omitted, `required`
22676        /// fields are always emitted, explicit-presence (`optional`) fields are
22677        /// emitted only when set, bytes fields are base64-encoded, and enum
22678        /// values are their proto name strings.
22679        ///
22680        /// This impl uses `serialize_map(None)` because the number of emitted
22681        /// fields depends on default-omission rules; serializers that require
22682        /// known map lengths (e.g. `bincode`) will return a runtime error.
22683        /// Use the owned message type for those formats.
22684        impl<'__a> ::serde::Serialize for TrailingDetailsView<'__a> {
22685            fn serialize<__S: ::serde::Serializer>(
22686                &self,
22687                __s: __S,
22688            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22689                use ::serde::ser::SerializeMap as _;
22690                let mut __map = __s.serialize_map(::core::option::Option::None)?;
22691                if !::buffa::json_helpers::skip_if::is_zero_i64(
22692                    &self.trailing_distance_ticks,
22693                ) {
22694                    __map
22695                        .serialize_entry(
22696                            "trailingDistanceTicks",
22697                            &::buffa::json_helpers::ProtoJson(
22698                                &self.trailing_distance_ticks,
22699                            ),
22700                        )?;
22701                }
22702                if !::buffa::json_helpers::skip_if::is_zero_i64(
22703                    &self.activation_price_ticks,
22704                ) {
22705                    __map
22706                        .serialize_entry(
22707                            "activationPriceTicks",
22708                            &::buffa::json_helpers::ProtoJson(
22709                                &self.activation_price_ticks,
22710                            ),
22711                        )?;
22712                }
22713                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.peak_price_ticks) {
22714                    __map
22715                        .serialize_entry(
22716                            "peakPriceTicks",
22717                            &::buffa::json_helpers::ProtoJson(&self.peak_price_ticks),
22718                        )?;
22719                }
22720                if !::buffa::json_helpers::skip_if::is_zero_i64(
22721                    &self.trough_price_ticks,
22722                ) {
22723                    __map
22724                        .serialize_entry(
22725                            "troughPriceTicks",
22726                            &::buffa::json_helpers::ProtoJson(&self.trough_price_ticks),
22727                        )?;
22728                }
22729                if !::buffa::json_helpers::skip_if::is_zero_i32(
22730                    &self.trailing_distance_bps,
22731                ) {
22732                    __map
22733                        .serialize_entry(
22734                            "trailingDistanceBps",
22735                            &::buffa::json_helpers::ProtoJson(
22736                                &self.trailing_distance_bps,
22737                            ),
22738                        )?;
22739                }
22740                if !::buffa::json_helpers::skip_if::is_zero_i32(
22741                    &self.max_slippage_ticks,
22742                ) {
22743                    __map
22744                        .serialize_entry(
22745                            "maxSlippageTicks",
22746                            &::buffa::json_helpers::ProtoJson(&self.max_slippage_ticks),
22747                        )?;
22748                }
22749                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.max_slippage_bps) {
22750                    __map
22751                        .serialize_entry(
22752                            "maxSlippageBps",
22753                            &::buffa::json_helpers::ProtoJson(&self.max_slippage_bps),
22754                        )?;
22755                }
22756                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22757                    &self.trigger_price_source,
22758                ) {
22759                    __map
22760                        .serialize_entry(
22761                            "triggerPriceSource",
22762                            &self.trigger_price_source,
22763                        )?;
22764                }
22765                if !::buffa::json_helpers::skip_if::is_default_enum_value(
22766                    &self.trigger_direction,
22767                ) {
22768                    __map.serialize_entry("triggerDirection", &self.trigger_direction)?;
22769                }
22770                __map.end()
22771            }
22772        }
22773        impl<'a> ::buffa::MessageName for TrailingDetailsView<'a> {
22774            const PACKAGE: &'static str = "triggers.v1";
22775            const NAME: &'static str = "TrailingDetails";
22776            const FULL_NAME: &'static str = "triggers.v1.TrailingDetails";
22777            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TrailingDetails";
22778        }
22779        ::buffa::impl_default_view_instance!(TrailingDetailsView);
22780        ::buffa::impl_view_reborrow!(TrailingDetailsView);
22781        /** Self-contained, `'static` owned view of a `TrailingDetails` message.
22782
22783 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.
22784
22785 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.*/
22786        #[derive(Clone, Debug)]
22787        pub struct TrailingDetailsOwnedView(
22788            ::buffa::OwnedView<TrailingDetailsView<'static>>,
22789        );
22790        impl TrailingDetailsOwnedView {
22791            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
22792            ///
22793            /// The view borrows directly from the buffer's data; the buffer is
22794            /// retained inside the returned handle.
22795            ///
22796            /// # Errors
22797            ///
22798            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
22799            /// protobuf data.
22800            pub fn decode(
22801                bytes: ::buffa::bytes::Bytes,
22802            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22803                ::core::result::Result::Ok(
22804                    TrailingDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
22805                )
22806            }
22807            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
22808            /// max message size).
22809            ///
22810            /// # Errors
22811            ///
22812            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
22813            /// exceeds the configured limits.
22814            pub fn decode_with_options(
22815                bytes: ::buffa::bytes::Bytes,
22816                opts: &::buffa::DecodeOptions,
22817            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22818                ::core::result::Result::Ok(
22819                    TrailingDetailsOwnedView(
22820                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
22821                    ),
22822                )
22823            }
22824            /// Build from an owned message via an encode → decode round-trip.
22825            ///
22826            /// # Errors
22827            ///
22828            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
22829            /// somehow invalid (should not happen for well-formed messages).
22830            pub fn from_owned(
22831                msg: &super::super::TrailingDetails,
22832            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
22833                ::core::result::Result::Ok(
22834                    TrailingDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
22835                )
22836            }
22837            /// Borrow the full [`TrailingDetailsView`] with its lifetime tied to `&self`.
22838            #[must_use]
22839            pub fn view(&self) -> &TrailingDetailsView<'_> {
22840                self.0.reborrow()
22841            }
22842            /// Convert to the owned message type.
22843            ///
22844            /// # Errors
22845            ///
22846            /// Returns an error if re-materializing preserved unknown fields
22847            /// fails (e.g. the unknown-field limit is exceeded).
22848            pub fn to_owned_message(
22849                &self,
22850            ) -> ::core::result::Result<
22851                super::super::TrailingDetails,
22852                ::buffa::DecodeError,
22853            > {
22854                self.0.to_owned_message()
22855            }
22856            /// The underlying bytes buffer.
22857            #[must_use]
22858            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
22859                self.0.bytes()
22860            }
22861            /// Consume the handle, returning the underlying bytes buffer.
22862            #[must_use]
22863            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
22864                self.0.into_bytes()
22865            }
22866            /// Trailing distance as a price delta in 1e-6 quote-unit ticks.
22867            ///
22868            /// Field 1: `trailing_distance_ticks`
22869            #[must_use]
22870            pub fn trailing_distance_ticks(&self) -> i64 {
22871                self.0.reborrow().trailing_distance_ticks
22872            }
22873            /// Optional activation price: trailing only starts after this price is
22874            /// reached. Expressed in quote units scaled by 1e6.
22875            ///
22876            /// Field 2: `activation_price_ticks`
22877            #[must_use]
22878            pub fn activation_price_ticks(&self) -> i64 {
22879                self.0.reborrow().activation_price_ticks
22880            }
22881            /// Current peak price in quote units scaled by 1e6 for sell trailing stops.
22882            ///
22883            /// Field 3: `peak_price_ticks`
22884            #[must_use]
22885            pub fn peak_price_ticks(&self) -> i64 {
22886                self.0.reborrow().peak_price_ticks
22887            }
22888            /// Current trough price in quote units scaled by 1e6 for buy trailing stops.
22889            ///
22890            /// Field 4: `trough_price_ticks`
22891            #[must_use]
22892            pub fn trough_price_ticks(&self) -> i64 {
22893                self.0.reborrow().trough_price_ticks
22894            }
22895            /// Trailing distance in basis points (1 bp = 0.01%).
22896            ///
22897            /// Field 5: `trailing_distance_bps`
22898            #[must_use]
22899            pub fn trailing_distance_bps(&self) -> i32 {
22900                self.0.reborrow().trailing_distance_bps
22901            }
22902            /// Optional maximum allowed slippage as a price delta in 1e-6 quote-unit ticks.
22903            ///
22904            /// Field 6: `max_slippage_ticks`
22905            #[must_use]
22906            pub fn max_slippage_ticks(&self) -> i32 {
22907                self.0.reborrow().max_slippage_ticks
22908            }
22909            /// Optional maximum allowed slippage in basis points (1 bp = 0.01%).
22910            ///
22911            /// Field 7: `max_slippage_bps`
22912            #[must_use]
22913            pub fn max_slippage_bps(&self) -> i32 {
22914                self.0.reborrow().max_slippage_bps
22915            }
22916            /// Price source used for trigger evaluation. Fixed for the lifetime of the
22917            /// trigger and exposed for completeness.
22918            ///
22919            /// Field 8: `trigger_price_source`
22920            #[must_use]
22921            pub fn trigger_price_source(
22922                &self,
22923            ) -> ::buffa::EnumValue<
22924                super::super::super::super::orders::v1::TriggerPriceSource,
22925            > {
22926                self.0.reborrow().trigger_price_source
22927            }
22928            /// Direction the price must cross to fire the trigger. Fixed for the lifetime
22929            /// of the trigger and exposed for completeness.
22930            ///
22931            /// Field 9: `trigger_direction`
22932            #[must_use]
22933            pub fn trigger_direction(
22934                &self,
22935            ) -> ::buffa::EnumValue<
22936                super::super::super::super::orders::v1::TriggerDirection,
22937            > {
22938                self.0.reborrow().trigger_direction
22939            }
22940        }
22941        impl ::core::convert::From<::buffa::OwnedView<TrailingDetailsView<'static>>>
22942        for TrailingDetailsOwnedView {
22943            fn from(inner: ::buffa::OwnedView<TrailingDetailsView<'static>>) -> Self {
22944                TrailingDetailsOwnedView(inner)
22945            }
22946        }
22947        impl ::core::convert::From<TrailingDetailsOwnedView>
22948        for ::buffa::OwnedView<TrailingDetailsView<'static>> {
22949            fn from(wrapper: TrailingDetailsOwnedView) -> Self {
22950                wrapper.0
22951            }
22952        }
22953        impl ::core::convert::AsRef<::buffa::OwnedView<TrailingDetailsView<'static>>>
22954        for TrailingDetailsOwnedView {
22955            fn as_ref(&self) -> &::buffa::OwnedView<TrailingDetailsView<'static>> {
22956                &self.0
22957            }
22958        }
22959        impl ::buffa::HasMessageView for super::super::TrailingDetails {
22960            type View<'a> = TrailingDetailsView<'a>;
22961            type ViewHandle = TrailingDetailsOwnedView;
22962        }
22963        impl ::serde::Serialize for TrailingDetailsOwnedView {
22964            fn serialize<__S: ::serde::Serializer>(
22965                &self,
22966                __s: __S,
22967            ) -> ::core::result::Result<__S::Ok, __S::Error> {
22968                ::serde::Serialize::serialize(&self.0, __s)
22969            }
22970        }
22971        /// TwapDetails contains configuration and runtime state for TWAP triggers.
22972        #[derive(Clone, Debug, Default)]
22973        pub struct TwapDetailsView<'a> {
22974            /// Total duration of TWAP execution in milliseconds.
22975            ///
22976            /// Field 1: `twap_duration_ms`
22977            pub twap_duration_ms: i64,
22978            /// Interval between TWAP slices in milliseconds.
22979            ///
22980            /// Field 2: `twap_slice_interval_ms`
22981            pub twap_slice_interval_ms: i64,
22982            /// Current slice index, zero-based.
22983            ///
22984            /// Field 4: `slice_idx`
22985            pub slice_idx: i32,
22986            /// Total number of planned slices.
22987            ///
22988            /// Field 5: `slice_count`
22989            pub slice_count: i32,
22990            /// Cumulative executed quantity scaled by the pair's base_quantity_scale from
22991            /// GetSpotConfig.
22992            ///
22993            /// Field 6: `executed_qty_scaled`
22994            pub executed_qty_scaled: i64,
22995            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
22996        }
22997        impl<'a> ::buffa::MessageView<'a> for TwapDetailsView<'a> {
22998            type Owned = super::super::TwapDetails;
22999            fn decode_view(
23000                buf: &'a [u8],
23001            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23002                let __limit = ::core::cell::Cell::new(
23003                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23004                );
23005                <Self as ::buffa::MessageView>::decode_view_ctx(
23006                    buf,
23007                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23008                )
23009            }
23010            fn decode_view_with_ctx(
23011                buf: &'a [u8],
23012                ctx: ::buffa::DecodeContext<'_>,
23013            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23014                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23015            }
23016            fn merge_view_field(
23017                &mut self,
23018                tag: ::buffa::encoding::Tag,
23019                cur: &'a [u8],
23020                before_tag: &'a [u8],
23021                ctx: ::buffa::DecodeContext<'_>,
23022            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23023                let _ = ctx;
23024                #[allow(unused_variables)]
23025                let view = self;
23026                let mut cur = cur;
23027                match tag.field_number() {
23028                    1u32 => {
23029                        ::buffa::encoding::check_wire_type(
23030                            tag,
23031                            ::buffa::encoding::WireType::Varint,
23032                        )?;
23033                        view.twap_duration_ms = ::buffa::types::decode_int64(&mut cur)?;
23034                    }
23035                    2u32 => {
23036                        ::buffa::encoding::check_wire_type(
23037                            tag,
23038                            ::buffa::encoding::WireType::Varint,
23039                        )?;
23040                        view.twap_slice_interval_ms = ::buffa::types::decode_int64(
23041                            &mut cur,
23042                        )?;
23043                    }
23044                    4u32 => {
23045                        ::buffa::encoding::check_wire_type(
23046                            tag,
23047                            ::buffa::encoding::WireType::Varint,
23048                        )?;
23049                        view.slice_idx = ::buffa::types::decode_int32(&mut cur)?;
23050                    }
23051                    5u32 => {
23052                        ::buffa::encoding::check_wire_type(
23053                            tag,
23054                            ::buffa::encoding::WireType::Varint,
23055                        )?;
23056                        view.slice_count = ::buffa::types::decode_int32(&mut cur)?;
23057                    }
23058                    6u32 => {
23059                        ::buffa::encoding::check_wire_type(
23060                            tag,
23061                            ::buffa::encoding::WireType::Varint,
23062                        )?;
23063                        view.executed_qty_scaled = ::buffa::types::decode_int64(
23064                            &mut cur,
23065                        )?;
23066                    }
23067                    _ => {
23068                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
23069                        let span_len = before_tag.len() - cur.len();
23070                        view.__buffa_unknown_fields
23071                            .push_record(before_tag, span_len, ctx)?;
23072                    }
23073                }
23074                ::core::result::Result::Ok(cur)
23075            }
23076            fn to_owned_message(
23077                &self,
23078            ) -> ::core::result::Result<
23079                super::super::TwapDetails,
23080                ::buffa::DecodeError,
23081            > {
23082                self.to_owned_from_source(None)
23083            }
23084            #[allow(clippy::useless_conversion, clippy::needless_update)]
23085            fn to_owned_from_source(
23086                &self,
23087                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
23088            ) -> ::core::result::Result<
23089                super::super::TwapDetails,
23090                ::buffa::DecodeError,
23091            > {
23092                #[allow(unused_imports)]
23093                use ::buffa::alloc::string::ToString as _;
23094                let _ = __buffa_src;
23095                ::core::result::Result::Ok(super::super::TwapDetails {
23096                    twap_duration_ms: self.twap_duration_ms,
23097                    twap_slice_interval_ms: self.twap_slice_interval_ms,
23098                    slice_idx: self.slice_idx,
23099                    slice_count: self.slice_count,
23100                    executed_qty_scaled: self.executed_qty_scaled,
23101                    __buffa_unknown_fields: self
23102                        .__buffa_unknown_fields
23103                        .to_owned()?
23104                        .into(),
23105                    ..::core::default::Default::default()
23106                })
23107            }
23108        }
23109        impl<'a> ::buffa::ViewEncode<'a> for TwapDetailsView<'a> {
23110            #[allow(clippy::needless_borrow, clippy::let_and_return)]
23111            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
23112                #[allow(unused_imports)]
23113                use ::buffa::Enumeration as _;
23114                let mut size = 0u32;
23115                if self.twap_duration_ms != 0i64 {
23116                    size
23117                        += 1u32
23118                            + ::buffa::types::int64_encoded_len(self.twap_duration_ms)
23119                                as u32;
23120                }
23121                if self.twap_slice_interval_ms != 0i64 {
23122                    size
23123                        += 1u32
23124                            + ::buffa::types::int64_encoded_len(
23125                                self.twap_slice_interval_ms,
23126                            ) as u32;
23127                }
23128                if self.slice_idx != 0i32 {
23129                    size
23130                        += 1u32
23131                            + ::buffa::types::int32_encoded_len(self.slice_idx) as u32;
23132                }
23133                if self.slice_count != 0i32 {
23134                    size
23135                        += 1u32
23136                            + ::buffa::types::int32_encoded_len(self.slice_count) as u32;
23137                }
23138                if self.executed_qty_scaled != 0i64 {
23139                    size
23140                        += 1u32
23141                            + ::buffa::types::int64_encoded_len(self.executed_qty_scaled)
23142                                as u32;
23143                }
23144                size += self.__buffa_unknown_fields.encoded_len() as u32;
23145                size
23146            }
23147            #[allow(clippy::needless_borrow)]
23148            fn write_to(
23149                &self,
23150                _cache: &mut ::buffa::SizeCache,
23151                buf: &mut impl ::buffa::bytes::BufMut,
23152            ) {
23153                #[allow(unused_imports)]
23154                use ::buffa::Enumeration as _;
23155                if self.twap_duration_ms != 0i64 {
23156                    ::buffa::types::put_int64_field(1u32, self.twap_duration_ms, buf);
23157                }
23158                if self.twap_slice_interval_ms != 0i64 {
23159                    ::buffa::types::put_int64_field(
23160                        2u32,
23161                        self.twap_slice_interval_ms,
23162                        buf,
23163                    );
23164                }
23165                if self.slice_idx != 0i32 {
23166                    ::buffa::types::put_int32_field(4u32, self.slice_idx, buf);
23167                }
23168                if self.slice_count != 0i32 {
23169                    ::buffa::types::put_int32_field(5u32, self.slice_count, buf);
23170                }
23171                if self.executed_qty_scaled != 0i64 {
23172                    ::buffa::types::put_int64_field(6u32, self.executed_qty_scaled, buf);
23173                }
23174                self.__buffa_unknown_fields.write_to(buf);
23175            }
23176        }
23177        /// Serializes this view as protobuf JSON.
23178        ///
23179        /// Implicit-presence fields with default values are omitted, `required`
23180        /// fields are always emitted, explicit-presence (`optional`) fields are
23181        /// emitted only when set, bytes fields are base64-encoded, and enum
23182        /// values are their proto name strings.
23183        ///
23184        /// This impl uses `serialize_map(None)` because the number of emitted
23185        /// fields depends on default-omission rules; serializers that require
23186        /// known map lengths (e.g. `bincode`) will return a runtime error.
23187        /// Use the owned message type for those formats.
23188        impl<'__a> ::serde::Serialize for TwapDetailsView<'__a> {
23189            fn serialize<__S: ::serde::Serializer>(
23190                &self,
23191                __s: __S,
23192            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23193                use ::serde::ser::SerializeMap as _;
23194                let mut __map = __s.serialize_map(::core::option::Option::None)?;
23195                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.twap_duration_ms) {
23196                    __map
23197                        .serialize_entry(
23198                            "twapDurationMs",
23199                            &::buffa::json_helpers::ProtoJson(&self.twap_duration_ms),
23200                        )?;
23201                }
23202                if !::buffa::json_helpers::skip_if::is_zero_i64(
23203                    &self.twap_slice_interval_ms,
23204                ) {
23205                    __map
23206                        .serialize_entry(
23207                            "twapSliceIntervalMs",
23208                            &::buffa::json_helpers::ProtoJson(
23209                                &self.twap_slice_interval_ms,
23210                            ),
23211                        )?;
23212                }
23213                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.slice_idx) {
23214                    __map
23215                        .serialize_entry(
23216                            "sliceIdx",
23217                            &::buffa::json_helpers::ProtoJson(&self.slice_idx),
23218                        )?;
23219                }
23220                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.slice_count) {
23221                    __map
23222                        .serialize_entry(
23223                            "sliceCount",
23224                            &::buffa::json_helpers::ProtoJson(&self.slice_count),
23225                        )?;
23226                }
23227                if !::buffa::json_helpers::skip_if::is_zero_i64(
23228                    &self.executed_qty_scaled,
23229                ) {
23230                    __map
23231                        .serialize_entry(
23232                            "executedQtyScaled",
23233                            &::buffa::json_helpers::ProtoJson(&self.executed_qty_scaled),
23234                        )?;
23235                }
23236                __map.end()
23237            }
23238        }
23239        impl<'a> ::buffa::MessageName for TwapDetailsView<'a> {
23240            const PACKAGE: &'static str = "triggers.v1";
23241            const NAME: &'static str = "TwapDetails";
23242            const FULL_NAME: &'static str = "triggers.v1.TwapDetails";
23243            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.TwapDetails";
23244        }
23245        ::buffa::impl_default_view_instance!(TwapDetailsView);
23246        ::buffa::impl_view_reborrow!(TwapDetailsView);
23247        /** Self-contained, `'static` owned view of a `TwapDetails` message.
23248
23249 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.
23250
23251 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.*/
23252        #[derive(Clone, Debug)]
23253        pub struct TwapDetailsOwnedView(::buffa::OwnedView<TwapDetailsView<'static>>);
23254        impl TwapDetailsOwnedView {
23255            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
23256            ///
23257            /// The view borrows directly from the buffer's data; the buffer is
23258            /// retained inside the returned handle.
23259            ///
23260            /// # Errors
23261            ///
23262            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
23263            /// protobuf data.
23264            pub fn decode(
23265                bytes: ::buffa::bytes::Bytes,
23266            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23267                ::core::result::Result::Ok(
23268                    TwapDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
23269                )
23270            }
23271            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
23272            /// max message size).
23273            ///
23274            /// # Errors
23275            ///
23276            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
23277            /// exceeds the configured limits.
23278            pub fn decode_with_options(
23279                bytes: ::buffa::bytes::Bytes,
23280                opts: &::buffa::DecodeOptions,
23281            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23282                ::core::result::Result::Ok(
23283                    TwapDetailsOwnedView(
23284                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
23285                    ),
23286                )
23287            }
23288            /// Build from an owned message via an encode → decode round-trip.
23289            ///
23290            /// # Errors
23291            ///
23292            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
23293            /// somehow invalid (should not happen for well-formed messages).
23294            pub fn from_owned(
23295                msg: &super::super::TwapDetails,
23296            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23297                ::core::result::Result::Ok(
23298                    TwapDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
23299                )
23300            }
23301            /// Borrow the full [`TwapDetailsView`] with its lifetime tied to `&self`.
23302            #[must_use]
23303            pub fn view(&self) -> &TwapDetailsView<'_> {
23304                self.0.reborrow()
23305            }
23306            /// Convert to the owned message type.
23307            ///
23308            /// # Errors
23309            ///
23310            /// Returns an error if re-materializing preserved unknown fields
23311            /// fails (e.g. the unknown-field limit is exceeded).
23312            pub fn to_owned_message(
23313                &self,
23314            ) -> ::core::result::Result<
23315                super::super::TwapDetails,
23316                ::buffa::DecodeError,
23317            > {
23318                self.0.to_owned_message()
23319            }
23320            /// The underlying bytes buffer.
23321            #[must_use]
23322            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
23323                self.0.bytes()
23324            }
23325            /// Consume the handle, returning the underlying bytes buffer.
23326            #[must_use]
23327            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
23328                self.0.into_bytes()
23329            }
23330            /// Total duration of TWAP execution in milliseconds.
23331            ///
23332            /// Field 1: `twap_duration_ms`
23333            #[must_use]
23334            pub fn twap_duration_ms(&self) -> i64 {
23335                self.0.reborrow().twap_duration_ms
23336            }
23337            /// Interval between TWAP slices in milliseconds.
23338            ///
23339            /// Field 2: `twap_slice_interval_ms`
23340            #[must_use]
23341            pub fn twap_slice_interval_ms(&self) -> i64 {
23342                self.0.reborrow().twap_slice_interval_ms
23343            }
23344            /// Current slice index, zero-based.
23345            ///
23346            /// Field 4: `slice_idx`
23347            #[must_use]
23348            pub fn slice_idx(&self) -> i32 {
23349                self.0.reborrow().slice_idx
23350            }
23351            /// Total number of planned slices.
23352            ///
23353            /// Field 5: `slice_count`
23354            #[must_use]
23355            pub fn slice_count(&self) -> i32 {
23356                self.0.reborrow().slice_count
23357            }
23358            /// Cumulative executed quantity scaled by the pair's base_quantity_scale from
23359            /// GetSpotConfig.
23360            ///
23361            /// Field 6: `executed_qty_scaled`
23362            #[must_use]
23363            pub fn executed_qty_scaled(&self) -> i64 {
23364                self.0.reborrow().executed_qty_scaled
23365            }
23366        }
23367        impl ::core::convert::From<::buffa::OwnedView<TwapDetailsView<'static>>>
23368        for TwapDetailsOwnedView {
23369            fn from(inner: ::buffa::OwnedView<TwapDetailsView<'static>>) -> Self {
23370                TwapDetailsOwnedView(inner)
23371            }
23372        }
23373        impl ::core::convert::From<TwapDetailsOwnedView>
23374        for ::buffa::OwnedView<TwapDetailsView<'static>> {
23375            fn from(wrapper: TwapDetailsOwnedView) -> Self {
23376                wrapper.0
23377            }
23378        }
23379        impl ::core::convert::AsRef<::buffa::OwnedView<TwapDetailsView<'static>>>
23380        for TwapDetailsOwnedView {
23381            fn as_ref(&self) -> &::buffa::OwnedView<TwapDetailsView<'static>> {
23382                &self.0
23383            }
23384        }
23385        impl ::buffa::HasMessageView for super::super::TwapDetails {
23386            type View<'a> = TwapDetailsView<'a>;
23387            type ViewHandle = TwapDetailsOwnedView;
23388        }
23389        impl ::serde::Serialize for TwapDetailsOwnedView {
23390            fn serialize<__S: ::serde::Serializer>(
23391                &self,
23392                __s: __S,
23393            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23394                ::serde::Serialize::serialize(&self.0, __s)
23395            }
23396        }
23397        /// LadderDetails contains configuration for LADDER triggers.
23398        #[derive(Clone, Debug, Default)]
23399        pub struct LadderDetailsView<'a> {
23400            /// Minimum price in quote units scaled by 1e6 for the ladder range.
23401            ///
23402            /// Field 1: `ladder_price_min_ticks`
23403            pub ladder_price_min_ticks: i64,
23404            /// Maximum price in quote units scaled by 1e6 for the ladder range.
23405            ///
23406            /// Field 2: `ladder_price_max_ticks`
23407            pub ladder_price_max_ticks: i64,
23408            /// Number of price levels in the ladder.
23409            ///
23410            /// Field 3: `ladder_levels`
23411            pub ladder_levels: i32,
23412            /// Quantity distribution across ladder levels.
23413            ///
23414            /// Field 4: `ladder_distribution`
23415            pub ladder_distribution: ::buffa::EnumValue<
23416                super::super::LadderDistribution,
23417            >,
23418            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
23419        }
23420        impl<'a> ::buffa::MessageView<'a> for LadderDetailsView<'a> {
23421            type Owned = super::super::LadderDetails;
23422            fn decode_view(
23423                buf: &'a [u8],
23424            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23425                let __limit = ::core::cell::Cell::new(
23426                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23427                );
23428                <Self as ::buffa::MessageView>::decode_view_ctx(
23429                    buf,
23430                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23431                )
23432            }
23433            fn decode_view_with_ctx(
23434                buf: &'a [u8],
23435                ctx: ::buffa::DecodeContext<'_>,
23436            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23437                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23438            }
23439            fn merge_view_field(
23440                &mut self,
23441                tag: ::buffa::encoding::Tag,
23442                cur: &'a [u8],
23443                before_tag: &'a [u8],
23444                ctx: ::buffa::DecodeContext<'_>,
23445            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23446                let _ = ctx;
23447                #[allow(unused_variables)]
23448                let view = self;
23449                let mut cur = cur;
23450                match tag.field_number() {
23451                    1u32 => {
23452                        ::buffa::encoding::check_wire_type(
23453                            tag,
23454                            ::buffa::encoding::WireType::Varint,
23455                        )?;
23456                        view.ladder_price_min_ticks = ::buffa::types::decode_int64(
23457                            &mut cur,
23458                        )?;
23459                    }
23460                    2u32 => {
23461                        ::buffa::encoding::check_wire_type(
23462                            tag,
23463                            ::buffa::encoding::WireType::Varint,
23464                        )?;
23465                        view.ladder_price_max_ticks = ::buffa::types::decode_int64(
23466                            &mut cur,
23467                        )?;
23468                    }
23469                    3u32 => {
23470                        ::buffa::encoding::check_wire_type(
23471                            tag,
23472                            ::buffa::encoding::WireType::Varint,
23473                        )?;
23474                        view.ladder_levels = ::buffa::types::decode_int32(&mut cur)?;
23475                    }
23476                    4u32 => {
23477                        ::buffa::encoding::check_wire_type(
23478                            tag,
23479                            ::buffa::encoding::WireType::Varint,
23480                        )?;
23481                        view.ladder_distribution = ::buffa::EnumValue::from(
23482                            ::buffa::types::decode_int32(&mut cur)?,
23483                        );
23484                    }
23485                    _ => {
23486                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
23487                        let span_len = before_tag.len() - cur.len();
23488                        view.__buffa_unknown_fields
23489                            .push_record(before_tag, span_len, ctx)?;
23490                    }
23491                }
23492                ::core::result::Result::Ok(cur)
23493            }
23494            fn to_owned_message(
23495                &self,
23496            ) -> ::core::result::Result<
23497                super::super::LadderDetails,
23498                ::buffa::DecodeError,
23499            > {
23500                self.to_owned_from_source(None)
23501            }
23502            #[allow(clippy::useless_conversion, clippy::needless_update)]
23503            fn to_owned_from_source(
23504                &self,
23505                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
23506            ) -> ::core::result::Result<
23507                super::super::LadderDetails,
23508                ::buffa::DecodeError,
23509            > {
23510                #[allow(unused_imports)]
23511                use ::buffa::alloc::string::ToString as _;
23512                let _ = __buffa_src;
23513                ::core::result::Result::Ok(super::super::LadderDetails {
23514                    ladder_price_min_ticks: self.ladder_price_min_ticks,
23515                    ladder_price_max_ticks: self.ladder_price_max_ticks,
23516                    ladder_levels: self.ladder_levels,
23517                    ladder_distribution: self.ladder_distribution,
23518                    __buffa_unknown_fields: self
23519                        .__buffa_unknown_fields
23520                        .to_owned()?
23521                        .into(),
23522                    ..::core::default::Default::default()
23523                })
23524            }
23525        }
23526        impl<'a> ::buffa::ViewEncode<'a> for LadderDetailsView<'a> {
23527            #[allow(clippy::needless_borrow, clippy::let_and_return)]
23528            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
23529                #[allow(unused_imports)]
23530                use ::buffa::Enumeration as _;
23531                let mut size = 0u32;
23532                if self.ladder_price_min_ticks != 0i64 {
23533                    size
23534                        += 1u32
23535                            + ::buffa::types::int64_encoded_len(
23536                                self.ladder_price_min_ticks,
23537                            ) as u32;
23538                }
23539                if self.ladder_price_max_ticks != 0i64 {
23540                    size
23541                        += 1u32
23542                            + ::buffa::types::int64_encoded_len(
23543                                self.ladder_price_max_ticks,
23544                            ) as u32;
23545                }
23546                if self.ladder_levels != 0i32 {
23547                    size
23548                        += 1u32
23549                            + ::buffa::types::int32_encoded_len(self.ladder_levels)
23550                                as u32;
23551                }
23552                {
23553                    let val = self.ladder_distribution.to_i32();
23554                    if val != 0 {
23555                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
23556                    }
23557                }
23558                size += self.__buffa_unknown_fields.encoded_len() as u32;
23559                size
23560            }
23561            #[allow(clippy::needless_borrow)]
23562            fn write_to(
23563                &self,
23564                _cache: &mut ::buffa::SizeCache,
23565                buf: &mut impl ::buffa::bytes::BufMut,
23566            ) {
23567                #[allow(unused_imports)]
23568                use ::buffa::Enumeration as _;
23569                if self.ladder_price_min_ticks != 0i64 {
23570                    ::buffa::types::put_int64_field(
23571                        1u32,
23572                        self.ladder_price_min_ticks,
23573                        buf,
23574                    );
23575                }
23576                if self.ladder_price_max_ticks != 0i64 {
23577                    ::buffa::types::put_int64_field(
23578                        2u32,
23579                        self.ladder_price_max_ticks,
23580                        buf,
23581                    );
23582                }
23583                if self.ladder_levels != 0i32 {
23584                    ::buffa::types::put_int32_field(3u32, self.ladder_levels, buf);
23585                }
23586                {
23587                    let val = self.ladder_distribution.to_i32();
23588                    if val != 0 {
23589                        ::buffa::types::put_int32_field(4u32, val, buf);
23590                    }
23591                }
23592                self.__buffa_unknown_fields.write_to(buf);
23593            }
23594        }
23595        /// Serializes this view as protobuf JSON.
23596        ///
23597        /// Implicit-presence fields with default values are omitted, `required`
23598        /// fields are always emitted, explicit-presence (`optional`) fields are
23599        /// emitted only when set, bytes fields are base64-encoded, and enum
23600        /// values are their proto name strings.
23601        ///
23602        /// This impl uses `serialize_map(None)` because the number of emitted
23603        /// fields depends on default-omission rules; serializers that require
23604        /// known map lengths (e.g. `bincode`) will return a runtime error.
23605        /// Use the owned message type for those formats.
23606        impl<'__a> ::serde::Serialize for LadderDetailsView<'__a> {
23607            fn serialize<__S: ::serde::Serializer>(
23608                &self,
23609                __s: __S,
23610            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23611                use ::serde::ser::SerializeMap as _;
23612                let mut __map = __s.serialize_map(::core::option::Option::None)?;
23613                if !::buffa::json_helpers::skip_if::is_zero_i64(
23614                    &self.ladder_price_min_ticks,
23615                ) {
23616                    __map
23617                        .serialize_entry(
23618                            "ladderPriceMinTicks",
23619                            &::buffa::json_helpers::ProtoJson(
23620                                &self.ladder_price_min_ticks,
23621                            ),
23622                        )?;
23623                }
23624                if !::buffa::json_helpers::skip_if::is_zero_i64(
23625                    &self.ladder_price_max_ticks,
23626                ) {
23627                    __map
23628                        .serialize_entry(
23629                            "ladderPriceMaxTicks",
23630                            &::buffa::json_helpers::ProtoJson(
23631                                &self.ladder_price_max_ticks,
23632                            ),
23633                        )?;
23634                }
23635                if !::buffa::json_helpers::skip_if::is_zero_i32(&self.ladder_levels) {
23636                    __map
23637                        .serialize_entry(
23638                            "ladderLevels",
23639                            &::buffa::json_helpers::ProtoJson(&self.ladder_levels),
23640                        )?;
23641                }
23642                if !::buffa::json_helpers::skip_if::is_default_enum_value(
23643                    &self.ladder_distribution,
23644                ) {
23645                    __map
23646                        .serialize_entry(
23647                            "ladderDistribution",
23648                            &self.ladder_distribution,
23649                        )?;
23650                }
23651                __map.end()
23652            }
23653        }
23654        impl<'a> ::buffa::MessageName for LadderDetailsView<'a> {
23655            const PACKAGE: &'static str = "triggers.v1";
23656            const NAME: &'static str = "LadderDetails";
23657            const FULL_NAME: &'static str = "triggers.v1.LadderDetails";
23658            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.LadderDetails";
23659        }
23660        ::buffa::impl_default_view_instance!(LadderDetailsView);
23661        ::buffa::impl_view_reborrow!(LadderDetailsView);
23662        /** Self-contained, `'static` owned view of a `LadderDetails` message.
23663
23664 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.
23665
23666 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.*/
23667        #[derive(Clone, Debug)]
23668        pub struct LadderDetailsOwnedView(
23669            ::buffa::OwnedView<LadderDetailsView<'static>>,
23670        );
23671        impl LadderDetailsOwnedView {
23672            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
23673            ///
23674            /// The view borrows directly from the buffer's data; the buffer is
23675            /// retained inside the returned handle.
23676            ///
23677            /// # Errors
23678            ///
23679            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
23680            /// protobuf data.
23681            pub fn decode(
23682                bytes: ::buffa::bytes::Bytes,
23683            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23684                ::core::result::Result::Ok(
23685                    LadderDetailsOwnedView(::buffa::OwnedView::decode(bytes)?),
23686                )
23687            }
23688            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
23689            /// max message size).
23690            ///
23691            /// # Errors
23692            ///
23693            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
23694            /// exceeds the configured limits.
23695            pub fn decode_with_options(
23696                bytes: ::buffa::bytes::Bytes,
23697                opts: &::buffa::DecodeOptions,
23698            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23699                ::core::result::Result::Ok(
23700                    LadderDetailsOwnedView(
23701                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
23702                    ),
23703                )
23704            }
23705            /// Build from an owned message via an encode → decode round-trip.
23706            ///
23707            /// # Errors
23708            ///
23709            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
23710            /// somehow invalid (should not happen for well-formed messages).
23711            pub fn from_owned(
23712                msg: &super::super::LadderDetails,
23713            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23714                ::core::result::Result::Ok(
23715                    LadderDetailsOwnedView(::buffa::OwnedView::from_owned(msg)?),
23716                )
23717            }
23718            /// Borrow the full [`LadderDetailsView`] with its lifetime tied to `&self`.
23719            #[must_use]
23720            pub fn view(&self) -> &LadderDetailsView<'_> {
23721                self.0.reborrow()
23722            }
23723            /// Convert to the owned message type.
23724            ///
23725            /// # Errors
23726            ///
23727            /// Returns an error if re-materializing preserved unknown fields
23728            /// fails (e.g. the unknown-field limit is exceeded).
23729            pub fn to_owned_message(
23730                &self,
23731            ) -> ::core::result::Result<
23732                super::super::LadderDetails,
23733                ::buffa::DecodeError,
23734            > {
23735                self.0.to_owned_message()
23736            }
23737            /// The underlying bytes buffer.
23738            #[must_use]
23739            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
23740                self.0.bytes()
23741            }
23742            /// Consume the handle, returning the underlying bytes buffer.
23743            #[must_use]
23744            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
23745                self.0.into_bytes()
23746            }
23747            /// Minimum price in quote units scaled by 1e6 for the ladder range.
23748            ///
23749            /// Field 1: `ladder_price_min_ticks`
23750            #[must_use]
23751            pub fn ladder_price_min_ticks(&self) -> i64 {
23752                self.0.reborrow().ladder_price_min_ticks
23753            }
23754            /// Maximum price in quote units scaled by 1e6 for the ladder range.
23755            ///
23756            /// Field 2: `ladder_price_max_ticks`
23757            #[must_use]
23758            pub fn ladder_price_max_ticks(&self) -> i64 {
23759                self.0.reborrow().ladder_price_max_ticks
23760            }
23761            /// Number of price levels in the ladder.
23762            ///
23763            /// Field 3: `ladder_levels`
23764            #[must_use]
23765            pub fn ladder_levels(&self) -> i32 {
23766                self.0.reborrow().ladder_levels
23767            }
23768            /// Quantity distribution across ladder levels.
23769            ///
23770            /// Field 4: `ladder_distribution`
23771            #[must_use]
23772            pub fn ladder_distribution(
23773                &self,
23774            ) -> ::buffa::EnumValue<super::super::LadderDistribution> {
23775                self.0.reborrow().ladder_distribution
23776            }
23777        }
23778        impl ::core::convert::From<::buffa::OwnedView<LadderDetailsView<'static>>>
23779        for LadderDetailsOwnedView {
23780            fn from(inner: ::buffa::OwnedView<LadderDetailsView<'static>>) -> Self {
23781                LadderDetailsOwnedView(inner)
23782            }
23783        }
23784        impl ::core::convert::From<LadderDetailsOwnedView>
23785        for ::buffa::OwnedView<LadderDetailsView<'static>> {
23786            fn from(wrapper: LadderDetailsOwnedView) -> Self {
23787                wrapper.0
23788            }
23789        }
23790        impl ::core::convert::AsRef<::buffa::OwnedView<LadderDetailsView<'static>>>
23791        for LadderDetailsOwnedView {
23792            fn as_ref(&self) -> &::buffa::OwnedView<LadderDetailsView<'static>> {
23793                &self.0
23794            }
23795        }
23796        impl ::buffa::HasMessageView for super::super::LadderDetails {
23797            type View<'a> = LadderDetailsView<'a>;
23798            type ViewHandle = LadderDetailsOwnedView;
23799        }
23800        impl ::serde::Serialize for LadderDetailsOwnedView {
23801            fn serialize<__S: ::serde::Serializer>(
23802                &self,
23803                __s: __S,
23804            ) -> ::core::result::Result<__S::Ok, __S::Error> {
23805                ::serde::Serialize::serialize(&self.0, __s)
23806            }
23807        }
23808        /// Trigger represents a trigger with its full state.
23809        #[derive(Clone, Debug, Default)]
23810        pub struct TriggerView<'a> {
23811            /// Trigger ID.
23812            ///
23813            /// Field 1: `trigger_id`
23814            pub trigger_id: u64,
23815            /// Public account or sub-account ID associated with the trigger.
23816            ///
23817            /// Field 2: `subaccount_id`
23818            pub subaccount_id: u64,
23819            /// Trading symbol numeric identifier.
23820            ///
23821            /// Field 3: `symbol_id`
23822            pub symbol_id: u32,
23823            /// Trading symbol, for example "BTC-USDT".
23824            ///
23825            /// Field 4: `symbol`
23826            pub symbol: &'a str,
23827            /// Current trigger lifecycle status.
23828            ///
23829            /// Field 5: `status`
23830            pub status: ::buffa::EnumValue<super::super::TriggerStatus>,
23831            /// Parent order ID for attached-risk triggers; empty for standalone triggers.
23832            ///
23833            /// Field 6: `parent_order_id`
23834            pub parent_order_id: ::core::option::Option<u64>,
23835            /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
23836            ///
23837            /// Field 20: `qty_scaled`
23838            pub qty_scaled: i64,
23839            /// Fee asset for BUY child orders.
23840            ///
23841            /// Field 21: `fee_asset`
23842            pub fee_asset: ::buffa::EnumValue<
23843                super::super::super::super::orders::v1::FeeAsset,
23844            >,
23845            /// Self-trade prevention mode for child orders.
23846            ///
23847            /// Field 22: `self_trade_prevention_mode`
23848            pub self_trade_prevention_mode: ::buffa::EnumValue<
23849                super::super::super::super::orders::v1::SelfTradePreventionMode,
23850            >,
23851            /// Client-provided trigger ID for idempotency and correlation.
23852            ///
23853            /// Field 60: `client_trigger_id`
23854            pub client_trigger_id: &'a str,
23855            /// Creation timestamp.
23856            ///
23857            /// Field 61: `created_at`
23858            pub created_at: ::buffa::MessageFieldView<
23859                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23860            >,
23861            /// Last update timestamp.
23862            ///
23863            /// Field 62: `updated_at`
23864            pub updated_at: ::buffa::MessageFieldView<
23865                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23866            >,
23867            /// Timestamp when the trigger became armed.
23868            ///
23869            /// Field 63: `armed_at`
23870            pub armed_at: ::buffa::MessageFieldView<
23871                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23872            >,
23873            /// Timestamp when the trigger reached a terminal successful state.
23874            ///
23875            /// Field 64: `completed_at`
23876            pub completed_at: ::buffa::MessageFieldView<
23877                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
23878            >,
23879            /// Child orders spawned by this trigger.
23880            ///
23881            /// Field 70: `child_order_ids`
23882            pub child_order_ids: ::buffa::RepeatedView<'a, u64>,
23883            pub configuration: ::core::option::Option<
23884                super::super::__buffa::view::oneof::trigger::Configuration<'a>,
23885            >,
23886            pub runtime_details: ::core::option::Option<
23887                super::super::__buffa::view::oneof::trigger::RuntimeDetails<'a>,
23888            >,
23889            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
23890        }
23891        impl<'a> ::buffa::MessageView<'a> for TriggerView<'a> {
23892            type Owned = super::super::Trigger;
23893            fn decode_view(
23894                buf: &'a [u8],
23895            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23896                let __limit = ::core::cell::Cell::new(
23897                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
23898                );
23899                <Self as ::buffa::MessageView>::decode_view_ctx(
23900                    buf,
23901                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
23902                )
23903            }
23904            fn decode_view_with_ctx(
23905                buf: &'a [u8],
23906                ctx: ::buffa::DecodeContext<'_>,
23907            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
23908                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
23909            }
23910            fn merge_view_field(
23911                &mut self,
23912                tag: ::buffa::encoding::Tag,
23913                cur: &'a [u8],
23914                before_tag: &'a [u8],
23915                ctx: ::buffa::DecodeContext<'_>,
23916            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
23917                let _ = ctx;
23918                #[allow(unused_variables)]
23919                let view = self;
23920                let mut cur = cur;
23921                match tag.field_number() {
23922                    1u32 => {
23923                        ::buffa::encoding::check_wire_type(
23924                            tag,
23925                            ::buffa::encoding::WireType::Fixed64,
23926                        )?;
23927                        view.trigger_id = ::buffa::types::decode_fixed64(&mut cur)?;
23928                    }
23929                    2u32 => {
23930                        ::buffa::encoding::check_wire_type(
23931                            tag,
23932                            ::buffa::encoding::WireType::Fixed64,
23933                        )?;
23934                        view.subaccount_id = ::buffa::types::decode_fixed64(&mut cur)?;
23935                    }
23936                    3u32 => {
23937                        ::buffa::encoding::check_wire_type(
23938                            tag,
23939                            ::buffa::encoding::WireType::Varint,
23940                        )?;
23941                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
23942                    }
23943                    4u32 => {
23944                        ::buffa::encoding::check_wire_type(
23945                            tag,
23946                            ::buffa::encoding::WireType::LengthDelimited,
23947                        )?;
23948                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
23949                    }
23950                    5u32 => {
23951                        ::buffa::encoding::check_wire_type(
23952                            tag,
23953                            ::buffa::encoding::WireType::Varint,
23954                        )?;
23955                        view.status = ::buffa::EnumValue::from(
23956                            ::buffa::types::decode_int32(&mut cur)?,
23957                        );
23958                    }
23959                    6u32 => {
23960                        ::buffa::encoding::check_wire_type(
23961                            tag,
23962                            ::buffa::encoding::WireType::Fixed64,
23963                        )?;
23964                        view.parent_order_id = Some(
23965                            ::buffa::types::decode_fixed64(&mut cur)?,
23966                        );
23967                    }
23968                    20u32 => {
23969                        ::buffa::encoding::check_wire_type(
23970                            tag,
23971                            ::buffa::encoding::WireType::Varint,
23972                        )?;
23973                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
23974                    }
23975                    21u32 => {
23976                        ::buffa::encoding::check_wire_type(
23977                            tag,
23978                            ::buffa::encoding::WireType::Varint,
23979                        )?;
23980                        view.fee_asset = ::buffa::EnumValue::from(
23981                            ::buffa::types::decode_int32(&mut cur)?,
23982                        );
23983                    }
23984                    22u32 => {
23985                        ::buffa::encoding::check_wire_type(
23986                            tag,
23987                            ::buffa::encoding::WireType::Varint,
23988                        )?;
23989                        view.self_trade_prevention_mode = ::buffa::EnumValue::from(
23990                            ::buffa::types::decode_int32(&mut cur)?,
23991                        );
23992                    }
23993                    60u32 => {
23994                        ::buffa::encoding::check_wire_type(
23995                            tag,
23996                            ::buffa::encoding::WireType::LengthDelimited,
23997                        )?;
23998                        view.client_trigger_id = ::buffa::types::borrow_str(&mut cur)?;
23999                    }
24000                    61u32 => {
24001                        ::buffa::encoding::check_wire_type(
24002                            tag,
24003                            ::buffa::encoding::WireType::LengthDelimited,
24004                        )?;
24005                        let __sub_ctx = ctx.descend()?;
24006                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24007                        match view.created_at.as_mut() {
24008                            Some(existing) => {
24009                                ::buffa::MessageView::merge_into_view(
24010                                    existing,
24011                                    sub,
24012                                    __sub_ctx,
24013                                )?
24014                            }
24015                            None => {
24016                                view.created_at = ::buffa::MessageFieldView::set(
24017                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24018                                        sub,
24019                                        __sub_ctx,
24020                                    )?,
24021                                );
24022                            }
24023                        }
24024                    }
24025                    62u32 => {
24026                        ::buffa::encoding::check_wire_type(
24027                            tag,
24028                            ::buffa::encoding::WireType::LengthDelimited,
24029                        )?;
24030                        let __sub_ctx = ctx.descend()?;
24031                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24032                        match view.updated_at.as_mut() {
24033                            Some(existing) => {
24034                                ::buffa::MessageView::merge_into_view(
24035                                    existing,
24036                                    sub,
24037                                    __sub_ctx,
24038                                )?
24039                            }
24040                            None => {
24041                                view.updated_at = ::buffa::MessageFieldView::set(
24042                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24043                                        sub,
24044                                        __sub_ctx,
24045                                    )?,
24046                                );
24047                            }
24048                        }
24049                    }
24050                    63u32 => {
24051                        ::buffa::encoding::check_wire_type(
24052                            tag,
24053                            ::buffa::encoding::WireType::LengthDelimited,
24054                        )?;
24055                        let __sub_ctx = ctx.descend()?;
24056                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24057                        match view.armed_at.as_mut() {
24058                            Some(existing) => {
24059                                ::buffa::MessageView::merge_into_view(
24060                                    existing,
24061                                    sub,
24062                                    __sub_ctx,
24063                                )?
24064                            }
24065                            None => {
24066                                view.armed_at = ::buffa::MessageFieldView::set(
24067                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24068                                        sub,
24069                                        __sub_ctx,
24070                                    )?,
24071                                );
24072                            }
24073                        }
24074                    }
24075                    64u32 => {
24076                        ::buffa::encoding::check_wire_type(
24077                            tag,
24078                            ::buffa::encoding::WireType::LengthDelimited,
24079                        )?;
24080                        let __sub_ctx = ctx.descend()?;
24081                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24082                        match view.completed_at.as_mut() {
24083                            Some(existing) => {
24084                                ::buffa::MessageView::merge_into_view(
24085                                    existing,
24086                                    sub,
24087                                    __sub_ctx,
24088                                )?
24089                            }
24090                            None => {
24091                                view.completed_at = ::buffa::MessageFieldView::set(
24092                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
24093                                        sub,
24094                                        __sub_ctx,
24095                                    )?,
24096                                );
24097                            }
24098                        }
24099                    }
24100                    70u32 => {
24101                        if tag.wire_type()
24102                            == ::buffa::encoding::WireType::LengthDelimited
24103                        {
24104                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
24105                            view.child_order_ids.reserve(payload.len() / 8usize);
24106                            let mut pcur: &[u8] = payload;
24107                            while !pcur.is_empty() {
24108                                view.child_order_ids
24109                                    .push(::buffa::types::decode_fixed64(&mut pcur)?);
24110                            }
24111                        } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64
24112                        {
24113                            view.child_order_ids
24114                                .push(::buffa::types::decode_fixed64(&mut cur)?);
24115                        } else {
24116                            return Err(
24117                                ::buffa::encoding::wire_type_mismatch(
24118                                    tag,
24119                                    ::buffa::encoding::WireType::LengthDelimited,
24120                                ),
24121                            );
24122                        }
24123                    }
24124                    30u32 => {
24125                        ::buffa::encoding::check_wire_type(
24126                            tag,
24127                            ::buffa::encoding::WireType::LengthDelimited,
24128                        )?;
24129                        let __sub_ctx = ctx.descend()?;
24130                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24131                        if let Some(
24132                            super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24133                                ref mut existing,
24134                            ),
24135                        ) = view.configuration
24136                        {
24137                            ::buffa::MessageView::merge_into_view(
24138                                &mut **existing,
24139                                sub,
24140                                __sub_ctx,
24141                            )?;
24142                        } else {
24143                            view.configuration = Some(
24144                                super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24145                                    ::buffa::alloc::boxed::Box::new(
24146                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
24147                                            sub,
24148                                            __sub_ctx,
24149                                        )?,
24150                                    ),
24151                                ),
24152                            );
24153                        }
24154                    }
24155                    31u32 => {
24156                        ::buffa::encoding::check_wire_type(
24157                            tag,
24158                            ::buffa::encoding::WireType::LengthDelimited,
24159                        )?;
24160                        let __sub_ctx = ctx.descend()?;
24161                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24162                        if let Some(
24163                            super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24164                                ref mut existing,
24165                            ),
24166                        ) = view.configuration
24167                        {
24168                            ::buffa::MessageView::merge_into_view(
24169                                &mut **existing,
24170                                sub,
24171                                __sub_ctx,
24172                            )?;
24173                        } else {
24174                            view.configuration = Some(
24175                                super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24176                                    ::buffa::alloc::boxed::Box::new(
24177                                        <super::super::__buffa::view::ConditionalTriggerView as ::buffa::MessageView>::decode_view_ctx(
24178                                            sub,
24179                                            __sub_ctx,
24180                                        )?,
24181                                    ),
24182                                ),
24183                            );
24184                        }
24185                    }
24186                    32u32 => {
24187                        ::buffa::encoding::check_wire_type(
24188                            tag,
24189                            ::buffa::encoding::WireType::LengthDelimited,
24190                        )?;
24191                        let __sub_ctx = ctx.descend()?;
24192                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24193                        if let Some(
24194                            super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24195                                ref mut existing,
24196                            ),
24197                        ) = view.configuration
24198                        {
24199                            ::buffa::MessageView::merge_into_view(
24200                                &mut **existing,
24201                                sub,
24202                                __sub_ctx,
24203                            )?;
24204                        } else {
24205                            view.configuration = Some(
24206                                super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24207                                    ::buffa::alloc::boxed::Box::new(
24208                                        <super::super::__buffa::view::TrailingStopTriggerView as ::buffa::MessageView>::decode_view_ctx(
24209                                            sub,
24210                                            __sub_ctx,
24211                                        )?,
24212                                    ),
24213                                ),
24214                            );
24215                        }
24216                    }
24217                    33u32 => {
24218                        ::buffa::encoding::check_wire_type(
24219                            tag,
24220                            ::buffa::encoding::WireType::LengthDelimited,
24221                        )?;
24222                        let __sub_ctx = ctx.descend()?;
24223                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24224                        if let Some(
24225                            super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24226                                ref mut existing,
24227                            ),
24228                        ) = view.configuration
24229                        {
24230                            ::buffa::MessageView::merge_into_view(
24231                                &mut **existing,
24232                                sub,
24233                                __sub_ctx,
24234                            )?;
24235                        } else {
24236                            view.configuration = Some(
24237                                super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24238                                    ::buffa::alloc::boxed::Box::new(
24239                                        <super::super::__buffa::view::TwapTriggerView as ::buffa::MessageView>::decode_view_ctx(
24240                                            sub,
24241                                            __sub_ctx,
24242                                        )?,
24243                                    ),
24244                                ),
24245                            );
24246                        }
24247                    }
24248                    34u32 => {
24249                        ::buffa::encoding::check_wire_type(
24250                            tag,
24251                            ::buffa::encoding::WireType::LengthDelimited,
24252                        )?;
24253                        let __sub_ctx = ctx.descend()?;
24254                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24255                        if let Some(
24256                            super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24257                                ref mut existing,
24258                            ),
24259                        ) = view.configuration
24260                        {
24261                            ::buffa::MessageView::merge_into_view(
24262                                &mut **existing,
24263                                sub,
24264                                __sub_ctx,
24265                            )?;
24266                        } else {
24267                            view.configuration = Some(
24268                                super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24269                                    ::buffa::alloc::boxed::Box::new(
24270                                        <super::super::__buffa::view::LadderTriggerView as ::buffa::MessageView>::decode_view_ctx(
24271                                            sub,
24272                                            __sub_ctx,
24273                                        )?,
24274                                    ),
24275                                ),
24276                            );
24277                        }
24278                    }
24279                    100u32 => {
24280                        ::buffa::encoding::check_wire_type(
24281                            tag,
24282                            ::buffa::encoding::WireType::LengthDelimited,
24283                        )?;
24284                        let __sub_ctx = ctx.descend()?;
24285                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24286                        if let Some(
24287                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24288                                ref mut existing,
24289                            ),
24290                        ) = view.runtime_details
24291                        {
24292                            ::buffa::MessageView::merge_into_view(
24293                                &mut **existing,
24294                                sub,
24295                                __sub_ctx,
24296                            )?;
24297                        } else {
24298                            view.runtime_details = Some(
24299                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24300                                    ::buffa::alloc::boxed::Box::new(
24301                                        <super::super::__buffa::view::StopDetailsView as ::buffa::MessageView>::decode_view_ctx(
24302                                            sub,
24303                                            __sub_ctx,
24304                                        )?,
24305                                    ),
24306                                ),
24307                            );
24308                        }
24309                    }
24310                    101u32 => {
24311                        ::buffa::encoding::check_wire_type(
24312                            tag,
24313                            ::buffa::encoding::WireType::LengthDelimited,
24314                        )?;
24315                        let __sub_ctx = ctx.descend()?;
24316                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24317                        if let Some(
24318                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24319                                ref mut existing,
24320                            ),
24321                        ) = view.runtime_details
24322                        {
24323                            ::buffa::MessageView::merge_into_view(
24324                                &mut **existing,
24325                                sub,
24326                                __sub_ctx,
24327                            )?;
24328                        } else {
24329                            view.runtime_details = Some(
24330                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24331                                    ::buffa::alloc::boxed::Box::new(
24332                                        <super::super::__buffa::view::TrailingDetailsView as ::buffa::MessageView>::decode_view_ctx(
24333                                            sub,
24334                                            __sub_ctx,
24335                                        )?,
24336                                    ),
24337                                ),
24338                            );
24339                        }
24340                    }
24341                    102u32 => {
24342                        ::buffa::encoding::check_wire_type(
24343                            tag,
24344                            ::buffa::encoding::WireType::LengthDelimited,
24345                        )?;
24346                        let __sub_ctx = ctx.descend()?;
24347                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24348                        if let Some(
24349                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24350                                ref mut existing,
24351                            ),
24352                        ) = view.runtime_details
24353                        {
24354                            ::buffa::MessageView::merge_into_view(
24355                                &mut **existing,
24356                                sub,
24357                                __sub_ctx,
24358                            )?;
24359                        } else {
24360                            view.runtime_details = Some(
24361                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24362                                    ::buffa::alloc::boxed::Box::new(
24363                                        <super::super::__buffa::view::TwapDetailsView as ::buffa::MessageView>::decode_view_ctx(
24364                                            sub,
24365                                            __sub_ctx,
24366                                        )?,
24367                                    ),
24368                                ),
24369                            );
24370                        }
24371                    }
24372                    103u32 => {
24373                        ::buffa::encoding::check_wire_type(
24374                            tag,
24375                            ::buffa::encoding::WireType::LengthDelimited,
24376                        )?;
24377                        let __sub_ctx = ctx.descend()?;
24378                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
24379                        if let Some(
24380                            super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24381                                ref mut existing,
24382                            ),
24383                        ) = view.runtime_details
24384                        {
24385                            ::buffa::MessageView::merge_into_view(
24386                                &mut **existing,
24387                                sub,
24388                                __sub_ctx,
24389                            )?;
24390                        } else {
24391                            view.runtime_details = Some(
24392                                super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24393                                    ::buffa::alloc::boxed::Box::new(
24394                                        <super::super::__buffa::view::LadderDetailsView as ::buffa::MessageView>::decode_view_ctx(
24395                                            sub,
24396                                            __sub_ctx,
24397                                        )?,
24398                                    ),
24399                                ),
24400                            );
24401                        }
24402                    }
24403                    _ => {
24404                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
24405                        let span_len = before_tag.len() - cur.len();
24406                        view.__buffa_unknown_fields
24407                            .push_record(before_tag, span_len, ctx)?;
24408                    }
24409                }
24410                ::core::result::Result::Ok(cur)
24411            }
24412            fn to_owned_message(
24413                &self,
24414            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
24415                self.to_owned_from_source(None)
24416            }
24417            #[allow(clippy::useless_conversion, clippy::needless_update)]
24418            fn to_owned_from_source(
24419                &self,
24420                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
24421            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
24422                #[allow(unused_imports)]
24423                use ::buffa::alloc::string::ToString as _;
24424                let _ = __buffa_src;
24425                ::core::result::Result::Ok(super::super::Trigger {
24426                    trigger_id: self.trigger_id,
24427                    subaccount_id: self.subaccount_id,
24428                    symbol_id: self.symbol_id,
24429                    symbol: self.symbol.to_string(),
24430                    status: self.status,
24431                    parent_order_id: self.parent_order_id,
24432                    qty_scaled: self.qty_scaled,
24433                    fee_asset: self.fee_asset,
24434                    self_trade_prevention_mode: self.self_trade_prevention_mode,
24435                    client_trigger_id: self.client_trigger_id.to_string(),
24436                    created_at: match self.created_at.as_option() {
24437                        Some(v) => {
24438                            ::buffa::MessageField::<
24439                                ::buffa_types::google::protobuf::Timestamp,
24440                            >::some(v.to_owned_from_source(__buffa_src)?)
24441                        }
24442                        None => ::buffa::MessageField::none(),
24443                    },
24444                    updated_at: match self.updated_at.as_option() {
24445                        Some(v) => {
24446                            ::buffa::MessageField::<
24447                                ::buffa_types::google::protobuf::Timestamp,
24448                            >::some(v.to_owned_from_source(__buffa_src)?)
24449                        }
24450                        None => ::buffa::MessageField::none(),
24451                    },
24452                    armed_at: match self.armed_at.as_option() {
24453                        Some(v) => {
24454                            ::buffa::MessageField::<
24455                                ::buffa_types::google::protobuf::Timestamp,
24456                            >::some(v.to_owned_from_source(__buffa_src)?)
24457                        }
24458                        None => ::buffa::MessageField::none(),
24459                    },
24460                    completed_at: match self.completed_at.as_option() {
24461                        Some(v) => {
24462                            ::buffa::MessageField::<
24463                                ::buffa_types::google::protobuf::Timestamp,
24464                            >::some(v.to_owned_from_source(__buffa_src)?)
24465                        }
24466                        None => ::buffa::MessageField::none(),
24467                    },
24468                    child_order_ids: self.child_order_ids.to_vec(),
24469                    configuration: match self.configuration.as_ref() {
24470                        ::core::option::Option::Some(v) => {
24471                            ::core::option::Option::Some(
24472                                match v {
24473                                    super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24474                                        v,
24475                                    ) => {
24476                                        super::super::__buffa::oneof::trigger::Configuration::StopLoss(
24477                                            ::buffa::alloc::boxed::Box::new(
24478                                                v.to_owned_from_source(__buffa_src)?,
24479                                            ),
24480                                        )
24481                                    }
24482                                    super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24483                                        v,
24484                                    ) => {
24485                                        super::super::__buffa::oneof::trigger::Configuration::TakeProfit(
24486                                            ::buffa::alloc::boxed::Box::new(
24487                                                v.to_owned_from_source(__buffa_src)?,
24488                                            ),
24489                                        )
24490                                    }
24491                                    super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24492                                        v,
24493                                    ) => {
24494                                        super::super::__buffa::oneof::trigger::Configuration::TrailingStop(
24495                                            ::buffa::alloc::boxed::Box::new(
24496                                                v.to_owned_from_source(__buffa_src)?,
24497                                            ),
24498                                        )
24499                                    }
24500                                    super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24501                                        v,
24502                                    ) => {
24503                                        super::super::__buffa::oneof::trigger::Configuration::Twap(
24504                                            ::buffa::alloc::boxed::Box::new(
24505                                                v.to_owned_from_source(__buffa_src)?,
24506                                            ),
24507                                        )
24508                                    }
24509                                    super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24510                                        v,
24511                                    ) => {
24512                                        super::super::__buffa::oneof::trigger::Configuration::Ladder(
24513                                            ::buffa::alloc::boxed::Box::new(
24514                                                v.to_owned_from_source(__buffa_src)?,
24515                                            ),
24516                                        )
24517                                    }
24518                                },
24519                            )
24520                        }
24521                        ::core::option::Option::None => ::core::option::Option::None,
24522                    },
24523                    runtime_details: match self.runtime_details.as_ref() {
24524                        ::core::option::Option::Some(v) => {
24525                            ::core::option::Option::Some(
24526                                match v {
24527                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24528                                        v,
24529                                    ) => {
24530                                        super::super::__buffa::oneof::trigger::RuntimeDetails::Stop(
24531                                            ::buffa::alloc::boxed::Box::new(
24532                                                v.to_owned_from_source(__buffa_src)?,
24533                                            ),
24534                                        )
24535                                    }
24536                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24537                                        v,
24538                                    ) => {
24539                                        super::super::__buffa::oneof::trigger::RuntimeDetails::Trailing(
24540                                            ::buffa::alloc::boxed::Box::new(
24541                                                v.to_owned_from_source(__buffa_src)?,
24542                                            ),
24543                                        )
24544                                    }
24545                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24546                                        v,
24547                                    ) => {
24548                                        super::super::__buffa::oneof::trigger::RuntimeDetails::TwapState(
24549                                            ::buffa::alloc::boxed::Box::new(
24550                                                v.to_owned_from_source(__buffa_src)?,
24551                                            ),
24552                                        )
24553                                    }
24554                                    super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24555                                        v,
24556                                    ) => {
24557                                        super::super::__buffa::oneof::trigger::RuntimeDetails::LadderState(
24558                                            ::buffa::alloc::boxed::Box::new(
24559                                                v.to_owned_from_source(__buffa_src)?,
24560                                            ),
24561                                        )
24562                                    }
24563                                },
24564                            )
24565                        }
24566                        ::core::option::Option::None => ::core::option::Option::None,
24567                    },
24568                    __buffa_unknown_fields: self
24569                        .__buffa_unknown_fields
24570                        .to_owned()?
24571                        .into(),
24572                    ..::core::default::Default::default()
24573                })
24574            }
24575        }
24576        impl<'a> ::buffa::ViewEncode<'a> for TriggerView<'a> {
24577            #[allow(clippy::needless_borrow, clippy::let_and_return)]
24578            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
24579                #[allow(unused_imports)]
24580                use ::buffa::Enumeration as _;
24581                let mut size = 0u32;
24582                if self.trigger_id != 0u64 {
24583                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24584                }
24585                if self.subaccount_id != 0u64 {
24586                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24587                }
24588                if self.symbol_id != 0u32 {
24589                    size
24590                        += 1u32
24591                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
24592                }
24593                if !self.symbol.is_empty() {
24594                    size
24595                        += 1u32
24596                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
24597                }
24598                {
24599                    let val = self.status.to_i32();
24600                    if val != 0 {
24601                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
24602                    }
24603                }
24604                if self.parent_order_id.is_some() {
24605                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
24606                }
24607                if self.qty_scaled != 0i64 {
24608                    size
24609                        += 2u32
24610                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
24611                }
24612                {
24613                    let val = self.fee_asset.to_i32();
24614                    if val != 0 {
24615                        size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
24616                    }
24617                }
24618                {
24619                    let val = self.self_trade_prevention_mode.to_i32();
24620                    if val != 0 {
24621                        size += 2u32 + ::buffa::types::int32_encoded_len(val) as u32;
24622                    }
24623                }
24624                if let ::core::option::Option::Some(ref v) = self.configuration {
24625                    match v {
24626                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
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::TakeProfit(
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                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24647                            x,
24648                        ) => {
24649                            let __slot = __cache.reserve();
24650                            let inner = x.compute_size(__cache);
24651                            __cache.set(__slot, inner);
24652                            size
24653                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24654                                    + inner;
24655                        }
24656                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24657                            x,
24658                        ) => {
24659                            let __slot = __cache.reserve();
24660                            let inner = x.compute_size(__cache);
24661                            __cache.set(__slot, inner);
24662                            size
24663                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24664                                    + inner;
24665                        }
24666                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24667                            x,
24668                        ) => {
24669                            let __slot = __cache.reserve();
24670                            let inner = x.compute_size(__cache);
24671                            __cache.set(__slot, inner);
24672                            size
24673                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24674                                    + inner;
24675                        }
24676                    }
24677                }
24678                if !self.client_trigger_id.is_empty() {
24679                    size
24680                        += 2u32
24681                            + ::buffa::types::string_encoded_len(&self.client_trigger_id)
24682                                as u32;
24683                }
24684                if self.created_at.is_set() {
24685                    let __slot = __cache.reserve();
24686                    let inner_size = self.created_at.compute_size(__cache);
24687                    __cache.set(__slot, inner_size);
24688                    size
24689                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24690                            + inner_size;
24691                }
24692                if self.updated_at.is_set() {
24693                    let __slot = __cache.reserve();
24694                    let inner_size = self.updated_at.compute_size(__cache);
24695                    __cache.set(__slot, inner_size);
24696                    size
24697                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24698                            + inner_size;
24699                }
24700                if self.armed_at.is_set() {
24701                    let __slot = __cache.reserve();
24702                    let inner_size = self.armed_at.compute_size(__cache);
24703                    __cache.set(__slot, inner_size);
24704                    size
24705                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24706                            + inner_size;
24707                }
24708                if self.completed_at.is_set() {
24709                    let __slot = __cache.reserve();
24710                    let inner_size = self.completed_at.compute_size(__cache);
24711                    __cache.set(__slot, inner_size);
24712                    size
24713                        += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
24714                            + inner_size;
24715                }
24716                if !self.child_order_ids.is_empty() {
24717                    let payload: u32 = self.child_order_ids.len() as u32
24718                        * ::buffa::types::FIXED64_ENCODED_LEN as u32;
24719                    size
24720                        += 2u32 + ::buffa::encoding::varint_len(payload as u64) as u32
24721                            + payload;
24722                }
24723                if let ::core::option::Option::Some(ref v) = self.runtime_details {
24724                    match v {
24725                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24726                            x,
24727                        ) => {
24728                            let __slot = __cache.reserve();
24729                            let inner = x.compute_size(__cache);
24730                            __cache.set(__slot, inner);
24731                            size
24732                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24733                                    + inner;
24734                        }
24735                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24736                            x,
24737                        ) => {
24738                            let __slot = __cache.reserve();
24739                            let inner = x.compute_size(__cache);
24740                            __cache.set(__slot, inner);
24741                            size
24742                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24743                                    + inner;
24744                        }
24745                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24746                            x,
24747                        ) => {
24748                            let __slot = __cache.reserve();
24749                            let inner = x.compute_size(__cache);
24750                            __cache.set(__slot, inner);
24751                            size
24752                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24753                                    + inner;
24754                        }
24755                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24756                            x,
24757                        ) => {
24758                            let __slot = __cache.reserve();
24759                            let inner = x.compute_size(__cache);
24760                            __cache.set(__slot, inner);
24761                            size
24762                                += 2u32 + ::buffa::encoding::varint_len(inner as u64) as u32
24763                                    + inner;
24764                        }
24765                    }
24766                }
24767                size += self.__buffa_unknown_fields.encoded_len() as u32;
24768                size
24769            }
24770            #[allow(clippy::needless_borrow)]
24771            fn write_to(
24772                &self,
24773                __cache: &mut ::buffa::SizeCache,
24774                buf: &mut impl ::buffa::bytes::BufMut,
24775            ) {
24776                #[allow(unused_imports)]
24777                use ::buffa::Enumeration as _;
24778                if self.trigger_id != 0u64 {
24779                    ::buffa::types::put_fixed64_field(1u32, self.trigger_id, buf);
24780                }
24781                if self.subaccount_id != 0u64 {
24782                    ::buffa::types::put_fixed64_field(2u32, self.subaccount_id, buf);
24783                }
24784                if self.symbol_id != 0u32 {
24785                    ::buffa::types::put_uint32_field(3u32, self.symbol_id, buf);
24786                }
24787                if !self.symbol.is_empty() {
24788                    ::buffa::types::put_string_field(4u32, &self.symbol, buf);
24789                }
24790                {
24791                    let val = self.status.to_i32();
24792                    if val != 0 {
24793                        ::buffa::types::put_int32_field(5u32, val, buf);
24794                    }
24795                }
24796                if let Some(v) = self.parent_order_id {
24797                    ::buffa::types::put_fixed64_field(6u32, v, buf);
24798                }
24799                if self.qty_scaled != 0i64 {
24800                    ::buffa::types::put_int64_field(20u32, self.qty_scaled, buf);
24801                }
24802                {
24803                    let val = self.fee_asset.to_i32();
24804                    if val != 0 {
24805                        ::buffa::types::put_int32_field(21u32, val, buf);
24806                    }
24807                }
24808                {
24809                    let val = self.self_trade_prevention_mode.to_i32();
24810                    if val != 0 {
24811                        ::buffa::types::put_int32_field(22u32, val, buf);
24812                    }
24813                }
24814                if let ::core::option::Option::Some(ref v) = self.configuration {
24815                    match v {
24816                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
24817                            x,
24818                        ) => {
24819                            ::buffa::types::put_len_delimited_header(
24820                                30u32,
24821                                __cache.consume_next(),
24822                                buf,
24823                            );
24824                            x.write_to(__cache, buf);
24825                        }
24826                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
24827                            x,
24828                        ) => {
24829                            ::buffa::types::put_len_delimited_header(
24830                                31u32,
24831                                __cache.consume_next(),
24832                                buf,
24833                            );
24834                            x.write_to(__cache, buf);
24835                        }
24836                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
24837                            x,
24838                        ) => {
24839                            ::buffa::types::put_len_delimited_header(
24840                                32u32,
24841                                __cache.consume_next(),
24842                                buf,
24843                            );
24844                            x.write_to(__cache, buf);
24845                        }
24846                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
24847                            x,
24848                        ) => {
24849                            ::buffa::types::put_len_delimited_header(
24850                                33u32,
24851                                __cache.consume_next(),
24852                                buf,
24853                            );
24854                            x.write_to(__cache, buf);
24855                        }
24856                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
24857                            x,
24858                        ) => {
24859                            ::buffa::types::put_len_delimited_header(
24860                                34u32,
24861                                __cache.consume_next(),
24862                                buf,
24863                            );
24864                            x.write_to(__cache, buf);
24865                        }
24866                    }
24867                }
24868                if !self.client_trigger_id.is_empty() {
24869                    ::buffa::types::put_string_field(
24870                        60u32,
24871                        &self.client_trigger_id,
24872                        buf,
24873                    );
24874                }
24875                if self.created_at.is_set() {
24876                    ::buffa::types::put_len_delimited_header(
24877                        61u32,
24878                        __cache.consume_next(),
24879                        buf,
24880                    );
24881                    self.created_at.write_to(__cache, buf);
24882                }
24883                if self.updated_at.is_set() {
24884                    ::buffa::types::put_len_delimited_header(
24885                        62u32,
24886                        __cache.consume_next(),
24887                        buf,
24888                    );
24889                    self.updated_at.write_to(__cache, buf);
24890                }
24891                if self.armed_at.is_set() {
24892                    ::buffa::types::put_len_delimited_header(
24893                        63u32,
24894                        __cache.consume_next(),
24895                        buf,
24896                    );
24897                    self.armed_at.write_to(__cache, buf);
24898                }
24899                if self.completed_at.is_set() {
24900                    ::buffa::types::put_len_delimited_header(
24901                        64u32,
24902                        __cache.consume_next(),
24903                        buf,
24904                    );
24905                    self.completed_at.write_to(__cache, buf);
24906                }
24907                if !self.child_order_ids.is_empty() {
24908                    let payload: u32 = self.child_order_ids.len() as u32
24909                        * ::buffa::types::FIXED64_ENCODED_LEN as u32;
24910                    ::buffa::types::put_len_delimited_header(70u32, payload, buf);
24911                    for &v in &self.child_order_ids {
24912                        ::buffa::types::encode_fixed64(v, buf);
24913                    }
24914                }
24915                if let ::core::option::Option::Some(ref v) = self.runtime_details {
24916                    match v {
24917                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
24918                            x,
24919                        ) => {
24920                            ::buffa::types::put_len_delimited_header(
24921                                100u32,
24922                                __cache.consume_next(),
24923                                buf,
24924                            );
24925                            x.write_to(__cache, buf);
24926                        }
24927                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
24928                            x,
24929                        ) => {
24930                            ::buffa::types::put_len_delimited_header(
24931                                101u32,
24932                                __cache.consume_next(),
24933                                buf,
24934                            );
24935                            x.write_to(__cache, buf);
24936                        }
24937                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
24938                            x,
24939                        ) => {
24940                            ::buffa::types::put_len_delimited_header(
24941                                102u32,
24942                                __cache.consume_next(),
24943                                buf,
24944                            );
24945                            x.write_to(__cache, buf);
24946                        }
24947                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
24948                            x,
24949                        ) => {
24950                            ::buffa::types::put_len_delimited_header(
24951                                103u32,
24952                                __cache.consume_next(),
24953                                buf,
24954                            );
24955                            x.write_to(__cache, buf);
24956                        }
24957                    }
24958                }
24959                self.__buffa_unknown_fields.write_to(buf);
24960            }
24961        }
24962        /// Serializes this view as protobuf JSON.
24963        ///
24964        /// Implicit-presence fields with default values are omitted, `required`
24965        /// fields are always emitted, explicit-presence (`optional`) fields are
24966        /// emitted only when set, bytes fields are base64-encoded, and enum
24967        /// values are their proto name strings.
24968        ///
24969        /// This impl uses `serialize_map(None)` because the number of emitted
24970        /// fields depends on default-omission rules; serializers that require
24971        /// known map lengths (e.g. `bincode`) will return a runtime error.
24972        /// Use the owned message type for those formats.
24973        impl<'__a> ::serde::Serialize for TriggerView<'__a> {
24974            fn serialize<__S: ::serde::Serializer>(
24975                &self,
24976                __s: __S,
24977            ) -> ::core::result::Result<__S::Ok, __S::Error> {
24978                use ::serde::ser::SerializeMap as _;
24979                let mut __map = __s.serialize_map(::core::option::Option::None)?;
24980                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.trigger_id) {
24981                    __map
24982                        .serialize_entry(
24983                            "triggerId",
24984                            &::buffa::json_helpers::ProtoJson(&self.trigger_id),
24985                        )?;
24986                }
24987                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.subaccount_id) {
24988                    __map
24989                        .serialize_entry(
24990                            "subaccountId",
24991                            &::buffa::json_helpers::ProtoJson(&self.subaccount_id),
24992                        )?;
24993                }
24994                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
24995                    __map
24996                        .serialize_entry(
24997                            "symbolId",
24998                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
24999                        )?;
25000                }
25001                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
25002                    __map.serialize_entry("symbol", self.symbol)?;
25003                }
25004                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
25005                    __map.serialize_entry("status", &self.status)?;
25006                }
25007                if let ::core::option::Option::Some(__v) = self.parent_order_id {
25008                    __map
25009                        .serialize_entry(
25010                            "parentOrderId",
25011                            &::buffa::json_helpers::ProtoJson(&__v),
25012                        )?;
25013                }
25014                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
25015                    __map
25016                        .serialize_entry(
25017                            "qtyScaled",
25018                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
25019                        )?;
25020                }
25021                if !::buffa::json_helpers::skip_if::is_default_enum_value(
25022                    &self.fee_asset,
25023                ) {
25024                    __map.serialize_entry("feeAsset", &self.fee_asset)?;
25025                }
25026                if !::buffa::json_helpers::skip_if::is_default_enum_value(
25027                    &self.self_trade_prevention_mode,
25028                ) {
25029                    __map
25030                        .serialize_entry(
25031                            "selfTradePreventionMode",
25032                            &self.self_trade_prevention_mode,
25033                        )?;
25034                }
25035                if !::buffa::json_helpers::skip_if::is_empty_str(
25036                    self.client_trigger_id,
25037                ) {
25038                    __map.serialize_entry("clientTriggerId", self.client_trigger_id)?;
25039                }
25040                {
25041                    if let ::core::option::Option::Some(__v) = self
25042                        .created_at
25043                        .as_option()
25044                    {
25045                        __map.serialize_entry("createdAt", __v)?;
25046                    }
25047                }
25048                {
25049                    if let ::core::option::Option::Some(__v) = self
25050                        .updated_at
25051                        .as_option()
25052                    {
25053                        __map.serialize_entry("updatedAt", __v)?;
25054                    }
25055                }
25056                {
25057                    if let ::core::option::Option::Some(__v) = self.armed_at.as_option()
25058                    {
25059                        __map.serialize_entry("armedAt", __v)?;
25060                    }
25061                }
25062                {
25063                    if let ::core::option::Option::Some(__v) = self
25064                        .completed_at
25065                        .as_option()
25066                    {
25067                        __map.serialize_entry("completedAt", __v)?;
25068                    }
25069                }
25070                if !self.child_order_ids.is_empty() {
25071                    __map
25072                        .serialize_entry(
25073                            "childOrderIds",
25074                            &::buffa::json_helpers::RepeatedJson(&self.child_order_ids),
25075                        )?;
25076                }
25077                if let ::core::option::Option::Some(ref __ov) = self.configuration {
25078                    match __ov {
25079                        super::super::__buffa::view::oneof::trigger::Configuration::StopLoss(
25080                            v,
25081                        ) => {
25082                            __map.serialize_entry("stopLoss", v)?;
25083                        }
25084                        super::super::__buffa::view::oneof::trigger::Configuration::TakeProfit(
25085                            v,
25086                        ) => {
25087                            __map.serialize_entry("takeProfit", v)?;
25088                        }
25089                        super::super::__buffa::view::oneof::trigger::Configuration::TrailingStop(
25090                            v,
25091                        ) => {
25092                            __map.serialize_entry("trailingStop", v)?;
25093                        }
25094                        super::super::__buffa::view::oneof::trigger::Configuration::Twap(
25095                            v,
25096                        ) => {
25097                            __map.serialize_entry("twap", v)?;
25098                        }
25099                        super::super::__buffa::view::oneof::trigger::Configuration::Ladder(
25100                            v,
25101                        ) => {
25102                            __map.serialize_entry("ladder", v)?;
25103                        }
25104                    }
25105                }
25106                if let ::core::option::Option::Some(ref __ov) = self.runtime_details {
25107                    match __ov {
25108                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Stop(
25109                            v,
25110                        ) => {
25111                            __map.serialize_entry("stop", v)?;
25112                        }
25113                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::Trailing(
25114                            v,
25115                        ) => {
25116                            __map.serialize_entry("trailing", v)?;
25117                        }
25118                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::TwapState(
25119                            v,
25120                        ) => {
25121                            __map.serialize_entry("twapState", v)?;
25122                        }
25123                        super::super::__buffa::view::oneof::trigger::RuntimeDetails::LadderState(
25124                            v,
25125                        ) => {
25126                            __map.serialize_entry("ladderState", v)?;
25127                        }
25128                    }
25129                }
25130                __map.end()
25131            }
25132        }
25133        impl<'a> ::buffa::MessageName for TriggerView<'a> {
25134            const PACKAGE: &'static str = "triggers.v1";
25135            const NAME: &'static str = "Trigger";
25136            const FULL_NAME: &'static str = "triggers.v1.Trigger";
25137            const TYPE_URL: &'static str = "type.googleapis.com/triggers.v1.Trigger";
25138        }
25139        ::buffa::impl_default_view_instance!(TriggerView);
25140        ::buffa::impl_view_reborrow!(TriggerView);
25141        /** Self-contained, `'static` owned view of a `Trigger` message.
25142
25143 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.
25144
25145 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.*/
25146        #[derive(Clone, Debug)]
25147        pub struct TriggerOwnedView(::buffa::OwnedView<TriggerView<'static>>);
25148        impl TriggerOwnedView {
25149            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
25150            ///
25151            /// The view borrows directly from the buffer's data; the buffer is
25152            /// retained inside the returned handle.
25153            ///
25154            /// # Errors
25155            ///
25156            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
25157            /// protobuf data.
25158            pub fn decode(
25159                bytes: ::buffa::bytes::Bytes,
25160            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25161                ::core::result::Result::Ok(
25162                    TriggerOwnedView(::buffa::OwnedView::decode(bytes)?),
25163                )
25164            }
25165            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
25166            /// max message size).
25167            ///
25168            /// # Errors
25169            ///
25170            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
25171            /// exceeds the configured limits.
25172            pub fn decode_with_options(
25173                bytes: ::buffa::bytes::Bytes,
25174                opts: &::buffa::DecodeOptions,
25175            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25176                ::core::result::Result::Ok(
25177                    TriggerOwnedView(
25178                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
25179                    ),
25180                )
25181            }
25182            /// Build from an owned message via an encode → decode round-trip.
25183            ///
25184            /// # Errors
25185            ///
25186            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
25187            /// somehow invalid (should not happen for well-formed messages).
25188            pub fn from_owned(
25189                msg: &super::super::Trigger,
25190            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25191                ::core::result::Result::Ok(
25192                    TriggerOwnedView(::buffa::OwnedView::from_owned(msg)?),
25193                )
25194            }
25195            /// Borrow the full [`TriggerView`] with its lifetime tied to `&self`.
25196            #[must_use]
25197            pub fn view(&self) -> &TriggerView<'_> {
25198                self.0.reborrow()
25199            }
25200            /// Convert to the owned message type.
25201            ///
25202            /// # Errors
25203            ///
25204            /// Returns an error if re-materializing preserved unknown fields
25205            /// fails (e.g. the unknown-field limit is exceeded).
25206            pub fn to_owned_message(
25207                &self,
25208            ) -> ::core::result::Result<super::super::Trigger, ::buffa::DecodeError> {
25209                self.0.to_owned_message()
25210            }
25211            /// The underlying bytes buffer.
25212            #[must_use]
25213            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
25214                self.0.bytes()
25215            }
25216            /// Consume the handle, returning the underlying bytes buffer.
25217            #[must_use]
25218            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
25219                self.0.into_bytes()
25220            }
25221            /// Trigger ID.
25222            ///
25223            /// Field 1: `trigger_id`
25224            #[must_use]
25225            pub fn trigger_id(&self) -> u64 {
25226                self.0.reborrow().trigger_id
25227            }
25228            /// Public account or sub-account ID associated with the trigger.
25229            ///
25230            /// Field 2: `subaccount_id`
25231            #[must_use]
25232            pub fn subaccount_id(&self) -> u64 {
25233                self.0.reborrow().subaccount_id
25234            }
25235            /// Trading symbol numeric identifier.
25236            ///
25237            /// Field 3: `symbol_id`
25238            #[must_use]
25239            pub fn symbol_id(&self) -> u32 {
25240                self.0.reborrow().symbol_id
25241            }
25242            /// Trading symbol, for example "BTC-USDT".
25243            ///
25244            /// Field 4: `symbol`
25245            #[must_use]
25246            pub fn symbol(&self) -> &'_ str {
25247                self.0.reborrow().symbol
25248            }
25249            /// Current trigger lifecycle status.
25250            ///
25251            /// Field 5: `status`
25252            #[must_use]
25253            pub fn status(&self) -> ::buffa::EnumValue<super::super::TriggerStatus> {
25254                self.0.reborrow().status
25255            }
25256            /// Parent order ID for attached-risk triggers; empty for standalone triggers.
25257            ///
25258            /// Field 6: `parent_order_id`
25259            #[must_use]
25260            pub fn parent_order_id(&self) -> ::core::option::Option<u64> {
25261                self.0.reborrow().parent_order_id
25262            }
25263            /// Child quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
25264            ///
25265            /// Field 20: `qty_scaled`
25266            #[must_use]
25267            pub fn qty_scaled(&self) -> i64 {
25268                self.0.reborrow().qty_scaled
25269            }
25270            /// Fee asset for BUY child orders.
25271            ///
25272            /// Field 21: `fee_asset`
25273            #[must_use]
25274            pub fn fee_asset(
25275                &self,
25276            ) -> ::buffa::EnumValue<super::super::super::super::orders::v1::FeeAsset> {
25277                self.0.reborrow().fee_asset
25278            }
25279            /// Self-trade prevention mode for child orders.
25280            ///
25281            /// Field 22: `self_trade_prevention_mode`
25282            #[must_use]
25283            pub fn self_trade_prevention_mode(
25284                &self,
25285            ) -> ::buffa::EnumValue<
25286                super::super::super::super::orders::v1::SelfTradePreventionMode,
25287            > {
25288                self.0.reborrow().self_trade_prevention_mode
25289            }
25290            /// Client-provided trigger ID for idempotency and correlation.
25291            ///
25292            /// Field 60: `client_trigger_id`
25293            #[must_use]
25294            pub fn client_trigger_id(&self) -> &'_ str {
25295                self.0.reborrow().client_trigger_id
25296            }
25297            /// Creation timestamp.
25298            ///
25299            /// Field 61: `created_at`
25300            #[must_use]
25301            pub fn created_at(
25302                &self,
25303            ) -> &::buffa::MessageFieldView<
25304                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25305            > {
25306                &self.0.reborrow().created_at
25307            }
25308            /// Last update timestamp.
25309            ///
25310            /// Field 62: `updated_at`
25311            #[must_use]
25312            pub fn updated_at(
25313                &self,
25314            ) -> &::buffa::MessageFieldView<
25315                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25316            > {
25317                &self.0.reborrow().updated_at
25318            }
25319            /// Timestamp when the trigger became armed.
25320            ///
25321            /// Field 63: `armed_at`
25322            #[must_use]
25323            pub fn armed_at(
25324                &self,
25325            ) -> &::buffa::MessageFieldView<
25326                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25327            > {
25328                &self.0.reborrow().armed_at
25329            }
25330            /// Timestamp when the trigger reached a terminal successful state.
25331            ///
25332            /// Field 64: `completed_at`
25333            #[must_use]
25334            pub fn completed_at(
25335                &self,
25336            ) -> &::buffa::MessageFieldView<
25337                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
25338            > {
25339                &self.0.reborrow().completed_at
25340            }
25341            /// Child orders spawned by this trigger.
25342            ///
25343            /// Field 70: `child_order_ids`
25344            #[must_use]
25345            pub fn child_order_ids(&self) -> &::buffa::RepeatedView<'_, u64> {
25346                &self.0.reborrow().child_order_ids
25347            }
25348            /// Oneof `configuration`.
25349            #[must_use]
25350            pub fn configuration(
25351                &self,
25352            ) -> ::core::option::Option<
25353                &super::super::__buffa::view::oneof::trigger::Configuration<'_>,
25354            > {
25355                self.0.reborrow().configuration.as_ref()
25356            }
25357            /// Oneof `runtime_details`.
25358            #[must_use]
25359            pub fn runtime_details(
25360                &self,
25361            ) -> ::core::option::Option<
25362                &super::super::__buffa::view::oneof::trigger::RuntimeDetails<'_>,
25363            > {
25364                self.0.reborrow().runtime_details.as_ref()
25365            }
25366        }
25367        impl ::core::convert::From<::buffa::OwnedView<TriggerView<'static>>>
25368        for TriggerOwnedView {
25369            fn from(inner: ::buffa::OwnedView<TriggerView<'static>>) -> Self {
25370                TriggerOwnedView(inner)
25371            }
25372        }
25373        impl ::core::convert::From<TriggerOwnedView>
25374        for ::buffa::OwnedView<TriggerView<'static>> {
25375            fn from(wrapper: TriggerOwnedView) -> Self {
25376                wrapper.0
25377            }
25378        }
25379        impl ::core::convert::AsRef<::buffa::OwnedView<TriggerView<'static>>>
25380        for TriggerOwnedView {
25381            fn as_ref(&self) -> &::buffa::OwnedView<TriggerView<'static>> {
25382                &self.0
25383            }
25384        }
25385        impl ::buffa::HasMessageView for super::super::Trigger {
25386            type View<'a> = TriggerView<'a>;
25387            type ViewHandle = TriggerOwnedView;
25388        }
25389        impl ::serde::Serialize for TriggerOwnedView {
25390            fn serialize<__S: ::serde::Serializer>(
25391                &self,
25392                __s: __S,
25393            ) -> ::core::result::Result<__S::Ok, __S::Error> {
25394                ::serde::Serialize::serialize(&self.0, __s)
25395            }
25396        }
25397        pub mod oneof {
25398            #[allow(unused_imports)]
25399            use super::*;
25400            pub mod conditional_child_execution {
25401                #[allow(unused_imports)]
25402                use super::*;
25403                #[derive(Clone, Debug)]
25404                pub enum Execution<'a> {
25405                    MarketIoc(
25406                        ::buffa::alloc::boxed::Box<
25407                            super::super::super::super::__buffa::view::TriggerMarketIocView<
25408                                'a,
25409                            >,
25410                        >,
25411                    ),
25412                    LimitGtc(
25413                        ::buffa::alloc::boxed::Box<
25414                            super::super::super::super::__buffa::view::TriggerLimitGtcView<
25415                                'a,
25416                            >,
25417                        >,
25418                    ),
25419                    LimitIoc(
25420                        ::buffa::alloc::boxed::Box<
25421                            super::super::super::super::__buffa::view::TriggerLimitIocView<
25422                                'a,
25423                            >,
25424                        >,
25425                    ),
25426                    LimitFok(
25427                        ::buffa::alloc::boxed::Box<
25428                            super::super::super::super::__buffa::view::TriggerLimitFokView<
25429                                'a,
25430                            >,
25431                        >,
25432                    ),
25433                }
25434            }
25435            pub mod trailing_stop_trigger {
25436                #[allow(unused_imports)]
25437                use super::*;
25438                #[derive(Clone, Debug)]
25439                pub enum TrailingDistance {
25440                    TrailingDistanceTicks(i64),
25441                    TrailingDistanceBps(i32),
25442                }
25443                #[derive(Clone, Debug)]
25444                pub enum MaxSlippage {
25445                    MaxSlippageTicks(i32),
25446                    MaxSlippageBps(i32),
25447                }
25448            }
25449            pub mod twap_trigger {
25450                #[allow(unused_imports)]
25451                use super::*;
25452                #[derive(Clone, Debug)]
25453                pub enum Execution<'a> {
25454                    MarketIoc(
25455                        ::buffa::alloc::boxed::Box<
25456                            super::super::super::super::__buffa::view::TwapMarketIocView<
25457                                'a,
25458                            >,
25459                        >,
25460                    ),
25461                    LimitGtc(
25462                        ::buffa::alloc::boxed::Box<
25463                            super::super::super::super::__buffa::view::TwapLimitGtcView<
25464                                'a,
25465                            >,
25466                        >,
25467                    ),
25468                }
25469            }
25470            pub mod trigger_intent {
25471                #[allow(unused_imports)]
25472                use super::*;
25473                #[derive(Clone, Debug)]
25474                pub enum Strategy<'a> {
25475                    StopLoss(
25476                        ::buffa::alloc::boxed::Box<
25477                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25478                                'a,
25479                            >,
25480                        >,
25481                    ),
25482                    TakeProfit(
25483                        ::buffa::alloc::boxed::Box<
25484                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25485                                'a,
25486                            >,
25487                        >,
25488                    ),
25489                    TrailingStop(
25490                        ::buffa::alloc::boxed::Box<
25491                            super::super::super::super::__buffa::view::TrailingStopTriggerView<
25492                                'a,
25493                            >,
25494                        >,
25495                    ),
25496                    Twap(
25497                        ::buffa::alloc::boxed::Box<
25498                            super::super::super::super::__buffa::view::TwapTriggerView<
25499                                'a,
25500                            >,
25501                        >,
25502                    ),
25503                    Ladder(
25504                        ::buffa::alloc::boxed::Box<
25505                            super::super::super::super::__buffa::view::LadderTriggerView<
25506                                'a,
25507                            >,
25508                        >,
25509                    ),
25510                }
25511            }
25512            pub mod modify_trigger_request {
25513                #[allow(unused_imports)]
25514                use super::*;
25515                #[derive(Clone, Debug)]
25516                pub enum TrailingDistance {
25517                    TrailingDistanceTicks(i64),
25518                    TrailingDistanceBps(i32),
25519                }
25520                #[derive(Clone, Debug)]
25521                pub enum MaxSlippage {
25522                    MaxSlippageTicks(i32),
25523                    MaxSlippageBps(i32),
25524                }
25525            }
25526            pub mod trigger {
25527                #[allow(unused_imports)]
25528                use super::*;
25529                #[derive(Clone, Debug)]
25530                pub enum Configuration<'a> {
25531                    StopLoss(
25532                        ::buffa::alloc::boxed::Box<
25533                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25534                                'a,
25535                            >,
25536                        >,
25537                    ),
25538                    TakeProfit(
25539                        ::buffa::alloc::boxed::Box<
25540                            super::super::super::super::__buffa::view::ConditionalTriggerView<
25541                                'a,
25542                            >,
25543                        >,
25544                    ),
25545                    TrailingStop(
25546                        ::buffa::alloc::boxed::Box<
25547                            super::super::super::super::__buffa::view::TrailingStopTriggerView<
25548                                'a,
25549                            >,
25550                        >,
25551                    ),
25552                    Twap(
25553                        ::buffa::alloc::boxed::Box<
25554                            super::super::super::super::__buffa::view::TwapTriggerView<
25555                                'a,
25556                            >,
25557                        >,
25558                    ),
25559                    Ladder(
25560                        ::buffa::alloc::boxed::Box<
25561                            super::super::super::super::__buffa::view::LadderTriggerView<
25562                                'a,
25563                            >,
25564                        >,
25565                    ),
25566                }
25567                #[derive(Clone, Debug)]
25568                pub enum RuntimeDetails<'a> {
25569                    Stop(
25570                        ::buffa::alloc::boxed::Box<
25571                            super::super::super::super::__buffa::view::StopDetailsView<
25572                                'a,
25573                            >,
25574                        >,
25575                    ),
25576                    Trailing(
25577                        ::buffa::alloc::boxed::Box<
25578                            super::super::super::super::__buffa::view::TrailingDetailsView<
25579                                'a,
25580                            >,
25581                        >,
25582                    ),
25583                    TwapState(
25584                        ::buffa::alloc::boxed::Box<
25585                            super::super::super::super::__buffa::view::TwapDetailsView<
25586                                'a,
25587                            >,
25588                        >,
25589                    ),
25590                    LadderState(
25591                        ::buffa::alloc::boxed::Box<
25592                            super::super::super::super::__buffa::view::LadderDetailsView<
25593                                'a,
25594                            >,
25595                        >,
25596                    ),
25597                }
25598            }
25599        }
25600    }
25601    pub mod oneof {
25602        #[allow(unused_imports)]
25603        use super::*;
25604        pub mod conditional_child_execution {
25605            #[allow(unused_imports)]
25606            use super::*;
25607            #[derive(Clone, PartialEq, Debug)]
25608            pub enum Execution {
25609                MarketIoc(
25610                    ::buffa::alloc::boxed::Box<super::super::super::TriggerMarketIoc>,
25611                ),
25612                LimitGtc(
25613                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitGtc>,
25614                ),
25615                LimitIoc(
25616                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitIoc>,
25617                ),
25618                LimitFok(
25619                    ::buffa::alloc::boxed::Box<super::super::super::TriggerLimitFok>,
25620                ),
25621            }
25622            impl ::buffa::Oneof for Execution {}
25623            impl From<super::super::super::TriggerMarketIoc> for Execution {
25624                fn from(v: super::super::super::TriggerMarketIoc) -> Self {
25625                    Self::MarketIoc(::buffa::alloc::boxed::Box::new(v))
25626                }
25627            }
25628            impl From<super::super::super::TriggerMarketIoc>
25629            for ::core::option::Option<Execution> {
25630                fn from(v: super::super::super::TriggerMarketIoc) -> Self {
25631                    Self::Some(Execution::from(v))
25632                }
25633            }
25634            impl From<super::super::super::TriggerLimitGtc> for Execution {
25635                fn from(v: super::super::super::TriggerLimitGtc) -> Self {
25636                    Self::LimitGtc(::buffa::alloc::boxed::Box::new(v))
25637                }
25638            }
25639            impl From<super::super::super::TriggerLimitGtc>
25640            for ::core::option::Option<Execution> {
25641                fn from(v: super::super::super::TriggerLimitGtc) -> Self {
25642                    Self::Some(Execution::from(v))
25643                }
25644            }
25645            impl From<super::super::super::TriggerLimitIoc> for Execution {
25646                fn from(v: super::super::super::TriggerLimitIoc) -> Self {
25647                    Self::LimitIoc(::buffa::alloc::boxed::Box::new(v))
25648                }
25649            }
25650            impl From<super::super::super::TriggerLimitIoc>
25651            for ::core::option::Option<Execution> {
25652                fn from(v: super::super::super::TriggerLimitIoc) -> Self {
25653                    Self::Some(Execution::from(v))
25654                }
25655            }
25656            impl From<super::super::super::TriggerLimitFok> for Execution {
25657                fn from(v: super::super::super::TriggerLimitFok) -> Self {
25658                    Self::LimitFok(::buffa::alloc::boxed::Box::new(v))
25659                }
25660            }
25661            impl From<super::super::super::TriggerLimitFok>
25662            for ::core::option::Option<Execution> {
25663                fn from(v: super::super::super::TriggerLimitFok) -> Self {
25664                    Self::Some(Execution::from(v))
25665                }
25666            }
25667            impl serde::Serialize for Execution {
25668                fn serialize<S: serde::Serializer>(
25669                    &self,
25670                    s: S,
25671                ) -> ::core::result::Result<S::Ok, S::Error> {
25672                    use serde::ser::SerializeMap;
25673                    let mut map = s.serialize_map(Some(1))?;
25674                    match self {
25675                        Self::MarketIoc(v) => {
25676                            map.serialize_entry("marketIoc", v)?;
25677                        }
25678                        Self::LimitGtc(v) => {
25679                            map.serialize_entry("limitGtc", v)?;
25680                        }
25681                        Self::LimitIoc(v) => {
25682                            map.serialize_entry("limitIoc", v)?;
25683                        }
25684                        Self::LimitFok(v) => {
25685                            map.serialize_entry("limitFok", v)?;
25686                        }
25687                    }
25688                    map.end()
25689                }
25690            }
25691        }
25692        pub mod trailing_stop_trigger {
25693            #[allow(unused_imports)]
25694            use super::*;
25695            /// Required trailing distance.
25696            #[derive(Clone, PartialEq, Debug)]
25697            pub enum TrailingDistance {
25698                TrailingDistanceTicks(i64),
25699                TrailingDistanceBps(i32),
25700            }
25701            impl ::buffa::Oneof for TrailingDistance {}
25702            impl serde::Serialize for TrailingDistance {
25703                fn serialize<S: serde::Serializer>(
25704                    &self,
25705                    s: S,
25706                ) -> ::core::result::Result<S::Ok, S::Error> {
25707                    use serde::ser::SerializeMap;
25708                    let mut map = s.serialize_map(Some(1))?;
25709                    match self {
25710                        Self::TrailingDistanceTicks(v) => {
25711                            map.serialize_entry(
25712                                "trailingDistanceTicks",
25713                                &::buffa::json_helpers::ProtoJson(v),
25714                            )?;
25715                        }
25716                        Self::TrailingDistanceBps(v) => {
25717                            map.serialize_entry(
25718                                "trailingDistanceBps",
25719                                &::buffa::json_helpers::ProtoJson(v),
25720                            )?;
25721                        }
25722                    }
25723                    map.end()
25724                }
25725            }
25726            /// Optional protection applied when the market child fires.
25727            #[derive(Clone, PartialEq, Debug)]
25728            pub enum MaxSlippage {
25729                MaxSlippageTicks(i32),
25730                MaxSlippageBps(i32),
25731            }
25732            impl ::buffa::Oneof for MaxSlippage {}
25733            impl serde::Serialize for MaxSlippage {
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::MaxSlippageTicks(v) => {
25742                            map.serialize_entry(
25743                                "maxSlippageTicks",
25744                                &::buffa::json_helpers::ProtoJson(v),
25745                            )?;
25746                        }
25747                        Self::MaxSlippageBps(v) => {
25748                            map.serialize_entry(
25749                                "maxSlippageBps",
25750                                &::buffa::json_helpers::ProtoJson(v),
25751                            )?;
25752                        }
25753                    }
25754                    map.end()
25755                }
25756            }
25757        }
25758        pub mod twap_trigger {
25759            #[allow(unused_imports)]
25760            use super::*;
25761            /// Proven slice execution behavior.
25762            #[derive(Clone, PartialEq, Debug)]
25763            pub enum Execution {
25764                MarketIoc(
25765                    ::buffa::alloc::boxed::Box<super::super::super::TwapMarketIoc>,
25766                ),
25767                LimitGtc(::buffa::alloc::boxed::Box<super::super::super::TwapLimitGtc>),
25768            }
25769            impl ::buffa::Oneof for Execution {}
25770            impl From<super::super::super::TwapMarketIoc> for Execution {
25771                fn from(v: super::super::super::TwapMarketIoc) -> Self {
25772                    Self::MarketIoc(::buffa::alloc::boxed::Box::new(v))
25773                }
25774            }
25775            impl From<super::super::super::TwapMarketIoc>
25776            for ::core::option::Option<Execution> {
25777                fn from(v: super::super::super::TwapMarketIoc) -> Self {
25778                    Self::Some(Execution::from(v))
25779                }
25780            }
25781            impl From<super::super::super::TwapLimitGtc> for Execution {
25782                fn from(v: super::super::super::TwapLimitGtc) -> Self {
25783                    Self::LimitGtc(::buffa::alloc::boxed::Box::new(v))
25784                }
25785            }
25786            impl From<super::super::super::TwapLimitGtc>
25787            for ::core::option::Option<Execution> {
25788                fn from(v: super::super::super::TwapLimitGtc) -> Self {
25789                    Self::Some(Execution::from(v))
25790                }
25791            }
25792            impl serde::Serialize for Execution {
25793                fn serialize<S: serde::Serializer>(
25794                    &self,
25795                    s: S,
25796                ) -> ::core::result::Result<S::Ok, S::Error> {
25797                    use serde::ser::SerializeMap;
25798                    let mut map = s.serialize_map(Some(1))?;
25799                    match self {
25800                        Self::MarketIoc(v) => {
25801                            map.serialize_entry("marketIoc", v)?;
25802                        }
25803                        Self::LimitGtc(v) => {
25804                            map.serialize_entry("limitGtc", v)?;
25805                        }
25806                    }
25807                    map.end()
25808                }
25809            }
25810        }
25811        pub mod trigger_intent {
25812            #[allow(unused_imports)]
25813            use super::*;
25814            /// Required trigger strategy.
25815            #[derive(Clone, PartialEq, Debug)]
25816            pub enum Strategy {
25817                StopLoss(
25818                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25819                ),
25820                TakeProfit(
25821                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25822                ),
25823                TrailingStop(
25824                    ::buffa::alloc::boxed::Box<super::super::super::TrailingStopTrigger>,
25825                ),
25826                Twap(::buffa::alloc::boxed::Box<super::super::super::TwapTrigger>),
25827                Ladder(::buffa::alloc::boxed::Box<super::super::super::LadderTrigger>),
25828            }
25829            impl ::buffa::Oneof for Strategy {}
25830            impl From<super::super::super::TrailingStopTrigger> for Strategy {
25831                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25832                    Self::TrailingStop(::buffa::alloc::boxed::Box::new(v))
25833                }
25834            }
25835            impl From<super::super::super::TrailingStopTrigger>
25836            for ::core::option::Option<Strategy> {
25837                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25838                    Self::Some(Strategy::from(v))
25839                }
25840            }
25841            impl From<super::super::super::TwapTrigger> for Strategy {
25842                fn from(v: super::super::super::TwapTrigger) -> Self {
25843                    Self::Twap(::buffa::alloc::boxed::Box::new(v))
25844                }
25845            }
25846            impl From<super::super::super::TwapTrigger>
25847            for ::core::option::Option<Strategy> {
25848                fn from(v: super::super::super::TwapTrigger) -> Self {
25849                    Self::Some(Strategy::from(v))
25850                }
25851            }
25852            impl From<super::super::super::LadderTrigger> for Strategy {
25853                fn from(v: super::super::super::LadderTrigger) -> Self {
25854                    Self::Ladder(::buffa::alloc::boxed::Box::new(v))
25855                }
25856            }
25857            impl From<super::super::super::LadderTrigger>
25858            for ::core::option::Option<Strategy> {
25859                fn from(v: super::super::super::LadderTrigger) -> Self {
25860                    Self::Some(Strategy::from(v))
25861                }
25862            }
25863            impl serde::Serialize for Strategy {
25864                fn serialize<S: serde::Serializer>(
25865                    &self,
25866                    s: S,
25867                ) -> ::core::result::Result<S::Ok, S::Error> {
25868                    use serde::ser::SerializeMap;
25869                    let mut map = s.serialize_map(Some(1))?;
25870                    match self {
25871                        Self::StopLoss(v) => {
25872                            map.serialize_entry("stopLoss", v)?;
25873                        }
25874                        Self::TakeProfit(v) => {
25875                            map.serialize_entry("takeProfit", v)?;
25876                        }
25877                        Self::TrailingStop(v) => {
25878                            map.serialize_entry("trailingStop", v)?;
25879                        }
25880                        Self::Twap(v) => {
25881                            map.serialize_entry("twap", v)?;
25882                        }
25883                        Self::Ladder(v) => {
25884                            map.serialize_entry("ladder", v)?;
25885                        }
25886                    }
25887                    map.end()
25888                }
25889            }
25890        }
25891        pub mod modify_trigger_request {
25892            #[allow(unused_imports)]
25893            use super::*;
25894            /// For trailing stop:
25895            #[derive(Clone, PartialEq, Debug)]
25896            pub enum TrailingDistance {
25897                TrailingDistanceTicks(i64),
25898                TrailingDistanceBps(i32),
25899            }
25900            impl ::buffa::Oneof for TrailingDistance {}
25901            impl serde::Serialize for TrailingDistance {
25902                fn serialize<S: serde::Serializer>(
25903                    &self,
25904                    s: S,
25905                ) -> ::core::result::Result<S::Ok, S::Error> {
25906                    use serde::ser::SerializeMap;
25907                    let mut map = s.serialize_map(Some(1))?;
25908                    match self {
25909                        Self::TrailingDistanceTicks(v) => {
25910                            map.serialize_entry(
25911                                "trailingDistanceTicks",
25912                                &::buffa::json_helpers::ProtoJson(v),
25913                            )?;
25914                        }
25915                        Self::TrailingDistanceBps(v) => {
25916                            map.serialize_entry(
25917                                "trailingDistanceBps",
25918                                &::buffa::json_helpers::ProtoJson(v),
25919                            )?;
25920                        }
25921                    }
25922                    map.end()
25923                }
25924            }
25925            /// Optional price protection.
25926            #[derive(Clone, PartialEq, Debug)]
25927            pub enum MaxSlippage {
25928                MaxSlippageTicks(i32),
25929                MaxSlippageBps(i32),
25930            }
25931            impl ::buffa::Oneof for MaxSlippage {}
25932            impl serde::Serialize for MaxSlippage {
25933                fn serialize<S: serde::Serializer>(
25934                    &self,
25935                    s: S,
25936                ) -> ::core::result::Result<S::Ok, S::Error> {
25937                    use serde::ser::SerializeMap;
25938                    let mut map = s.serialize_map(Some(1))?;
25939                    match self {
25940                        Self::MaxSlippageTicks(v) => {
25941                            map.serialize_entry(
25942                                "maxSlippageTicks",
25943                                &::buffa::json_helpers::ProtoJson(v),
25944                            )?;
25945                        }
25946                        Self::MaxSlippageBps(v) => {
25947                            map.serialize_entry(
25948                                "maxSlippageBps",
25949                                &::buffa::json_helpers::ProtoJson(v),
25950                            )?;
25951                        }
25952                    }
25953                    map.end()
25954                }
25955            }
25956        }
25957        pub mod trigger {
25958            #[allow(unused_imports)]
25959            use super::*;
25960            /// Immutable strategy configuration. The selected variant is the trigger
25961            /// category and uses the same shape accepted by CreateTrigger.
25962            #[derive(Clone, PartialEq, Debug)]
25963            pub enum Configuration {
25964                StopLoss(
25965                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25966                ),
25967                TakeProfit(
25968                    ::buffa::alloc::boxed::Box<super::super::super::ConditionalTrigger>,
25969                ),
25970                TrailingStop(
25971                    ::buffa::alloc::boxed::Box<super::super::super::TrailingStopTrigger>,
25972                ),
25973                Twap(::buffa::alloc::boxed::Box<super::super::super::TwapTrigger>),
25974                Ladder(::buffa::alloc::boxed::Box<super::super::super::LadderTrigger>),
25975            }
25976            impl ::buffa::Oneof for Configuration {}
25977            impl From<super::super::super::TrailingStopTrigger> for Configuration {
25978                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25979                    Self::TrailingStop(::buffa::alloc::boxed::Box::new(v))
25980                }
25981            }
25982            impl From<super::super::super::TrailingStopTrigger>
25983            for ::core::option::Option<Configuration> {
25984                fn from(v: super::super::super::TrailingStopTrigger) -> Self {
25985                    Self::Some(Configuration::from(v))
25986                }
25987            }
25988            impl From<super::super::super::TwapTrigger> for Configuration {
25989                fn from(v: super::super::super::TwapTrigger) -> Self {
25990                    Self::Twap(::buffa::alloc::boxed::Box::new(v))
25991                }
25992            }
25993            impl From<super::super::super::TwapTrigger>
25994            for ::core::option::Option<Configuration> {
25995                fn from(v: super::super::super::TwapTrigger) -> Self {
25996                    Self::Some(Configuration::from(v))
25997                }
25998            }
25999            impl From<super::super::super::LadderTrigger> for Configuration {
26000                fn from(v: super::super::super::LadderTrigger) -> Self {
26001                    Self::Ladder(::buffa::alloc::boxed::Box::new(v))
26002                }
26003            }
26004            impl From<super::super::super::LadderTrigger>
26005            for ::core::option::Option<Configuration> {
26006                fn from(v: super::super::super::LadderTrigger) -> Self {
26007                    Self::Some(Configuration::from(v))
26008                }
26009            }
26010            impl serde::Serialize for Configuration {
26011                fn serialize<S: serde::Serializer>(
26012                    &self,
26013                    s: S,
26014                ) -> ::core::result::Result<S::Ok, S::Error> {
26015                    use serde::ser::SerializeMap;
26016                    let mut map = s.serialize_map(Some(1))?;
26017                    match self {
26018                        Self::StopLoss(v) => {
26019                            map.serialize_entry("stopLoss", v)?;
26020                        }
26021                        Self::TakeProfit(v) => {
26022                            map.serialize_entry("takeProfit", v)?;
26023                        }
26024                        Self::TrailingStop(v) => {
26025                            map.serialize_entry("trailingStop", v)?;
26026                        }
26027                        Self::Twap(v) => {
26028                            map.serialize_entry("twap", v)?;
26029                        }
26030                        Self::Ladder(v) => {
26031                            map.serialize_entry("ladder", v)?;
26032                        }
26033                    }
26034                    map.end()
26035                }
26036            }
26037            /// Type-specific runtime state.
26038            #[derive(Clone, PartialEq, Debug)]
26039            pub enum RuntimeDetails {
26040                Stop(::buffa::alloc::boxed::Box<super::super::super::StopDetails>),
26041                Trailing(
26042                    ::buffa::alloc::boxed::Box<super::super::super::TrailingDetails>,
26043                ),
26044                TwapState(::buffa::alloc::boxed::Box<super::super::super::TwapDetails>),
26045                LadderState(
26046                    ::buffa::alloc::boxed::Box<super::super::super::LadderDetails>,
26047                ),
26048            }
26049            impl ::buffa::Oneof for RuntimeDetails {}
26050            impl From<super::super::super::StopDetails> for RuntimeDetails {
26051                fn from(v: super::super::super::StopDetails) -> Self {
26052                    Self::Stop(::buffa::alloc::boxed::Box::new(v))
26053                }
26054            }
26055            impl From<super::super::super::StopDetails>
26056            for ::core::option::Option<RuntimeDetails> {
26057                fn from(v: super::super::super::StopDetails) -> Self {
26058                    Self::Some(RuntimeDetails::from(v))
26059                }
26060            }
26061            impl From<super::super::super::TrailingDetails> for RuntimeDetails {
26062                fn from(v: super::super::super::TrailingDetails) -> Self {
26063                    Self::Trailing(::buffa::alloc::boxed::Box::new(v))
26064                }
26065            }
26066            impl From<super::super::super::TrailingDetails>
26067            for ::core::option::Option<RuntimeDetails> {
26068                fn from(v: super::super::super::TrailingDetails) -> Self {
26069                    Self::Some(RuntimeDetails::from(v))
26070                }
26071            }
26072            impl From<super::super::super::TwapDetails> for RuntimeDetails {
26073                fn from(v: super::super::super::TwapDetails) -> Self {
26074                    Self::TwapState(::buffa::alloc::boxed::Box::new(v))
26075                }
26076            }
26077            impl From<super::super::super::TwapDetails>
26078            for ::core::option::Option<RuntimeDetails> {
26079                fn from(v: super::super::super::TwapDetails) -> Self {
26080                    Self::Some(RuntimeDetails::from(v))
26081                }
26082            }
26083            impl From<super::super::super::LadderDetails> for RuntimeDetails {
26084                fn from(v: super::super::super::LadderDetails) -> Self {
26085                    Self::LadderState(::buffa::alloc::boxed::Box::new(v))
26086                }
26087            }
26088            impl From<super::super::super::LadderDetails>
26089            for ::core::option::Option<RuntimeDetails> {
26090                fn from(v: super::super::super::LadderDetails) -> Self {
26091                    Self::Some(RuntimeDetails::from(v))
26092                }
26093            }
26094            impl serde::Serialize for RuntimeDetails {
26095                fn serialize<S: serde::Serializer>(
26096                    &self,
26097                    s: S,
26098                ) -> ::core::result::Result<S::Ok, S::Error> {
26099                    use serde::ser::SerializeMap;
26100                    let mut map = s.serialize_map(Some(1))?;
26101                    match self {
26102                        Self::Stop(v) => {
26103                            map.serialize_entry("stop", v)?;
26104                        }
26105                        Self::Trailing(v) => {
26106                            map.serialize_entry("trailing", v)?;
26107                        }
26108                        Self::TwapState(v) => {
26109                            map.serialize_entry("twapState", v)?;
26110                        }
26111                        Self::LadderState(v) => {
26112                            map.serialize_entry("ladderState", v)?;
26113                        }
26114                    }
26115                    map.end()
26116                }
26117            }
26118        }
26119    }
26120    /// Register this package's `Any` type entries and extension entries.
26121    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
26122        reg.register_json_any(super::__TRIGGER_MARKET_IOC_JSON_ANY);
26123        reg.register_json_any(super::__TRIGGER_LIMIT_GTC_JSON_ANY);
26124        reg.register_json_any(super::__TRIGGER_LIMIT_IOC_JSON_ANY);
26125        reg.register_json_any(super::__TRIGGER_LIMIT_FOK_JSON_ANY);
26126        reg.register_json_any(super::__CONDITIONAL_CHILD_EXECUTION_JSON_ANY);
26127        reg.register_json_any(super::__CONDITIONAL_TRIGGER_JSON_ANY);
26128        reg.register_json_any(super::__TRAILING_STOP_TRIGGER_JSON_ANY);
26129        reg.register_json_any(super::__TWAP_MARKET_IOC_JSON_ANY);
26130        reg.register_json_any(super::__TWAP_LIMIT_GTC_JSON_ANY);
26131        reg.register_json_any(super::__TWAP_TRIGGER_JSON_ANY);
26132        reg.register_json_any(super::__LADDER_TRIGGER_JSON_ANY);
26133        reg.register_json_any(super::__TRIGGER_INTENT_JSON_ANY);
26134        reg.register_json_any(super::__CREATE_TRIGGER_REQUEST_JSON_ANY);
26135        reg.register_json_any(super::__CREATE_TRIGGER_RESPONSE_JSON_ANY);
26136        reg.register_json_any(super::__GET_TRIGGER_REQUEST_JSON_ANY);
26137        reg.register_json_any(super::__GET_TRIGGER_RESPONSE_JSON_ANY);
26138        reg.register_json_any(super::__LIST_TRIGGERS_REQUEST_JSON_ANY);
26139        reg.register_json_any(super::__LIST_TRIGGERS_RESPONSE_JSON_ANY);
26140        reg.register_json_any(super::__LIST_TRIGGER_EVENTS_REQUEST_JSON_ANY);
26141        reg.register_json_any(super::__TRIGGER_EVENT_JSON_ANY);
26142        reg.register_json_any(super::__LIST_TRIGGER_EVENTS_RESPONSE_JSON_ANY);
26143        reg.register_json_any(super::__CANCEL_TRIGGER_REQUEST_JSON_ANY);
26144        reg.register_json_any(super::__CANCEL_TRIGGER_RESPONSE_JSON_ANY);
26145        reg.register_json_any(super::__MODIFY_TRIGGER_REQUEST_JSON_ANY);
26146        reg.register_json_any(super::__MODIFY_TRIGGER_RESPONSE_JSON_ANY);
26147        reg.register_json_any(super::__PAUSE_TRIGGER_REQUEST_JSON_ANY);
26148        reg.register_json_any(super::__PAUSE_TRIGGER_RESPONSE_JSON_ANY);
26149        reg.register_json_any(super::__RESUME_TRIGGER_REQUEST_JSON_ANY);
26150        reg.register_json_any(super::__RESUME_TRIGGER_RESPONSE_JSON_ANY);
26151        reg.register_json_any(super::__STOP_DETAILS_JSON_ANY);
26152        reg.register_json_any(super::__TRAILING_DETAILS_JSON_ANY);
26153        reg.register_json_any(super::__TWAP_DETAILS_JSON_ANY);
26154        reg.register_json_any(super::__LADDER_DETAILS_JSON_ANY);
26155        reg.register_json_any(super::__TRIGGER_JSON_ANY);
26156    }
26157}
26158#[doc(inline)]
26159pub use self::__buffa::view::TriggerMarketIocView;
26160#[doc(inline)]
26161pub use self::__buffa::view::TriggerMarketIocOwnedView;
26162#[doc(inline)]
26163pub use self::__buffa::view::TriggerLimitGtcView;
26164#[doc(inline)]
26165pub use self::__buffa::view::TriggerLimitGtcOwnedView;
26166#[doc(inline)]
26167pub use self::__buffa::view::TriggerLimitIocView;
26168#[doc(inline)]
26169pub use self::__buffa::view::TriggerLimitIocOwnedView;
26170#[doc(inline)]
26171pub use self::__buffa::view::TriggerLimitFokView;
26172#[doc(inline)]
26173pub use self::__buffa::view::TriggerLimitFokOwnedView;
26174#[doc(inline)]
26175pub use self::__buffa::view::ConditionalChildExecutionView;
26176#[doc(inline)]
26177pub use self::__buffa::view::ConditionalChildExecutionOwnedView;
26178#[doc(inline)]
26179pub use self::__buffa::view::ConditionalTriggerView;
26180#[doc(inline)]
26181pub use self::__buffa::view::ConditionalTriggerOwnedView;
26182#[doc(inline)]
26183pub use self::__buffa::view::TrailingStopTriggerView;
26184#[doc(inline)]
26185pub use self::__buffa::view::TrailingStopTriggerOwnedView;
26186#[doc(inline)]
26187pub use self::__buffa::view::TwapMarketIocView;
26188#[doc(inline)]
26189pub use self::__buffa::view::TwapMarketIocOwnedView;
26190#[doc(inline)]
26191pub use self::__buffa::view::TwapLimitGtcView;
26192#[doc(inline)]
26193pub use self::__buffa::view::TwapLimitGtcOwnedView;
26194#[doc(inline)]
26195pub use self::__buffa::view::TwapTriggerView;
26196#[doc(inline)]
26197pub use self::__buffa::view::TwapTriggerOwnedView;
26198#[doc(inline)]
26199pub use self::__buffa::view::LadderTriggerView;
26200#[doc(inline)]
26201pub use self::__buffa::view::LadderTriggerOwnedView;
26202#[doc(inline)]
26203pub use self::__buffa::view::TriggerIntentView;
26204#[doc(inline)]
26205pub use self::__buffa::view::TriggerIntentOwnedView;
26206#[doc(inline)]
26207pub use self::__buffa::view::CreateTriggerRequestView;
26208#[doc(inline)]
26209pub use self::__buffa::view::CreateTriggerRequestOwnedView;
26210#[doc(inline)]
26211pub use self::__buffa::view::CreateTriggerResponseView;
26212#[doc(inline)]
26213pub use self::__buffa::view::CreateTriggerResponseOwnedView;
26214#[doc(inline)]
26215pub use self::__buffa::view::GetTriggerRequestView;
26216#[doc(inline)]
26217pub use self::__buffa::view::GetTriggerRequestOwnedView;
26218#[doc(inline)]
26219pub use self::__buffa::view::GetTriggerResponseView;
26220#[doc(inline)]
26221pub use self::__buffa::view::GetTriggerResponseOwnedView;
26222#[doc(inline)]
26223pub use self::__buffa::view::ListTriggersRequestView;
26224#[doc(inline)]
26225pub use self::__buffa::view::ListTriggersRequestOwnedView;
26226#[doc(inline)]
26227pub use self::__buffa::view::ListTriggersResponseView;
26228#[doc(inline)]
26229pub use self::__buffa::view::ListTriggersResponseOwnedView;
26230#[doc(inline)]
26231pub use self::__buffa::view::ListTriggerEventsRequestView;
26232#[doc(inline)]
26233pub use self::__buffa::view::ListTriggerEventsRequestOwnedView;
26234#[doc(inline)]
26235pub use self::__buffa::view::TriggerEventView;
26236#[doc(inline)]
26237pub use self::__buffa::view::TriggerEventOwnedView;
26238#[doc(inline)]
26239pub use self::__buffa::view::ListTriggerEventsResponseView;
26240#[doc(inline)]
26241pub use self::__buffa::view::ListTriggerEventsResponseOwnedView;
26242#[doc(inline)]
26243pub use self::__buffa::view::CancelTriggerRequestView;
26244#[doc(inline)]
26245pub use self::__buffa::view::CancelTriggerRequestOwnedView;
26246#[doc(inline)]
26247pub use self::__buffa::view::CancelTriggerResponseView;
26248#[doc(inline)]
26249pub use self::__buffa::view::CancelTriggerResponseOwnedView;
26250#[doc(inline)]
26251pub use self::__buffa::view::ModifyTriggerRequestView;
26252#[doc(inline)]
26253pub use self::__buffa::view::ModifyTriggerRequestOwnedView;
26254#[doc(inline)]
26255pub use self::__buffa::view::ModifyTriggerResponseView;
26256#[doc(inline)]
26257pub use self::__buffa::view::ModifyTriggerResponseOwnedView;
26258#[doc(inline)]
26259pub use self::__buffa::view::PauseTriggerRequestView;
26260#[doc(inline)]
26261pub use self::__buffa::view::PauseTriggerRequestOwnedView;
26262#[doc(inline)]
26263pub use self::__buffa::view::PauseTriggerResponseView;
26264#[doc(inline)]
26265pub use self::__buffa::view::PauseTriggerResponseOwnedView;
26266#[doc(inline)]
26267pub use self::__buffa::view::ResumeTriggerRequestView;
26268#[doc(inline)]
26269pub use self::__buffa::view::ResumeTriggerRequestOwnedView;
26270#[doc(inline)]
26271pub use self::__buffa::view::ResumeTriggerResponseView;
26272#[doc(inline)]
26273pub use self::__buffa::view::ResumeTriggerResponseOwnedView;
26274#[doc(inline)]
26275pub use self::__buffa::view::StopDetailsView;
26276#[doc(inline)]
26277pub use self::__buffa::view::StopDetailsOwnedView;
26278#[doc(inline)]
26279pub use self::__buffa::view::TrailingDetailsView;
26280#[doc(inline)]
26281pub use self::__buffa::view::TrailingDetailsOwnedView;
26282#[doc(inline)]
26283pub use self::__buffa::view::TwapDetailsView;
26284#[doc(inline)]
26285pub use self::__buffa::view::TwapDetailsOwnedView;
26286#[doc(inline)]
26287pub use self::__buffa::view::LadderDetailsView;
26288#[doc(inline)]
26289pub use self::__buffa::view::LadderDetailsOwnedView;
26290#[doc(inline)]
26291pub use self::__buffa::view::TriggerView;
26292#[doc(inline)]
26293pub use self::__buffa::view::TriggerOwnedView;
26294#[doc(inline)]
26295pub use self::__buffa::register_types;