Skip to main content

angzarr_client/proto/
generated.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Uuid {
4    #[prost(bytes = "vec", tag = "1")]
5    pub value: ::prost::alloc::vec::Vec<u8>,
6}
7impl ::prost::Name for Uuid {
8    const NAME: &'static str = "UUID";
9    const PACKAGE: &'static str = "angzarr";
10    fn full_name() -> ::prost::alloc::string::String {
11        "angzarr.UUID".into()
12    }
13    fn type_url() -> ::prost::alloc::string::String {
14        "/angzarr.UUID".into()
15    }
16}
17/// docs:start:cover
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct Cover {
20    #[prost(string, tag = "2")]
21    pub domain: ::prost::alloc::string::String,
22    #[prost(message, optional, tag = "1")]
23    pub root: ::core::option::Option<Uuid>,
24    /// Workflow correlation - flows through all commands/events
25    #[prost(string, tag = "3")]
26    pub correlation_id: ::prost::alloc::string::String,
27    /// Edition for diverged timelines; empty name = main timeline
28    #[prost(message, optional, tag = "4")]
29    pub edition: ::core::option::Option<Edition>,
30}
31impl ::prost::Name for Cover {
32    const NAME: &'static str = "Cover";
33    const PACKAGE: &'static str = "angzarr";
34    fn full_name() -> ::prost::alloc::string::String {
35        "angzarr.Cover".into()
36    }
37    fn type_url() -> ::prost::alloc::string::String {
38        "/angzarr.Cover".into()
39    }
40}
41/// docs:start:edition
42/// Edition identifier with optional explicit divergence points.
43///
44/// Two modes:
45/// - Implicit (divergences empty): Divergence derived from first edition event's sequence
46/// - Explicit (divergences populated): Per-domain divergence points for historical branching,
47///   saga coordination, or speculative execution
48#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct Edition {
50    /// Edition name, e.g., "v2"; empty = main timeline
51    #[prost(string, tag = "1")]
52    pub name: ::prost::alloc::string::String,
53    /// Optional: explicit per-domain divergence points
54    #[prost(message, repeated, tag = "2")]
55    pub divergences: ::prost::alloc::vec::Vec<DomainDivergence>,
56}
57impl ::prost::Name for Edition {
58    const NAME: &'static str = "Edition";
59    const PACKAGE: &'static str = "angzarr";
60    fn full_name() -> ::prost::alloc::string::String {
61        "angzarr.Edition".into()
62    }
63    fn type_url() -> ::prost::alloc::string::String {
64        "/angzarr.Edition".into()
65    }
66}
67/// Explicit divergence point for a specific domain.
68/// Used when creating historical branches or coordinating saga writes across domains.
69#[derive(Clone, PartialEq, ::prost::Message)]
70pub struct DomainDivergence {
71    /// Domain name
72    #[prost(string, tag = "1")]
73    pub domain: ::prost::alloc::string::String,
74    /// Divergence sequence number
75    #[prost(uint32, tag = "2")]
76    pub sequence: u32,
77}
78impl ::prost::Name for DomainDivergence {
79    const NAME: &'static str = "DomainDivergence";
80    const PACKAGE: &'static str = "angzarr";
81    fn full_name() -> ::prost::alloc::string::String {
82        "angzarr.DomainDivergence".into()
83    }
84    fn type_url() -> ::prost::alloc::string::String {
85        "/angzarr.DomainDivergence".into()
86    }
87}
88/// Reference to externally stored payload (claim check pattern).
89/// Used when event/command payloads exceed message bus size limits.
90#[derive(Clone, PartialEq, ::prost::Message)]
91pub struct PayloadReference {
92    #[prost(enumeration = "PayloadStorageType", tag = "1")]
93    pub storage_type: i32,
94    /// Location URI:
95    /// - file:///var/angzarr/payloads/{hash}.bin
96    /// - gs://bucket/prefix/{hash}.bin
97    /// - s3://bucket/prefix/{hash}.bin
98    #[prost(string, tag = "2")]
99    pub uri: ::prost::alloc::string::String,
100    /// Content hash for integrity verification and deduplication (SHA-256)
101    #[prost(bytes = "vec", tag = "3")]
102    pub content_hash: ::prost::alloc::vec::Vec<u8>,
103    /// Original serialized payload size in bytes
104    #[prost(uint64, tag = "4")]
105    pub original_size: u64,
106    /// Timestamp when payload was stored (for TTL cleanup)
107    #[prost(message, optional, tag = "5")]
108    pub stored_at: ::core::option::Option<::prost_types::Timestamp>,
109}
110impl ::prost::Name for PayloadReference {
111    const NAME: &'static str = "PayloadReference";
112    const PACKAGE: &'static str = "angzarr";
113    fn full_name() -> ::prost::alloc::string::String {
114        "angzarr.PayloadReference".into()
115    }
116    fn type_url() -> ::prost::alloc::string::String {
117        "/angzarr.PayloadReference".into()
118    }
119}
120/// docs:start:page_header
121/// Shared header for CommandPage and EventPage.
122/// Encodes sequence type and provenance for framework processing.
123#[derive(Clone, PartialEq, ::prost::Message)]
124pub struct PageHeader {
125    #[prost(oneof = "page_header::SequenceType", tags = "1, 2, 3")]
126    pub sequence_type: ::core::option::Option<page_header::SequenceType>,
127}
128/// Nested message and enum types in `PageHeader`.
129pub mod page_header {
130    #[derive(Clone, PartialEq, ::prost::Oneof)]
131    pub enum SequenceType {
132        /// Explicit sequence (aggregate handlers, legacy)
133        #[prost(uint32, tag = "1")]
134        Sequence(u32),
135        /// External fact (Stripe, FedEx, etc.)
136        #[prost(message, tag = "2")]
137        ExternalDeferred(super::ExternalDeferredSequence),
138        /// Saga-produced command/fact
139        #[prost(message, tag = "3")]
140        AngzarrDeferred(super::AngzarrDeferredSequence),
141    }
142}
143impl ::prost::Name for PageHeader {
144    const NAME: &'static str = "PageHeader";
145    const PACKAGE: &'static str = "angzarr";
146    fn full_name() -> ::prost::alloc::string::String {
147        "angzarr.PageHeader".into()
148    }
149    fn type_url() -> ::prost::alloc::string::String {
150        "/angzarr.PageHeader".into()
151    }
152}
153/// For facts from external systems (webhooks, integrations).
154/// Framework stamps sequence on delivery; idempotency via external_id.
155#[derive(Clone, PartialEq, ::prost::Message)]
156pub struct ExternalDeferredSequence {
157    /// Idempotency key from external system (e.g., "pi_1234" from Stripe)
158    #[prost(string, tag = "1")]
159    pub external_id: ::prost::alloc::string::String,
160    /// Human-readable origin (e.g., "Stripe webhook")
161    #[prost(string, tag = "2")]
162    pub description: ::prost::alloc::string::String,
163}
164impl ::prost::Name for ExternalDeferredSequence {
165    const NAME: &'static str = "ExternalDeferredSequence";
166    const PACKAGE: &'static str = "angzarr";
167    fn full_name() -> ::prost::alloc::string::String {
168        "angzarr.ExternalDeferredSequence".into()
169    }
170    fn type_url() -> ::prost::alloc::string::String {
171        "/angzarr.ExternalDeferredSequence".into()
172    }
173}
174/// For saga-produced commands and facts.
175/// Framework stamps sequence on delivery; idempotency derived from source info.
176/// Rejections route back to source aggregate.
177#[derive(Clone, PartialEq, ::prost::Message)]
178pub struct AngzarrDeferredSequence {
179    /// Full source aggregate (domain + root + edition) - rejection routes here
180    #[prost(message, optional, tag = "1")]
181    pub source: ::core::option::Option<Cover>,
182    /// Sequence of the triggering event
183    #[prost(uint32, tag = "2")]
184    pub source_seq: u32,
185}
186impl ::prost::Name for AngzarrDeferredSequence {
187    const NAME: &'static str = "AngzarrDeferredSequence";
188    const PACKAGE: &'static str = "angzarr";
189    fn full_name() -> ::prost::alloc::string::String {
190        "angzarr.AngzarrDeferredSequence".into()
191    }
192    fn type_url() -> ::prost::alloc::string::String {
193        "/angzarr.AngzarrDeferredSequence".into()
194    }
195}
196/// docs:start:event_page
197#[derive(Clone, PartialEq, ::prost::Message)]
198pub struct EventPage {
199    /// Sequence type and provenance
200    #[prost(message, optional, tag = "1")]
201    pub header: ::core::option::Option<PageHeader>,
202    #[prost(message, optional, tag = "2")]
203    pub created_at: ::core::option::Option<::prost_types::Timestamp>,
204    #[prost(oneof = "event_page::Payload", tags = "3, 4")]
205    pub payload: ::core::option::Option<event_page::Payload>,
206}
207/// Nested message and enum types in `EventPage`.
208pub mod event_page {
209    #[derive(Clone, PartialEq, ::prost::Oneof)]
210    pub enum Payload {
211        #[prost(message, tag = "3")]
212        Event(::prost_types::Any),
213        /// Claim check: payload stored externally
214        #[prost(message, tag = "4")]
215        External(super::PayloadReference),
216    }
217}
218impl ::prost::Name for EventPage {
219    const NAME: &'static str = "EventPage";
220    const PACKAGE: &'static str = "angzarr";
221    fn full_name() -> ::prost::alloc::string::String {
222        "angzarr.EventPage".into()
223    }
224    fn type_url() -> ::prost::alloc::string::String {
225        "/angzarr.EventPage".into()
226    }
227}
228/// docs:start:aggregate_snapshot
229/// Snapshot of aggregate state at a given sequence number.
230/// State must be a protobuf Message to serialize into Any.
231#[derive(Clone, PartialEq, ::prost::Message)]
232pub struct Snapshot {
233    #[prost(uint32, tag = "2")]
234    pub sequence: u32,
235    #[prost(message, optional, tag = "3")]
236    pub state: ::core::option::Option<::prost_types::Any>,
237    /// Controls cleanup behavior
238    #[prost(enumeration = "SnapshotRetention", tag = "4")]
239    pub retention: i32,
240}
241impl ::prost::Name for Snapshot {
242    const NAME: &'static str = "Snapshot";
243    const PACKAGE: &'static str = "angzarr";
244    fn full_name() -> ::prost::alloc::string::String {
245        "angzarr.Snapshot".into()
246    }
247    fn type_url() -> ::prost::alloc::string::String {
248        "/angzarr.Snapshot".into()
249    }
250}
251/// docs:start:event_book
252#[derive(Clone, PartialEq, ::prost::Message)]
253pub struct EventBook {
254    #[prost(message, optional, tag = "1")]
255    pub cover: ::core::option::Option<Cover>,
256    /// Snapshot state; sequence computed by framework on persist
257    #[prost(message, optional, tag = "2")]
258    pub snapshot: ::core::option::Option<Snapshot>,
259    #[prost(message, repeated, tag = "3")]
260    pub pages: ::prost::alloc::vec::Vec<EventPage>,
261    /// Field 4 removed: correlation_id moved to Cover
262    /// Field 5 removed: snapshot_state unified into snapshot field
263    ///
264    /// Computed on load, never stored: (last page seq OR snapshot seq if no pages) + 1
265    #[prost(uint32, tag = "6")]
266    pub next_sequence: u32,
267}
268impl ::prost::Name for EventBook {
269    const NAME: &'static str = "EventBook";
270    const PACKAGE: &'static str = "angzarr";
271    fn full_name() -> ::prost::alloc::string::String {
272        "angzarr.EventBook".into()
273    }
274    fn type_url() -> ::prost::alloc::string::String {
275        "/angzarr.EventBook".into()
276    }
277}
278/// Request wrapper for event operations (fact injection).
279/// Adds execution metadata (sync_mode, route_to_handler) to EventBook.
280#[derive(Clone, PartialEq, ::prost::Message)]
281pub struct EventRequest {
282    #[prost(message, optional, tag = "1")]
283    pub events: ::core::option::Option<EventBook>,
284    #[prost(enumeration = "SyncMode", tag = "2")]
285    pub sync_mode: i32,
286    /// For fact injection: when true (default), invokes command handler's handle_fact for
287    /// validation/error checking before persistence. Facts cannot be rejected, but
288    /// the handler can validate data integrity and log warnings.
289    /// When false, facts are persisted directly without handler involvement.
290    #[prost(bool, tag = "3")]
291    pub route_to_handler: bool,
292}
293impl ::prost::Name for EventRequest {
294    const NAME: &'static str = "EventRequest";
295    const PACKAGE: &'static str = "angzarr";
296    fn full_name() -> ::prost::alloc::string::String {
297        "angzarr.EventRequest".into()
298    }
299    fn type_url() -> ::prost::alloc::string::String {
300        "/angzarr.EventRequest".into()
301    }
302}
303#[derive(Clone, PartialEq, ::prost::Message)]
304pub struct Projection {
305    #[prost(message, optional, tag = "1")]
306    pub cover: ::core::option::Option<Cover>,
307    #[prost(string, tag = "2")]
308    pub projector: ::prost::alloc::string::String,
309    #[prost(uint32, tag = "3")]
310    pub sequence: u32,
311    #[prost(message, optional, tag = "4")]
312    pub projection: ::core::option::Option<::prost_types::Any>,
313}
314impl ::prost::Name for Projection {
315    const NAME: &'static str = "Projection";
316    const PACKAGE: &'static str = "angzarr";
317    fn full_name() -> ::prost::alloc::string::String {
318        "angzarr.Projection".into()
319    }
320    fn type_url() -> ::prost::alloc::string::String {
321        "/angzarr.Projection".into()
322    }
323}
324#[derive(Clone, PartialEq, ::prost::Message)]
325pub struct CommandPage {
326    /// Sequence type and provenance
327    #[prost(message, optional, tag = "1")]
328    pub header: ::core::option::Option<PageHeader>,
329    #[prost(enumeration = "MergeStrategy", tag = "2")]
330    pub merge_strategy: i32,
331    #[prost(oneof = "command_page::Payload", tags = "3, 4")]
332    pub payload: ::core::option::Option<command_page::Payload>,
333}
334/// Nested message and enum types in `CommandPage`.
335pub mod command_page {
336    #[derive(Clone, PartialEq, ::prost::Oneof)]
337    pub enum Payload {
338        #[prost(message, tag = "3")]
339        Command(::prost_types::Any),
340        /// Claim check: payload stored externally
341        #[prost(message, tag = "4")]
342        External(super::PayloadReference),
343    }
344}
345impl ::prost::Name for CommandPage {
346    const NAME: &'static str = "CommandPage";
347    const PACKAGE: &'static str = "angzarr";
348    fn full_name() -> ::prost::alloc::string::String {
349        "angzarr.CommandPage".into()
350    }
351    fn type_url() -> ::prost::alloc::string::String {
352        "/angzarr.CommandPage".into()
353    }
354}
355#[derive(Clone, PartialEq, ::prost::Message)]
356pub struct CommandBook {
357    #[prost(message, optional, tag = "1")]
358    pub cover: ::core::option::Option<Cover>,
359    /// Field 3 removed: correlation_id moved to Cover
360    /// Field 4 removed: saga_origin moved to PageHeader.angzarr_deferred
361    /// Field 5 removed: 'fact' was unused
362    #[prost(message, repeated, tag = "2")]
363    pub pages: ::prost::alloc::vec::Vec<CommandPage>,
364}
365impl ::prost::Name for CommandBook {
366    const NAME: &'static str = "CommandBook";
367    const PACKAGE: &'static str = "angzarr";
368    fn full_name() -> ::prost::alloc::string::String {
369        "angzarr.CommandBook".into()
370    }
371    fn type_url() -> ::prost::alloc::string::String {
372        "/angzarr.CommandBook".into()
373    }
374}
375/// Request wrapper for command operations.
376/// Adds execution metadata (sync_mode, cascade_error_mode) to CommandBook.
377#[derive(Clone, PartialEq, ::prost::Message)]
378pub struct CommandRequest {
379    #[prost(message, optional, tag = "1")]
380    pub command: ::core::option::Option<CommandBook>,
381    #[prost(enumeration = "SyncMode", tag = "2")]
382    pub sync_mode: i32,
383    /// How to handle saga/PM errors in CASCADE mode
384    #[prost(enumeration = "CascadeErrorMode", tag = "3")]
385    pub cascade_error_mode: i32,
386}
387impl ::prost::Name for CommandRequest {
388    const NAME: &'static str = "CommandRequest";
389    const PACKAGE: &'static str = "angzarr";
390    fn full_name() -> ::prost::alloc::string::String {
391        "angzarr.CommandRequest".into()
392    }
393    fn type_url() -> ::prost::alloc::string::String {
394        "/angzarr.CommandRequest".into()
395    }
396}
397#[derive(Clone, PartialEq, ::prost::Message)]
398pub struct ContextualCommand {
399    /// Passed from aggregate coordinator to aggregate, consists of everything needed to execute/evaluate the command
400    #[prost(message, optional, tag = "1")]
401    pub events: ::core::option::Option<EventBook>,
402    #[prost(message, optional, tag = "2")]
403    pub command: ::core::option::Option<CommandBook>,
404}
405impl ::prost::Name for ContextualCommand {
406    const NAME: &'static str = "ContextualCommand";
407    const PACKAGE: &'static str = "angzarr";
408    fn full_name() -> ::prost::alloc::string::String {
409        "angzarr.ContextualCommand".into()
410    }
411    fn type_url() -> ::prost::alloc::string::String {
412        "/angzarr.ContextualCommand".into()
413    }
414}
415/// Request wrapper for contextual command operations (internal use).
416/// Adds execution metadata (sync_mode) to ContextualCommand.
417#[derive(Clone, PartialEq, ::prost::Message)]
418pub struct ContextualCommandRequest {
419    #[prost(message, optional, tag = "1")]
420    pub command: ::core::option::Option<ContextualCommand>,
421    #[prost(enumeration = "SyncMode", tag = "2")]
422    pub sync_mode: i32,
423}
424impl ::prost::Name for ContextualCommandRequest {
425    const NAME: &'static str = "ContextualCommandRequest";
426    const PACKAGE: &'static str = "angzarr";
427    fn full_name() -> ::prost::alloc::string::String {
428        "angzarr.ContextualCommandRequest".into()
429    }
430    fn type_url() -> ::prost::alloc::string::String {
431        "/angzarr.ContextualCommandRequest".into()
432    }
433}
434/// Query types
435#[derive(Clone, Copy, PartialEq, ::prost::Message)]
436pub struct SequenceRange {
437    #[prost(uint32, tag = "1")]
438    pub lower: u32,
439    /// If not set, query to latest
440    #[prost(uint32, optional, tag = "2")]
441    pub upper: ::core::option::Option<u32>,
442}
443impl ::prost::Name for SequenceRange {
444    const NAME: &'static str = "SequenceRange";
445    const PACKAGE: &'static str = "angzarr";
446    fn full_name() -> ::prost::alloc::string::String {
447        "angzarr.SequenceRange".into()
448    }
449    fn type_url() -> ::prost::alloc::string::String {
450        "/angzarr.SequenceRange".into()
451    }
452}
453#[derive(Clone, PartialEq, ::prost::Message)]
454pub struct SequenceSet {
455    #[prost(uint32, repeated, tag = "1")]
456    pub values: ::prost::alloc::vec::Vec<u32>,
457}
458impl ::prost::Name for SequenceSet {
459    const NAME: &'static str = "SequenceSet";
460    const PACKAGE: &'static str = "angzarr";
461    fn full_name() -> ::prost::alloc::string::String {
462        "angzarr.SequenceSet".into()
463    }
464    fn type_url() -> ::prost::alloc::string::String {
465        "/angzarr.SequenceSet".into()
466    }
467}
468/// Temporal query: retrieve aggregate state at a point in history.
469/// Replays events from sequence 0 (no snapshots) to the specified point.
470#[derive(Clone, Copy, PartialEq, ::prost::Message)]
471pub struct TemporalQuery {
472    #[prost(oneof = "temporal_query::PointInTime", tags = "1, 2")]
473    pub point_in_time: ::core::option::Option<temporal_query::PointInTime>,
474}
475/// Nested message and enum types in `TemporalQuery`.
476pub mod temporal_query {
477    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
478    pub enum PointInTime {
479        /// Events with created_at <= this
480        #[prost(message, tag = "1")]
481        AsOfTime(::prost_types::Timestamp),
482        /// Events with sequence <= this
483        #[prost(uint32, tag = "2")]
484        AsOfSequence(u32),
485    }
486}
487impl ::prost::Name for TemporalQuery {
488    const NAME: &'static str = "TemporalQuery";
489    const PACKAGE: &'static str = "angzarr";
490    fn full_name() -> ::prost::alloc::string::String {
491        "angzarr.TemporalQuery".into()
492    }
493    fn type_url() -> ::prost::alloc::string::String {
494        "/angzarr.TemporalQuery".into()
495    }
496}
497#[derive(Clone, PartialEq, ::prost::Message)]
498pub struct Query {
499    /// Cover identifies the aggregate: domain + (root | correlation_id | both)
500    /// Query by root: Cover { domain, root }
501    /// Query by correlation: Cover { domain, correlation_id }
502    #[prost(message, optional, tag = "1")]
503    pub cover: ::core::option::Option<Cover>,
504    /// Field 2 removed: now use cover.root
505    #[prost(oneof = "query::Selection", tags = "3, 4, 5")]
506    pub selection: ::core::option::Option<query::Selection>,
507}
508/// Nested message and enum types in `Query`.
509pub mod query {
510    /// Field 2 removed: now use cover.root
511    #[derive(Clone, PartialEq, ::prost::Oneof)]
512    pub enum Selection {
513        #[prost(message, tag = "3")]
514        Range(super::SequenceRange),
515        #[prost(message, tag = "4")]
516        Sequences(super::SequenceSet),
517        #[prost(message, tag = "5")]
518        Temporal(super::TemporalQuery),
519    }
520}
521impl ::prost::Name for Query {
522    const NAME: &'static str = "Query";
523    const PACKAGE: &'static str = "angzarr";
524    fn full_name() -> ::prost::alloc::string::String {
525        "angzarr.Query".into()
526    }
527    fn type_url() -> ::prost::alloc::string::String {
528        "/angzarr.Query".into()
529    }
530}
531#[derive(Clone, PartialEq, ::prost::Message)]
532pub struct AggregateRoot {
533    #[prost(string, tag = "1")]
534    pub domain: ::prost::alloc::string::String,
535    #[prost(message, optional, tag = "2")]
536    pub root: ::core::option::Option<Uuid>,
537}
538impl ::prost::Name for AggregateRoot {
539    const NAME: &'static str = "AggregateRoot";
540    const PACKAGE: &'static str = "angzarr";
541    fn full_name() -> ::prost::alloc::string::String {
542        "angzarr.AggregateRoot".into()
543    }
544    fn type_url() -> ::prost::alloc::string::String {
545        "/angzarr.AggregateRoot".into()
546    }
547}
548/// docs:start:event_stream_filter
549/// Subscription filter for event streaming
550#[derive(Clone, PartialEq, ::prost::Message)]
551pub struct EventStreamFilter {
552    #[prost(string, tag = "1")]
553    pub correlation_id: ::prost::alloc::string::String,
554}
555impl ::prost::Name for EventStreamFilter {
556    const NAME: &'static str = "EventStreamFilter";
557    const PACKAGE: &'static str = "angzarr";
558    fn full_name() -> ::prost::alloc::string::String {
559        "angzarr.EventStreamFilter".into()
560    }
561    fn type_url() -> ::prost::alloc::string::String {
562        "/angzarr.EventStreamFilter".into()
563    }
564}
565/// docs:start:notification
566/// Base notification message for transient system signals.
567/// Contains routing info via Cover but no persistence semantics.
568/// Type discrimination via payload.type_url (standard Any behavior).
569#[derive(Clone, PartialEq, ::prost::Message)]
570pub struct Notification {
571    /// Routing: domain, root, correlation_id
572    #[prost(message, optional, tag = "1")]
573    pub cover: ::core::option::Option<Cover>,
574    /// Type-specific content (RejectionNotification, etc.)
575    #[prost(message, optional, tag = "2")]
576    pub payload: ::core::option::Option<::prost_types::Any>,
577    /// When notification was created
578    #[prost(message, optional, tag = "3")]
579    pub sent_at: ::core::option::Option<::prost_types::Timestamp>,
580    /// Optional key-value metadata
581    #[prost(map = "string, string", tag = "4")]
582    pub metadata:
583        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
584}
585impl ::prost::Name for Notification {
586    const NAME: &'static str = "Notification";
587    const PACKAGE: &'static str = "angzarr";
588    fn full_name() -> ::prost::alloc::string::String {
589        "angzarr.Notification".into()
590    }
591    fn type_url() -> ::prost::alloc::string::String {
592        "/angzarr.Notification".into()
593    }
594}
595/// docs:start:rejection_notification
596/// Notification payload for command rejection scenarios.
597/// Embedded in Notification.payload when a saga/PM command is rejected.
598///
599/// Source info for compensation is in rejected_command.pages\[\].header.angzarr_deferred:
600/// - source.domain, source.root, source.edition → where to route rejection
601/// - source_seq → which event triggered the command
602#[derive(Clone, PartialEq, ::prost::Message)]
603pub struct RejectionNotification {
604    /// The command that was rejected (full context)
605    #[prost(message, optional, tag = "1")]
606    pub rejected_command: ::core::option::Option<CommandBook>,
607    /// Why: "insufficient_funds", "out_of_stock", etc.
608    #[prost(string, tag = "2")]
609    pub rejection_reason: ::prost::alloc::string::String,
610}
611impl ::prost::Name for RejectionNotification {
612    const NAME: &'static str = "RejectionNotification";
613    const PACKAGE: &'static str = "angzarr";
614    fn full_name() -> ::prost::alloc::string::String {
615        "angzarr.RejectionNotification".into()
616    }
617    fn type_url() -> ::prost::alloc::string::String {
618        "/angzarr.RejectionNotification".into()
619    }
620}
621/// docs:start:dlq_details
622/// Sequence mismatch details for DLQ entries.
623/// Contains expected vs actual sequence for debugging and replay.
624#[derive(Clone, Copy, PartialEq, ::prost::Message)]
625pub struct SequenceMismatchDetails {
626    /// What the command expected
627    #[prost(uint32, tag = "1")]
628    pub expected_sequence: u32,
629    /// What the aggregate was at
630    #[prost(uint32, tag = "2")]
631    pub actual_sequence: u32,
632    /// Strategy that triggered DLQ routing
633    #[prost(enumeration = "MergeStrategy", tag = "3")]
634    pub merge_strategy: i32,
635}
636impl ::prost::Name for SequenceMismatchDetails {
637    const NAME: &'static str = "SequenceMismatchDetails";
638    const PACKAGE: &'static str = "angzarr";
639    fn full_name() -> ::prost::alloc::string::String {
640        "angzarr.SequenceMismatchDetails".into()
641    }
642    fn type_url() -> ::prost::alloc::string::String {
643        "/angzarr.SequenceMismatchDetails".into()
644    }
645}
646/// Event processing failure details for DLQ entries.
647/// Contains information about why a saga/projector failed to process events.
648#[derive(Clone, PartialEq, ::prost::Message)]
649pub struct EventProcessingFailedDetails {
650    /// Error message from the handler
651    #[prost(string, tag = "1")]
652    pub error: ::prost::alloc::string::String,
653    /// Number of retry attempts before DLQ routing
654    #[prost(uint32, tag = "2")]
655    pub retry_count: u32,
656    /// Whether the failure is considered transient
657    #[prost(bool, tag = "3")]
658    pub is_transient: bool,
659}
660impl ::prost::Name for EventProcessingFailedDetails {
661    const NAME: &'static str = "EventProcessingFailedDetails";
662    const PACKAGE: &'static str = "angzarr";
663    fn full_name() -> ::prost::alloc::string::String {
664        "angzarr.EventProcessingFailedDetails".into()
665    }
666    fn type_url() -> ::prost::alloc::string::String {
667        "/angzarr.EventProcessingFailedDetails".into()
668    }
669}
670/// Payload retrieval failure details for DLQ entries.
671/// Contains information about why an externally stored payload couldn't be retrieved.
672#[derive(Clone, PartialEq, ::prost::Message)]
673pub struct PayloadRetrievalFailedDetails {
674    /// Storage backend type
675    #[prost(enumeration = "PayloadStorageType", tag = "1")]
676    pub storage_type: i32,
677    /// URI of the payload that couldn't be retrieved
678    #[prost(string, tag = "2")]
679    pub uri: ::prost::alloc::string::String,
680    /// Content hash for identification
681    #[prost(bytes = "vec", tag = "3")]
682    pub content_hash: ::prost::alloc::vec::Vec<u8>,
683    /// Original payload size in bytes
684    #[prost(uint64, tag = "4")]
685    pub original_size: u64,
686    /// Error message from the retrieval attempt
687    #[prost(string, tag = "5")]
688    pub error: ::prost::alloc::string::String,
689}
690impl ::prost::Name for PayloadRetrievalFailedDetails {
691    const NAME: &'static str = "PayloadRetrievalFailedDetails";
692    const PACKAGE: &'static str = "angzarr";
693    fn full_name() -> ::prost::alloc::string::String {
694        "angzarr.PayloadRetrievalFailedDetails".into()
695    }
696    fn type_url() -> ::prost::alloc::string::String {
697        "/angzarr.PayloadRetrievalFailedDetails".into()
698    }
699}
700/// docs:start:dead_letter
701/// Dead letter queue entry for failed messages requiring manual intervention.
702/// Per-domain topics: angzarr.dlq.{domain}
703#[derive(Clone, PartialEq, ::prost::Message)]
704pub struct AngzarrDeadLetter {
705    /// Routing: domain, root, correlation_id
706    #[prost(message, optional, tag = "1")]
707    pub cover: ::core::option::Option<Cover>,
708    /// Human-readable reason
709    #[prost(string, tag = "3")]
710    pub rejection_reason: ::prost::alloc::string::String,
711    #[prost(message, optional, tag = "7")]
712    pub occurred_at: ::core::option::Option<::prost_types::Timestamp>,
713    /// Additional context
714    #[prost(map = "string, string", tag = "8")]
715    pub metadata:
716        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
717    /// Which component sent to DLQ
718    #[prost(string, tag = "10")]
719    pub source_component: ::prost::alloc::string::String,
720    /// "aggregate" | "saga" | "projector" | "process_manager"
721    #[prost(string, tag = "11")]
722    pub source_component_type: ::prost::alloc::string::String,
723    #[prost(oneof = "angzarr_dead_letter::Payload", tags = "2, 9")]
724    pub payload: ::core::option::Option<angzarr_dead_letter::Payload>,
725    #[prost(oneof = "angzarr_dead_letter::RejectionDetails", tags = "12, 13, 14")]
726    pub rejection_details: ::core::option::Option<angzarr_dead_letter::RejectionDetails>,
727}
728/// Nested message and enum types in `AngzarrDeadLetter`.
729pub mod angzarr_dead_letter {
730    #[derive(Clone, PartialEq, ::prost::Oneof)]
731    pub enum Payload {
732        /// Command that failed
733        #[prost(message, tag = "2")]
734        RejectedCommand(super::CommandBook),
735        /// Events that failed (saga/projector failures)
736        #[prost(message, tag = "9")]
737        RejectedEvents(super::EventBook),
738    }
739    #[derive(Clone, PartialEq, ::prost::Oneof)]
740    pub enum RejectionDetails {
741        /// Sequence conflict details
742        #[prost(message, tag = "12")]
743        SequenceMismatch(super::SequenceMismatchDetails),
744        /// Handler failure details
745        #[prost(message, tag = "13")]
746        EventProcessingFailed(super::EventProcessingFailedDetails),
747        /// Payload store failure details
748        #[prost(message, tag = "14")]
749        PayloadRetrievalFailed(super::PayloadRetrievalFailedDetails),
750    }
751}
752impl ::prost::Name for AngzarrDeadLetter {
753    const NAME: &'static str = "AngzarrDeadLetter";
754    const PACKAGE: &'static str = "angzarr";
755    fn full_name() -> ::prost::alloc::string::String {
756        "angzarr.AngzarrDeadLetter".into()
757    }
758    fn type_url() -> ::prost::alloc::string::String {
759        "/angzarr.AngzarrDeadLetter".into()
760    }
761}
762/// Describes what a component subscribes to.
763/// Topology edges derived from inputs: if A subscribes to domain X, edge X→A exists.
764#[derive(Clone, PartialEq, ::prost::Message)]
765pub struct Target {
766    #[prost(string, tag = "1")]
767    pub domain: ::prost::alloc::string::String,
768}
769impl ::prost::Name for Target {
770    const NAME: &'static str = "Target";
771    const PACKAGE: &'static str = "angzarr";
772    fn full_name() -> ::prost::alloc::string::String {
773        "angzarr.Target".into()
774    }
775    fn type_url() -> ::prost::alloc::string::String {
776        "/angzarr.Target".into()
777    }
778}
779/// Component self-description.
780#[derive(Clone, PartialEq, ::prost::Message)]
781pub struct ComponentDescriptor {
782    #[prost(string, tag = "1")]
783    pub name: ::prost::alloc::string::String,
784    #[prost(string, tag = "2")]
785    pub component_type: ::prost::alloc::string::String,
786    /// Domains I subscribe to (event types I consume)
787    #[prost(message, repeated, tag = "3")]
788    pub inputs: ::prost::alloc::vec::Vec<Target>,
789}
790impl ::prost::Name for ComponentDescriptor {
791    const NAME: &'static str = "ComponentDescriptor";
792    const PACKAGE: &'static str = "angzarr";
793    fn full_name() -> ::prost::alloc::string::String {
794        "angzarr.ComponentDescriptor".into()
795    }
796    fn type_url() -> ::prost::alloc::string::String {
797        "/angzarr.ComponentDescriptor".into()
798    }
799}
800/// Request for GetDescriptor RPC.
801#[derive(Clone, Copy, PartialEq, ::prost::Message)]
802pub struct GetDescriptorRequest {}
803impl ::prost::Name for GetDescriptorRequest {
804    const NAME: &'static str = "GetDescriptorRequest";
805    const PACKAGE: &'static str = "angzarr";
806    fn full_name() -> ::prost::alloc::string::String {
807        "angzarr.GetDescriptorRequest".into()
808    }
809    fn type_url() -> ::prost::alloc::string::String {
810        "/angzarr.GetDescriptorRequest".into()
811    }
812}
813/// docs:start:sync_mode
814/// Controls synchronous processing behavior
815#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
816#[repr(i32)]
817pub enum SyncMode {
818    /// Async: fire and forget (default)
819    Async = 0,
820    /// Sync projectors only, no saga cascade
821    Simple = 1,
822    /// Full sync: projectors + saga cascade (expensive)
823    Cascade = 2,
824}
825impl SyncMode {
826    /// String value of the enum field names used in the ProtoBuf definition.
827    ///
828    /// The values are not transformed in any way and thus are considered stable
829    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
830    pub fn as_str_name(&self) -> &'static str {
831        match self {
832            Self::Async => "SYNC_MODE_ASYNC",
833            Self::Simple => "SYNC_MODE_SIMPLE",
834            Self::Cascade => "SYNC_MODE_CASCADE",
835        }
836    }
837    /// Creates an enum from field names used in the ProtoBuf definition.
838    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
839        match value {
840            "SYNC_MODE_ASYNC" => Some(Self::Async),
841            "SYNC_MODE_SIMPLE" => Some(Self::Simple),
842            "SYNC_MODE_CASCADE" => Some(Self::Cascade),
843            _ => None,
844        }
845    }
846}
847/// docs:start:cascade_error_mode
848/// Controls how CASCADE mode handles errors from sagas/PMs.
849/// Only relevant when sync_mode = CASCADE.
850#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
851#[repr(i32)]
852pub enum CascadeErrorMode {
853    /// Stop on first error, fail request (default)
854    CascadeErrorFailFast = 0,
855    /// Continue through all, return successes + errors
856    CascadeErrorContinue = 1,
857    /// On first error, compensate executed commands, fail request
858    CascadeErrorCompensate = 2,
859    /// On error, send to DLQ and continue with remaining
860    CascadeErrorDeadLetter = 3,
861}
862impl CascadeErrorMode {
863    /// String value of the enum field names used in the ProtoBuf definition.
864    ///
865    /// The values are not transformed in any way and thus are considered stable
866    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
867    pub fn as_str_name(&self) -> &'static str {
868        match self {
869            Self::CascadeErrorFailFast => "CASCADE_ERROR_FAIL_FAST",
870            Self::CascadeErrorContinue => "CASCADE_ERROR_CONTINUE",
871            Self::CascadeErrorCompensate => "CASCADE_ERROR_COMPENSATE",
872            Self::CascadeErrorDeadLetter => "CASCADE_ERROR_DEAD_LETTER",
873        }
874    }
875    /// Creates an enum from field names used in the ProtoBuf definition.
876    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
877        match value {
878            "CASCADE_ERROR_FAIL_FAST" => Some(Self::CascadeErrorFailFast),
879            "CASCADE_ERROR_CONTINUE" => Some(Self::CascadeErrorContinue),
880            "CASCADE_ERROR_COMPENSATE" => Some(Self::CascadeErrorCompensate),
881            "CASCADE_ERROR_DEAD_LETTER" => Some(Self::CascadeErrorDeadLetter),
882            _ => None,
883        }
884    }
885}
886/// docs:start:merge_strategy
887/// Controls how concurrent commands to the same aggregate are handled
888#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
889#[repr(i32)]
890pub enum MergeStrategy {
891    /// Default: allow if state field mutations don't overlap
892    MergeCommutative = 0,
893    /// Reject if sequence mismatch (optimistic concurrency)
894    MergeStrict = 1,
895    /// Aggregate handles its own concurrency
896    MergeAggregateHandles = 2,
897    /// Send to DLQ for manual review on mismatch
898    MergeManual = 3,
899}
900impl MergeStrategy {
901    /// String value of the enum field names used in the ProtoBuf definition.
902    ///
903    /// The values are not transformed in any way and thus are considered stable
904    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
905    pub fn as_str_name(&self) -> &'static str {
906        match self {
907            Self::MergeCommutative => "MERGE_COMMUTATIVE",
908            Self::MergeStrict => "MERGE_STRICT",
909            Self::MergeAggregateHandles => "MERGE_AGGREGATE_HANDLES",
910            Self::MergeManual => "MERGE_MANUAL",
911        }
912    }
913    /// Creates an enum from field names used in the ProtoBuf definition.
914    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
915        match value {
916            "MERGE_COMMUTATIVE" => Some(Self::MergeCommutative),
917            "MERGE_STRICT" => Some(Self::MergeStrict),
918            "MERGE_AGGREGATE_HANDLES" => Some(Self::MergeAggregateHandles),
919            "MERGE_MANUAL" => Some(Self::MergeManual),
920            _ => None,
921        }
922    }
923}
924/// docs:start:snapshot_retention
925/// Controls snapshot retention during cleanup
926#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
927#[repr(i32)]
928pub enum SnapshotRetention {
929    /// Persist every 16 events, treated as TRANSIENT otherwise
930    RetentionDefault = 0,
931    /// Keep indefinitely (business milestone)
932    RetentionPersist = 1,
933    /// Delete when newer snapshot written
934    RetentionTransient = 2,
935}
936impl SnapshotRetention {
937    /// String value of the enum field names used in the ProtoBuf definition.
938    ///
939    /// The values are not transformed in any way and thus are considered stable
940    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
941    pub fn as_str_name(&self) -> &'static str {
942        match self {
943            Self::RetentionDefault => "RETENTION_DEFAULT",
944            Self::RetentionPersist => "RETENTION_PERSIST",
945            Self::RetentionTransient => "RETENTION_TRANSIENT",
946        }
947    }
948    /// Creates an enum from field names used in the ProtoBuf definition.
949    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
950        match value {
951            "RETENTION_DEFAULT" => Some(Self::RetentionDefault),
952            "RETENTION_PERSIST" => Some(Self::RetentionPersist),
953            "RETENTION_TRANSIENT" => Some(Self::RetentionTransient),
954            _ => None,
955        }
956    }
957}
958/// docs:start:payload_reference
959/// Storage backend type for externally stored payloads (claim check pattern).
960#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
961#[repr(i32)]
962pub enum PayloadStorageType {
963    Unspecified = 0,
964    Filesystem = 1,
965    Gcs = 2,
966    S3 = 3,
967}
968impl PayloadStorageType {
969    /// String value of the enum field names used in the ProtoBuf definition.
970    ///
971    /// The values are not transformed in any way and thus are considered stable
972    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
973    pub fn as_str_name(&self) -> &'static str {
974        match self {
975            Self::Unspecified => "PAYLOAD_STORAGE_TYPE_UNSPECIFIED",
976            Self::Filesystem => "PAYLOAD_STORAGE_TYPE_FILESYSTEM",
977            Self::Gcs => "PAYLOAD_STORAGE_TYPE_GCS",
978            Self::S3 => "PAYLOAD_STORAGE_TYPE_S3",
979        }
980    }
981    /// Creates an enum from field names used in the ProtoBuf definition.
982    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
983        match value {
984            "PAYLOAD_STORAGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
985            "PAYLOAD_STORAGE_TYPE_FILESYSTEM" => Some(Self::Filesystem),
986            "PAYLOAD_STORAGE_TYPE_GCS" => Some(Self::Gcs),
987            "PAYLOAD_STORAGE_TYPE_S3" => Some(Self::S3),
988            _ => None,
989        }
990    }
991}
992/// Request to replay events and compute resulting state
993#[derive(Clone, PartialEq, ::prost::Message)]
994pub struct ReplayRequest {
995    /// Starting state (empty = initial state)
996    #[prost(message, optional, tag = "1")]
997    pub base_snapshot: ::core::option::Option<Snapshot>,
998    /// Events to apply in order
999    #[prost(message, repeated, tag = "2")]
1000    pub events: ::prost::alloc::vec::Vec<EventPage>,
1001}
1002impl ::prost::Name for ReplayRequest {
1003    const NAME: &'static str = "ReplayRequest";
1004    const PACKAGE: &'static str = "angzarr";
1005    fn full_name() -> ::prost::alloc::string::String {
1006        "angzarr.ReplayRequest".into()
1007    }
1008    fn type_url() -> ::prost::alloc::string::String {
1009        "/angzarr.ReplayRequest".into()
1010    }
1011}
1012/// Response with computed state after replay
1013#[derive(Clone, PartialEq, ::prost::Message)]
1014pub struct ReplayResponse {
1015    /// Resulting state
1016    #[prost(message, optional, tag = "1")]
1017    pub state: ::core::option::Option<::prost_types::Any>,
1018}
1019impl ::prost::Name for ReplayResponse {
1020    const NAME: &'static str = "ReplayResponse";
1021    const PACKAGE: &'static str = "angzarr";
1022    fn full_name() -> ::prost::alloc::string::String {
1023        "angzarr.ReplayResponse".into()
1024    }
1025    fn type_url() -> ::prost::alloc::string::String {
1026        "/angzarr.ReplayResponse".into()
1027    }
1028}
1029/// Response from entity - aggregate events + sync projector results
1030#[derive(Clone, PartialEq, ::prost::Message)]
1031pub struct CommandResponse {
1032    /// Events from the target aggregate
1033    #[prost(message, optional, tag = "1")]
1034    pub events: ::core::option::Option<EventBook>,
1035    /// Synchronous projector results
1036    #[prost(message, repeated, tag = "2")]
1037    pub projections: ::prost::alloc::vec::Vec<Projection>,
1038    /// CASCADE mode error reporting (populated when cascade_error_mode != FAIL_FAST)
1039    #[prost(message, repeated, tag = "3")]
1040    pub cascade_errors: ::prost::alloc::vec::Vec<CascadeError>,
1041}
1042impl ::prost::Name for CommandResponse {
1043    const NAME: &'static str = "CommandResponse";
1044    const PACKAGE: &'static str = "angzarr";
1045    fn full_name() -> ::prost::alloc::string::String {
1046        "angzarr.CommandResponse".into()
1047    }
1048    fn type_url() -> ::prost::alloc::string::String {
1049        "/angzarr.CommandResponse".into()
1050    }
1051}
1052/// Error from saga/PM during CASCADE execution.
1053/// Populated in CommandResponse when cascade_error_mode allows continuation after errors.
1054#[derive(Clone, PartialEq, ::prost::Message)]
1055pub struct CascadeError {
1056    /// e.g., "saga-order-fulfillment"
1057    #[prost(string, tag = "1")]
1058    pub component_name: ::prost::alloc::string::String,
1059    /// "saga" or "process_manager"
1060    #[prost(string, tag = "2")]
1061    pub component_type: ::prost::alloc::string::String,
1062    #[prost(string, tag = "3")]
1063    pub error_message: ::prost::alloc::string::String,
1064    /// Which domain's events triggered this
1065    #[prost(string, tag = "4")]
1066    pub source_domain: ::prost::alloc::string::String,
1067}
1068impl ::prost::Name for CascadeError {
1069    const NAME: &'static str = "CascadeError";
1070    const PACKAGE: &'static str = "angzarr";
1071    fn full_name() -> ::prost::alloc::string::String {
1072        "angzarr.CascadeError".into()
1073    }
1074    fn type_url() -> ::prost::alloc::string::String {
1075        "/angzarr.CascadeError".into()
1076    }
1077}
1078/// client logic requests framework to handle revocation
1079#[derive(Clone, PartialEq, ::prost::Message)]
1080pub struct RevocationResponse {
1081    /// Emit SagaCompensationFailed event
1082    #[prost(bool, tag = "1")]
1083    pub emit_system_revocation: bool,
1084    /// Send to DLQ
1085    #[prost(bool, tag = "2")]
1086    pub send_to_dead_letter_queue: bool,
1087    /// Flag for alerting/human intervention
1088    #[prost(bool, tag = "3")]
1089    pub escalate: bool,
1090    /// Stop saga chain, propagate error to caller
1091    #[prost(bool, tag = "4")]
1092    pub abort: bool,
1093    /// Context/reason
1094    #[prost(string, tag = "5")]
1095    pub reason: ::prost::alloc::string::String,
1096}
1097impl ::prost::Name for RevocationResponse {
1098    const NAME: &'static str = "RevocationResponse";
1099    const PACKAGE: &'static str = "angzarr";
1100    fn full_name() -> ::prost::alloc::string::String {
1101        "angzarr.RevocationResponse".into()
1102    }
1103    fn type_url() -> ::prost::alloc::string::String {
1104        "/angzarr.RevocationResponse".into()
1105    }
1106}
1107/// Wrapper response for BusinessLogic.Handle
1108#[derive(Clone, PartialEq, ::prost::Message)]
1109pub struct BusinessResponse {
1110    #[prost(oneof = "business_response::Result", tags = "1, 2, 3")]
1111    pub result: ::core::option::Option<business_response::Result>,
1112}
1113/// Nested message and enum types in `BusinessResponse`.
1114pub mod business_response {
1115    #[allow(clippy::large_enum_variant)]
1116    #[derive(Clone, PartialEq, ::prost::Oneof)]
1117    pub enum Result {
1118        /// Business provides compensation events
1119        #[prost(message, tag = "1")]
1120        Events(super::EventBook),
1121        /// Business requests framework action
1122        #[prost(message, tag = "2")]
1123        Revocation(super::RevocationResponse),
1124        /// Forward rejection notification upstream
1125        #[prost(message, tag = "3")]
1126        Notification(super::Notification),
1127    }
1128}
1129impl ::prost::Name for BusinessResponse {
1130    const NAME: &'static str = "BusinessResponse";
1131    const PACKAGE: &'static str = "angzarr";
1132    fn full_name() -> ::prost::alloc::string::String {
1133        "angzarr.BusinessResponse".into()
1134    }
1135    fn type_url() -> ::prost::alloc::string::String {
1136        "/angzarr.BusinessResponse".into()
1137    }
1138}
1139/// Request for speculative command execution against temporal state.
1140#[derive(Clone, PartialEq, ::prost::Message)]
1141pub struct SpeculateCommandHandlerRequest {
1142    #[prost(message, optional, tag = "1")]
1143    pub command: ::core::option::Option<CommandBook>,
1144    #[prost(message, optional, tag = "2")]
1145    pub point_in_time: ::core::option::Option<TemporalQuery>,
1146}
1147impl ::prost::Name for SpeculateCommandHandlerRequest {
1148    const NAME: &'static str = "SpeculateCommandHandlerRequest";
1149    const PACKAGE: &'static str = "angzarr";
1150    fn full_name() -> ::prost::alloc::string::String {
1151        "angzarr.SpeculateCommandHandlerRequest".into()
1152    }
1153    fn type_url() -> ::prost::alloc::string::String {
1154        "/angzarr.SpeculateCommandHandlerRequest".into()
1155    }
1156}
1157/// docs:start:fact_injection
1158/// Response from fact injection.
1159/// Indicates whether facts were newly persisted or already existed (idempotent).
1160///
1161/// Request uses EventRequest with:
1162/// - events: EventBook containing fact events (with ExternalDeferredSequence markers in PageHeader)
1163/// - sync_mode: Controls sync processing (default: async)
1164/// - route_to_handler: Whether to invoke command handler's handle_fact (default: true)
1165///
1166/// IMPORTANT: Set PageHeader.external_deferred.external_id for idempotency. The coordinator
1167/// uses this to deduplicate fact injections - subsequent requests with the same external_id
1168/// return the original events without re-persisting.
1169#[derive(Clone, PartialEq, ::prost::Message)]
1170pub struct FactInjectionResponse {
1171    /// Persisted events with real sequence numbers
1172    #[prost(message, optional, tag = "1")]
1173    pub events: ::core::option::Option<EventBook>,
1174    /// True if external_id was already seen (idempotent response)
1175    #[prost(bool, tag = "2")]
1176    pub already_processed: bool,
1177    /// Synchronous projector results (if any)
1178    #[prost(message, repeated, tag = "3")]
1179    pub projections: ::prost::alloc::vec::Vec<Projection>,
1180}
1181impl ::prost::Name for FactInjectionResponse {
1182    const NAME: &'static str = "FactInjectionResponse";
1183    const PACKAGE: &'static str = "angzarr";
1184    fn full_name() -> ::prost::alloc::string::String {
1185        "angzarr.FactInjectionResponse".into()
1186    }
1187    fn type_url() -> ::prost::alloc::string::String {
1188        "/angzarr.FactInjectionResponse".into()
1189    }
1190}
1191/// Generated client implementations.
1192pub mod command_handler_service_client {
1193    #![allow(
1194        unused_variables,
1195        dead_code,
1196        missing_docs,
1197        clippy::wildcard_imports,
1198        clippy::let_unit_value
1199    )]
1200    use tonic::codegen::http::Uri;
1201    use tonic::codegen::*;
1202    /// CommandHandlerService: client logic that processes commands and emits events
1203    /// Business logic layer that implements command handling for a domain aggregate
1204    /// client logic doesn't care about sync - coordinator decides
1205    #[derive(Debug, Clone)]
1206    pub struct CommandHandlerServiceClient<T> {
1207        inner: tonic::client::Grpc<T>,
1208    }
1209    impl CommandHandlerServiceClient<tonic::transport::Channel> {
1210        /// Attempt to create a new client by connecting to a given endpoint.
1211        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1212        where
1213            D: TryInto<tonic::transport::Endpoint>,
1214            D::Error: Into<StdError>,
1215        {
1216            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1217            Ok(Self::new(conn))
1218        }
1219    }
1220    impl<T> CommandHandlerServiceClient<T>
1221    where
1222        T: tonic::client::GrpcService<tonic::body::BoxBody>,
1223        T::Error: Into<StdError>,
1224        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1225        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1226    {
1227        pub fn new(inner: T) -> Self {
1228            let inner = tonic::client::Grpc::new(inner);
1229            Self { inner }
1230        }
1231        pub fn with_origin(inner: T, origin: Uri) -> Self {
1232            let inner = tonic::client::Grpc::with_origin(inner, origin);
1233            Self { inner }
1234        }
1235        pub fn with_interceptor<F>(
1236            inner: T,
1237            interceptor: F,
1238        ) -> CommandHandlerServiceClient<InterceptedService<T, F>>
1239        where
1240            F: tonic::service::Interceptor,
1241            T::ResponseBody: Default,
1242            T: tonic::codegen::Service<
1243                http::Request<tonic::body::BoxBody>,
1244                Response = http::Response<
1245                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
1246                >,
1247            >,
1248            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
1249                Into<StdError> + std::marker::Send + std::marker::Sync,
1250        {
1251            CommandHandlerServiceClient::new(InterceptedService::new(inner, interceptor))
1252        }
1253        /// Compress requests with the given encoding.
1254        ///
1255        /// This requires the server to support it otherwise it might respond with an
1256        /// error.
1257        #[must_use]
1258        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1259            self.inner = self.inner.send_compressed(encoding);
1260            self
1261        }
1262        /// Enable decompressing responses.
1263        #[must_use]
1264        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1265            self.inner = self.inner.accept_compressed(encoding);
1266            self
1267        }
1268        /// Limits the maximum size of a decoded message.
1269        ///
1270        /// Default: `4MB`
1271        #[must_use]
1272        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1273            self.inner = self.inner.max_decoding_message_size(limit);
1274            self
1275        }
1276        /// Limits the maximum size of an encoded message.
1277        ///
1278        /// Default: `usize::MAX`
1279        #[must_use]
1280        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1281            self.inner = self.inner.max_encoding_message_size(limit);
1282            self
1283        }
1284        /// Process command and return business response (events or revocation request)
1285        pub async fn handle(
1286            &mut self,
1287            request: impl tonic::IntoRequest<super::ContextualCommand>,
1288        ) -> std::result::Result<tonic::Response<super::BusinessResponse>, tonic::Status> {
1289            self.inner.ready().await.map_err(|e| {
1290                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1291            })?;
1292            let codec = tonic::codec::ProstCodec::default();
1293            let path =
1294                http::uri::PathAndQuery::from_static("/angzarr.CommandHandlerService/Handle");
1295            let mut req = request.into_request();
1296            req.extensions_mut()
1297                .insert(GrpcMethod::new("angzarr.CommandHandlerService", "Handle"));
1298            self.inner.unary(req, path, codec).await
1299        }
1300        /// Replay events to compute state (for conflict detection)
1301        /// Optional: only needed if aggregate supports MERGE_COMMUTATIVE
1302        pub async fn replay(
1303            &mut self,
1304            request: impl tonic::IntoRequest<super::ReplayRequest>,
1305        ) -> std::result::Result<tonic::Response<super::ReplayResponse>, tonic::Status> {
1306            self.inner.ready().await.map_err(|e| {
1307                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1308            })?;
1309            let codec = tonic::codec::ProstCodec::default();
1310            let path =
1311                http::uri::PathAndQuery::from_static("/angzarr.CommandHandlerService/Replay");
1312            let mut req = request.into_request();
1313            req.extensions_mut()
1314                .insert(GrpcMethod::new("angzarr.CommandHandlerService", "Replay"));
1315            self.inner.unary(req, path, codec).await
1316        }
1317    }
1318}
1319/// Generated client implementations.
1320pub mod command_handler_coordinator_service_client {
1321    #![allow(
1322        unused_variables,
1323        dead_code,
1324        missing_docs,
1325        clippy::wildcard_imports,
1326        clippy::let_unit_value
1327    )]
1328    use tonic::codegen::http::Uri;
1329    use tonic::codegen::*;
1330    /// CommandHandlerCoordinatorService: orchestrates command processing for domain aggregates
1331    #[derive(Debug, Clone)]
1332    pub struct CommandHandlerCoordinatorServiceClient<T> {
1333        inner: tonic::client::Grpc<T>,
1334    }
1335    impl CommandHandlerCoordinatorServiceClient<tonic::transport::Channel> {
1336        /// Attempt to create a new client by connecting to a given endpoint.
1337        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1338        where
1339            D: TryInto<tonic::transport::Endpoint>,
1340            D::Error: Into<StdError>,
1341        {
1342            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1343            Ok(Self::new(conn))
1344        }
1345    }
1346    impl<T> CommandHandlerCoordinatorServiceClient<T>
1347    where
1348        T: tonic::client::GrpcService<tonic::body::BoxBody>,
1349        T::Error: Into<StdError>,
1350        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1351        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1352    {
1353        pub fn new(inner: T) -> Self {
1354            let inner = tonic::client::Grpc::new(inner);
1355            Self { inner }
1356        }
1357        pub fn with_origin(inner: T, origin: Uri) -> Self {
1358            let inner = tonic::client::Grpc::with_origin(inner, origin);
1359            Self { inner }
1360        }
1361        pub fn with_interceptor<F>(
1362            inner: T,
1363            interceptor: F,
1364        ) -> CommandHandlerCoordinatorServiceClient<InterceptedService<T, F>>
1365        where
1366            F: tonic::service::Interceptor,
1367            T::ResponseBody: Default,
1368            T: tonic::codegen::Service<
1369                http::Request<tonic::body::BoxBody>,
1370                Response = http::Response<
1371                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
1372                >,
1373            >,
1374            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
1375                Into<StdError> + std::marker::Send + std::marker::Sync,
1376        {
1377            CommandHandlerCoordinatorServiceClient::new(InterceptedService::new(inner, interceptor))
1378        }
1379        /// Compress requests with the given encoding.
1380        ///
1381        /// This requires the server to support it otherwise it might respond with an
1382        /// error.
1383        #[must_use]
1384        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1385            self.inner = self.inner.send_compressed(encoding);
1386            self
1387        }
1388        /// Enable decompressing responses.
1389        #[must_use]
1390        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1391            self.inner = self.inner.accept_compressed(encoding);
1392            self
1393        }
1394        /// Limits the maximum size of a decoded message.
1395        ///
1396        /// Default: `4MB`
1397        #[must_use]
1398        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1399            self.inner = self.inner.max_decoding_message_size(limit);
1400            self
1401        }
1402        /// Limits the maximum size of an encoded message.
1403        ///
1404        /// Default: `usize::MAX`
1405        #[must_use]
1406        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1407            self.inner = self.inner.max_encoding_message_size(limit);
1408            self
1409        }
1410        /// Process command with optional sync mode (default: async fire-and-forget)
1411        pub async fn handle_command(
1412            &mut self,
1413            request: impl tonic::IntoRequest<super::CommandRequest>,
1414        ) -> std::result::Result<tonic::Response<super::CommandResponse>, tonic::Status> {
1415            self.inner.ready().await.map_err(|e| {
1416                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1417            })?;
1418            let codec = tonic::codec::ProstCodec::default();
1419            let path = http::uri::PathAndQuery::from_static(
1420                "/angzarr.CommandHandlerCoordinatorService/HandleCommand",
1421            );
1422            let mut req = request.into_request();
1423            req.extensions_mut().insert(GrpcMethod::new(
1424                "angzarr.CommandHandlerCoordinatorService",
1425                "HandleCommand",
1426            ));
1427            self.inner.unary(req, path, codec).await
1428        }
1429        /// Inject fact events - external realities that cannot be rejected.
1430        /// Idempotent: subsequent requests with same external_id return original events.
1431        /// Use EventRequest.route_to_handler to control command handler invocation.
1432        pub async fn handle_event(
1433            &mut self,
1434            request: impl tonic::IntoRequest<super::EventRequest>,
1435        ) -> std::result::Result<tonic::Response<super::FactInjectionResponse>, tonic::Status>
1436        {
1437            self.inner.ready().await.map_err(|e| {
1438                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1439            })?;
1440            let codec = tonic::codec::ProstCodec::default();
1441            let path = http::uri::PathAndQuery::from_static(
1442                "/angzarr.CommandHandlerCoordinatorService/HandleEvent",
1443            );
1444            let mut req = request.into_request();
1445            req.extensions_mut().insert(GrpcMethod::new(
1446                "angzarr.CommandHandlerCoordinatorService",
1447                "HandleEvent",
1448            ));
1449            self.inner.unary(req, path, codec).await
1450        }
1451        /// Speculative execution - execute against temporal state without persisting
1452        pub async fn handle_sync_speculative(
1453            &mut self,
1454            request: impl tonic::IntoRequest<super::SpeculateCommandHandlerRequest>,
1455        ) -> std::result::Result<tonic::Response<super::CommandResponse>, tonic::Status> {
1456            self.inner.ready().await.map_err(|e| {
1457                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1458            })?;
1459            let codec = tonic::codec::ProstCodec::default();
1460            let path = http::uri::PathAndQuery::from_static(
1461                "/angzarr.CommandHandlerCoordinatorService/HandleSyncSpeculative",
1462            );
1463            let mut req = request.into_request();
1464            req.extensions_mut().insert(GrpcMethod::new(
1465                "angzarr.CommandHandlerCoordinatorService",
1466                "HandleSyncSpeculative",
1467            ));
1468            self.inner.unary(req, path, codec).await
1469        }
1470        /// Compensation flow - returns BusinessResponse for saga compensation handling.
1471        /// If business returns events, persists them. Caller handles revocation flags.
1472        pub async fn handle_compensation(
1473            &mut self,
1474            request: impl tonic::IntoRequest<super::CommandRequest>,
1475        ) -> std::result::Result<tonic::Response<super::BusinessResponse>, tonic::Status> {
1476            self.inner.ready().await.map_err(|e| {
1477                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1478            })?;
1479            let codec = tonic::codec::ProstCodec::default();
1480            let path = http::uri::PathAndQuery::from_static(
1481                "/angzarr.CommandHandlerCoordinatorService/HandleCompensation",
1482            );
1483            let mut req = request.into_request();
1484            req.extensions_mut().insert(GrpcMethod::new(
1485                "angzarr.CommandHandlerCoordinatorService",
1486                "HandleCompensation",
1487            ));
1488            self.inner.unary(req, path, codec).await
1489        }
1490    }
1491}
1492/// Generated server implementations.
1493pub mod command_handler_service_server {
1494    #![allow(
1495        unused_variables,
1496        dead_code,
1497        missing_docs,
1498        clippy::wildcard_imports,
1499        clippy::let_unit_value
1500    )]
1501    use tonic::codegen::*;
1502    /// Generated trait containing gRPC methods that should be implemented for use with CommandHandlerServiceServer.
1503    #[async_trait]
1504    pub trait CommandHandlerService: std::marker::Send + std::marker::Sync + 'static {
1505        /// Process command and return business response (events or revocation request)
1506        async fn handle(
1507            &self,
1508            request: tonic::Request<super::ContextualCommand>,
1509        ) -> std::result::Result<tonic::Response<super::BusinessResponse>, tonic::Status>;
1510        /// Replay events to compute state (for conflict detection)
1511        /// Optional: only needed if aggregate supports MERGE_COMMUTATIVE
1512        async fn replay(
1513            &self,
1514            request: tonic::Request<super::ReplayRequest>,
1515        ) -> std::result::Result<tonic::Response<super::ReplayResponse>, tonic::Status>;
1516    }
1517    /// CommandHandlerService: client logic that processes commands and emits events
1518    /// Business logic layer that implements command handling for a domain aggregate
1519    /// client logic doesn't care about sync - coordinator decides
1520    #[derive(Debug)]
1521    pub struct CommandHandlerServiceServer<T> {
1522        inner: Arc<T>,
1523        accept_compression_encodings: EnabledCompressionEncodings,
1524        send_compression_encodings: EnabledCompressionEncodings,
1525        max_decoding_message_size: Option<usize>,
1526        max_encoding_message_size: Option<usize>,
1527    }
1528    impl<T> CommandHandlerServiceServer<T> {
1529        pub fn new(inner: T) -> Self {
1530            Self::from_arc(Arc::new(inner))
1531        }
1532        pub fn from_arc(inner: Arc<T>) -> Self {
1533            Self {
1534                inner,
1535                accept_compression_encodings: Default::default(),
1536                send_compression_encodings: Default::default(),
1537                max_decoding_message_size: None,
1538                max_encoding_message_size: None,
1539            }
1540        }
1541        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
1542        where
1543            F: tonic::service::Interceptor,
1544        {
1545            InterceptedService::new(Self::new(inner), interceptor)
1546        }
1547        /// Enable decompressing requests with the given encoding.
1548        #[must_use]
1549        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1550            self.accept_compression_encodings.enable(encoding);
1551            self
1552        }
1553        /// Compress responses with the given encoding, if the client supports it.
1554        #[must_use]
1555        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1556            self.send_compression_encodings.enable(encoding);
1557            self
1558        }
1559        /// Limits the maximum size of a decoded message.
1560        ///
1561        /// Default: `4MB`
1562        #[must_use]
1563        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1564            self.max_decoding_message_size = Some(limit);
1565            self
1566        }
1567        /// Limits the maximum size of an encoded message.
1568        ///
1569        /// Default: `usize::MAX`
1570        #[must_use]
1571        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1572            self.max_encoding_message_size = Some(limit);
1573            self
1574        }
1575    }
1576    impl<T, B> tonic::codegen::Service<http::Request<B>> for CommandHandlerServiceServer<T>
1577    where
1578        T: CommandHandlerService,
1579        B: Body + std::marker::Send + 'static,
1580        B::Error: Into<StdError> + std::marker::Send + 'static,
1581    {
1582        type Response = http::Response<tonic::body::BoxBody>;
1583        type Error = std::convert::Infallible;
1584        type Future = BoxFuture<Self::Response, Self::Error>;
1585        fn poll_ready(
1586            &mut self,
1587            _cx: &mut Context<'_>,
1588        ) -> Poll<std::result::Result<(), Self::Error>> {
1589            Poll::Ready(Ok(()))
1590        }
1591        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1592            match req.uri().path() {
1593                "/angzarr.CommandHandlerService/Handle" => {
1594                    #[allow(non_camel_case_types)]
1595                    struct HandleSvc<T: CommandHandlerService>(pub Arc<T>);
1596                    impl<T: CommandHandlerService>
1597                        tonic::server::UnaryService<super::ContextualCommand> for HandleSvc<T>
1598                    {
1599                        type Response = super::BusinessResponse;
1600                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1601                        fn call(
1602                            &mut self,
1603                            request: tonic::Request<super::ContextualCommand>,
1604                        ) -> Self::Future {
1605                            let inner = Arc::clone(&self.0);
1606                            let fut = async move {
1607                                <T as CommandHandlerService>::handle(&inner, request).await
1608                            };
1609                            Box::pin(fut)
1610                        }
1611                    }
1612                    let accept_compression_encodings = self.accept_compression_encodings;
1613                    let send_compression_encodings = self.send_compression_encodings;
1614                    let max_decoding_message_size = self.max_decoding_message_size;
1615                    let max_encoding_message_size = self.max_encoding_message_size;
1616                    let inner = self.inner.clone();
1617                    let fut = async move {
1618                        let method = HandleSvc(inner);
1619                        let codec = tonic::codec::ProstCodec::default();
1620                        let mut grpc = tonic::server::Grpc::new(codec)
1621                            .apply_compression_config(
1622                                accept_compression_encodings,
1623                                send_compression_encodings,
1624                            )
1625                            .apply_max_message_size_config(
1626                                max_decoding_message_size,
1627                                max_encoding_message_size,
1628                            );
1629                        let res = grpc.unary(method, req).await;
1630                        Ok(res)
1631                    };
1632                    Box::pin(fut)
1633                }
1634                "/angzarr.CommandHandlerService/Replay" => {
1635                    #[allow(non_camel_case_types)]
1636                    struct ReplaySvc<T: CommandHandlerService>(pub Arc<T>);
1637                    impl<T: CommandHandlerService> tonic::server::UnaryService<super::ReplayRequest> for ReplaySvc<T> {
1638                        type Response = super::ReplayResponse;
1639                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1640                        fn call(
1641                            &mut self,
1642                            request: tonic::Request<super::ReplayRequest>,
1643                        ) -> Self::Future {
1644                            let inner = Arc::clone(&self.0);
1645                            let fut = async move {
1646                                <T as CommandHandlerService>::replay(&inner, request).await
1647                            };
1648                            Box::pin(fut)
1649                        }
1650                    }
1651                    let accept_compression_encodings = self.accept_compression_encodings;
1652                    let send_compression_encodings = self.send_compression_encodings;
1653                    let max_decoding_message_size = self.max_decoding_message_size;
1654                    let max_encoding_message_size = self.max_encoding_message_size;
1655                    let inner = self.inner.clone();
1656                    let fut = async move {
1657                        let method = ReplaySvc(inner);
1658                        let codec = tonic::codec::ProstCodec::default();
1659                        let mut grpc = tonic::server::Grpc::new(codec)
1660                            .apply_compression_config(
1661                                accept_compression_encodings,
1662                                send_compression_encodings,
1663                            )
1664                            .apply_max_message_size_config(
1665                                max_decoding_message_size,
1666                                max_encoding_message_size,
1667                            );
1668                        let res = grpc.unary(method, req).await;
1669                        Ok(res)
1670                    };
1671                    Box::pin(fut)
1672                }
1673                _ => Box::pin(async move {
1674                    let mut response = http::Response::new(empty_body());
1675                    let headers = response.headers_mut();
1676                    headers.insert(
1677                        tonic::Status::GRPC_STATUS,
1678                        (tonic::Code::Unimplemented as i32).into(),
1679                    );
1680                    headers.insert(
1681                        http::header::CONTENT_TYPE,
1682                        tonic::metadata::GRPC_CONTENT_TYPE,
1683                    );
1684                    Ok(response)
1685                }),
1686            }
1687        }
1688    }
1689    impl<T> Clone for CommandHandlerServiceServer<T> {
1690        fn clone(&self) -> Self {
1691            let inner = self.inner.clone();
1692            Self {
1693                inner,
1694                accept_compression_encodings: self.accept_compression_encodings,
1695                send_compression_encodings: self.send_compression_encodings,
1696                max_decoding_message_size: self.max_decoding_message_size,
1697                max_encoding_message_size: self.max_encoding_message_size,
1698            }
1699        }
1700    }
1701    /// Generated gRPC service name
1702    pub const SERVICE_NAME: &str = "angzarr.CommandHandlerService";
1703    impl<T> tonic::server::NamedService for CommandHandlerServiceServer<T> {
1704        const NAME: &'static str = SERVICE_NAME;
1705    }
1706}
1707/// Generated server implementations.
1708pub mod command_handler_coordinator_service_server {
1709    #![allow(
1710        unused_variables,
1711        dead_code,
1712        missing_docs,
1713        clippy::wildcard_imports,
1714        clippy::let_unit_value
1715    )]
1716    use tonic::codegen::*;
1717    /// Generated trait containing gRPC methods that should be implemented for use with CommandHandlerCoordinatorServiceServer.
1718    #[async_trait]
1719    pub trait CommandHandlerCoordinatorService:
1720        std::marker::Send + std::marker::Sync + 'static
1721    {
1722        /// Process command with optional sync mode (default: async fire-and-forget)
1723        async fn handle_command(
1724            &self,
1725            request: tonic::Request<super::CommandRequest>,
1726        ) -> std::result::Result<tonic::Response<super::CommandResponse>, tonic::Status>;
1727        /// Inject fact events - external realities that cannot be rejected.
1728        /// Idempotent: subsequent requests with same external_id return original events.
1729        /// Use EventRequest.route_to_handler to control command handler invocation.
1730        async fn handle_event(
1731            &self,
1732            request: tonic::Request<super::EventRequest>,
1733        ) -> std::result::Result<tonic::Response<super::FactInjectionResponse>, tonic::Status>;
1734        /// Speculative execution - execute against temporal state without persisting
1735        async fn handle_sync_speculative(
1736            &self,
1737            request: tonic::Request<super::SpeculateCommandHandlerRequest>,
1738        ) -> std::result::Result<tonic::Response<super::CommandResponse>, tonic::Status>;
1739        /// Compensation flow - returns BusinessResponse for saga compensation handling.
1740        /// If business returns events, persists them. Caller handles revocation flags.
1741        async fn handle_compensation(
1742            &self,
1743            request: tonic::Request<super::CommandRequest>,
1744        ) -> std::result::Result<tonic::Response<super::BusinessResponse>, tonic::Status>;
1745    }
1746    /// CommandHandlerCoordinatorService: orchestrates command processing for domain aggregates
1747    #[derive(Debug)]
1748    pub struct CommandHandlerCoordinatorServiceServer<T> {
1749        inner: Arc<T>,
1750        accept_compression_encodings: EnabledCompressionEncodings,
1751        send_compression_encodings: EnabledCompressionEncodings,
1752        max_decoding_message_size: Option<usize>,
1753        max_encoding_message_size: Option<usize>,
1754    }
1755    impl<T> CommandHandlerCoordinatorServiceServer<T> {
1756        pub fn new(inner: T) -> Self {
1757            Self::from_arc(Arc::new(inner))
1758        }
1759        pub fn from_arc(inner: Arc<T>) -> Self {
1760            Self {
1761                inner,
1762                accept_compression_encodings: Default::default(),
1763                send_compression_encodings: Default::default(),
1764                max_decoding_message_size: None,
1765                max_encoding_message_size: None,
1766            }
1767        }
1768        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
1769        where
1770            F: tonic::service::Interceptor,
1771        {
1772            InterceptedService::new(Self::new(inner), interceptor)
1773        }
1774        /// Enable decompressing requests with the given encoding.
1775        #[must_use]
1776        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1777            self.accept_compression_encodings.enable(encoding);
1778            self
1779        }
1780        /// Compress responses with the given encoding, if the client supports it.
1781        #[must_use]
1782        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1783            self.send_compression_encodings.enable(encoding);
1784            self
1785        }
1786        /// Limits the maximum size of a decoded message.
1787        ///
1788        /// Default: `4MB`
1789        #[must_use]
1790        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1791            self.max_decoding_message_size = Some(limit);
1792            self
1793        }
1794        /// Limits the maximum size of an encoded message.
1795        ///
1796        /// Default: `usize::MAX`
1797        #[must_use]
1798        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1799            self.max_encoding_message_size = Some(limit);
1800            self
1801        }
1802    }
1803    impl<T, B> tonic::codegen::Service<http::Request<B>> for CommandHandlerCoordinatorServiceServer<T>
1804    where
1805        T: CommandHandlerCoordinatorService,
1806        B: Body + std::marker::Send + 'static,
1807        B::Error: Into<StdError> + std::marker::Send + 'static,
1808    {
1809        type Response = http::Response<tonic::body::BoxBody>;
1810        type Error = std::convert::Infallible;
1811        type Future = BoxFuture<Self::Response, Self::Error>;
1812        fn poll_ready(
1813            &mut self,
1814            _cx: &mut Context<'_>,
1815        ) -> Poll<std::result::Result<(), Self::Error>> {
1816            Poll::Ready(Ok(()))
1817        }
1818        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1819            match req.uri().path() {
1820                "/angzarr.CommandHandlerCoordinatorService/HandleCommand" => {
1821                    #[allow(non_camel_case_types)]
1822                    struct HandleCommandSvc<T: CommandHandlerCoordinatorService>(pub Arc<T>);
1823                    impl<T: CommandHandlerCoordinatorService>
1824                        tonic::server::UnaryService<super::CommandRequest> for HandleCommandSvc<T>
1825                    {
1826                        type Response = super::CommandResponse;
1827                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1828                        fn call(
1829                            &mut self,
1830                            request: tonic::Request<super::CommandRequest>,
1831                        ) -> Self::Future {
1832                            let inner = Arc::clone(&self.0);
1833                            let fut = async move {
1834                                <T as CommandHandlerCoordinatorService>::handle_command(
1835                                    &inner, request,
1836                                )
1837                                .await
1838                            };
1839                            Box::pin(fut)
1840                        }
1841                    }
1842                    let accept_compression_encodings = self.accept_compression_encodings;
1843                    let send_compression_encodings = self.send_compression_encodings;
1844                    let max_decoding_message_size = self.max_decoding_message_size;
1845                    let max_encoding_message_size = self.max_encoding_message_size;
1846                    let inner = self.inner.clone();
1847                    let fut = async move {
1848                        let method = HandleCommandSvc(inner);
1849                        let codec = tonic::codec::ProstCodec::default();
1850                        let mut grpc = tonic::server::Grpc::new(codec)
1851                            .apply_compression_config(
1852                                accept_compression_encodings,
1853                                send_compression_encodings,
1854                            )
1855                            .apply_max_message_size_config(
1856                                max_decoding_message_size,
1857                                max_encoding_message_size,
1858                            );
1859                        let res = grpc.unary(method, req).await;
1860                        Ok(res)
1861                    };
1862                    Box::pin(fut)
1863                }
1864                "/angzarr.CommandHandlerCoordinatorService/HandleEvent" => {
1865                    #[allow(non_camel_case_types)]
1866                    struct HandleEventSvc<T: CommandHandlerCoordinatorService>(pub Arc<T>);
1867                    impl<T: CommandHandlerCoordinatorService>
1868                        tonic::server::UnaryService<super::EventRequest> for HandleEventSvc<T>
1869                    {
1870                        type Response = super::FactInjectionResponse;
1871                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1872                        fn call(
1873                            &mut self,
1874                            request: tonic::Request<super::EventRequest>,
1875                        ) -> Self::Future {
1876                            let inner = Arc::clone(&self.0);
1877                            let fut = async move {
1878                                <T as CommandHandlerCoordinatorService>::handle_event(
1879                                    &inner, request,
1880                                )
1881                                .await
1882                            };
1883                            Box::pin(fut)
1884                        }
1885                    }
1886                    let accept_compression_encodings = self.accept_compression_encodings;
1887                    let send_compression_encodings = self.send_compression_encodings;
1888                    let max_decoding_message_size = self.max_decoding_message_size;
1889                    let max_encoding_message_size = self.max_encoding_message_size;
1890                    let inner = self.inner.clone();
1891                    let fut = async move {
1892                        let method = HandleEventSvc(inner);
1893                        let codec = tonic::codec::ProstCodec::default();
1894                        let mut grpc = tonic::server::Grpc::new(codec)
1895                            .apply_compression_config(
1896                                accept_compression_encodings,
1897                                send_compression_encodings,
1898                            )
1899                            .apply_max_message_size_config(
1900                                max_decoding_message_size,
1901                                max_encoding_message_size,
1902                            );
1903                        let res = grpc.unary(method, req).await;
1904                        Ok(res)
1905                    };
1906                    Box::pin(fut)
1907                }
1908                "/angzarr.CommandHandlerCoordinatorService/HandleSyncSpeculative" => {
1909                    #[allow(non_camel_case_types)]
1910                    struct HandleSyncSpeculativeSvc<T: CommandHandlerCoordinatorService>(
1911                        pub Arc<T>,
1912                    );
1913                    impl<T: CommandHandlerCoordinatorService>
1914                        tonic::server::UnaryService<super::SpeculateCommandHandlerRequest>
1915                        for HandleSyncSpeculativeSvc<T>
1916                    {
1917                        type Response = super::CommandResponse;
1918                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1919                        fn call(
1920                            &mut self,
1921                            request: tonic::Request<super::SpeculateCommandHandlerRequest>,
1922                        ) -> Self::Future {
1923                            let inner = Arc::clone(&self.0);
1924                            let fut = async move {
1925                                <T as CommandHandlerCoordinatorService>::handle_sync_speculative(
1926                                    &inner, request,
1927                                )
1928                                .await
1929                            };
1930                            Box::pin(fut)
1931                        }
1932                    }
1933                    let accept_compression_encodings = self.accept_compression_encodings;
1934                    let send_compression_encodings = self.send_compression_encodings;
1935                    let max_decoding_message_size = self.max_decoding_message_size;
1936                    let max_encoding_message_size = self.max_encoding_message_size;
1937                    let inner = self.inner.clone();
1938                    let fut = async move {
1939                        let method = HandleSyncSpeculativeSvc(inner);
1940                        let codec = tonic::codec::ProstCodec::default();
1941                        let mut grpc = tonic::server::Grpc::new(codec)
1942                            .apply_compression_config(
1943                                accept_compression_encodings,
1944                                send_compression_encodings,
1945                            )
1946                            .apply_max_message_size_config(
1947                                max_decoding_message_size,
1948                                max_encoding_message_size,
1949                            );
1950                        let res = grpc.unary(method, req).await;
1951                        Ok(res)
1952                    };
1953                    Box::pin(fut)
1954                }
1955                "/angzarr.CommandHandlerCoordinatorService/HandleCompensation" => {
1956                    #[allow(non_camel_case_types)]
1957                    struct HandleCompensationSvc<T: CommandHandlerCoordinatorService>(pub Arc<T>);
1958                    impl<T: CommandHandlerCoordinatorService>
1959                        tonic::server::UnaryService<super::CommandRequest>
1960                        for HandleCompensationSvc<T>
1961                    {
1962                        type Response = super::BusinessResponse;
1963                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1964                        fn call(
1965                            &mut self,
1966                            request: tonic::Request<super::CommandRequest>,
1967                        ) -> Self::Future {
1968                            let inner = Arc::clone(&self.0);
1969                            let fut = async move {
1970                                <T as CommandHandlerCoordinatorService>::handle_compensation(
1971                                    &inner, request,
1972                                )
1973                                .await
1974                            };
1975                            Box::pin(fut)
1976                        }
1977                    }
1978                    let accept_compression_encodings = self.accept_compression_encodings;
1979                    let send_compression_encodings = self.send_compression_encodings;
1980                    let max_decoding_message_size = self.max_decoding_message_size;
1981                    let max_encoding_message_size = self.max_encoding_message_size;
1982                    let inner = self.inner.clone();
1983                    let fut = async move {
1984                        let method = HandleCompensationSvc(inner);
1985                        let codec = tonic::codec::ProstCodec::default();
1986                        let mut grpc = tonic::server::Grpc::new(codec)
1987                            .apply_compression_config(
1988                                accept_compression_encodings,
1989                                send_compression_encodings,
1990                            )
1991                            .apply_max_message_size_config(
1992                                max_decoding_message_size,
1993                                max_encoding_message_size,
1994                            );
1995                        let res = grpc.unary(method, req).await;
1996                        Ok(res)
1997                    };
1998                    Box::pin(fut)
1999                }
2000                _ => Box::pin(async move {
2001                    let mut response = http::Response::new(empty_body());
2002                    let headers = response.headers_mut();
2003                    headers.insert(
2004                        tonic::Status::GRPC_STATUS,
2005                        (tonic::Code::Unimplemented as i32).into(),
2006                    );
2007                    headers.insert(
2008                        http::header::CONTENT_TYPE,
2009                        tonic::metadata::GRPC_CONTENT_TYPE,
2010                    );
2011                    Ok(response)
2012                }),
2013            }
2014        }
2015    }
2016    impl<T> Clone for CommandHandlerCoordinatorServiceServer<T> {
2017        fn clone(&self) -> Self {
2018            let inner = self.inner.clone();
2019            Self {
2020                inner,
2021                accept_compression_encodings: self.accept_compression_encodings,
2022                send_compression_encodings: self.send_compression_encodings,
2023                max_decoding_message_size: self.max_decoding_message_size,
2024                max_encoding_message_size: self.max_encoding_message_size,
2025            }
2026        }
2027    }
2028    /// Generated gRPC service name
2029    pub const SERVICE_NAME: &str = "angzarr.CommandHandlerCoordinatorService";
2030    impl<T> tonic::server::NamedService for CommandHandlerCoordinatorServiceServer<T> {
2031        const NAME: &'static str = SERVICE_NAME;
2032    }
2033}
2034/// Request for speculative projector execution.
2035#[derive(Clone, PartialEq, ::prost::Message)]
2036pub struct SpeculateProjectorRequest {
2037    #[prost(message, optional, tag = "1")]
2038    pub events: ::core::option::Option<EventBook>,
2039}
2040impl ::prost::Name for SpeculateProjectorRequest {
2041    const NAME: &'static str = "SpeculateProjectorRequest";
2042    const PACKAGE: &'static str = "angzarr";
2043    fn full_name() -> ::prost::alloc::string::String {
2044        "angzarr.SpeculateProjectorRequest".into()
2045    }
2046    fn type_url() -> ::prost::alloc::string::String {
2047        "/angzarr.SpeculateProjectorRequest".into()
2048    }
2049}
2050/// Generated client implementations.
2051pub mod projector_service_client {
2052    #![allow(
2053        unused_variables,
2054        dead_code,
2055        missing_docs,
2056        clippy::wildcard_imports,
2057        clippy::let_unit_value
2058    )]
2059    use tonic::codegen::http::Uri;
2060    use tonic::codegen::*;
2061    /// ProjectorService: client logic that projects events to read models
2062    /// client logic doesn't care about sync - coordinator decides
2063    #[derive(Debug, Clone)]
2064    pub struct ProjectorServiceClient<T> {
2065        inner: tonic::client::Grpc<T>,
2066    }
2067    impl ProjectorServiceClient<tonic::transport::Channel> {
2068        /// Attempt to create a new client by connecting to a given endpoint.
2069        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2070        where
2071            D: TryInto<tonic::transport::Endpoint>,
2072            D::Error: Into<StdError>,
2073        {
2074            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2075            Ok(Self::new(conn))
2076        }
2077    }
2078    impl<T> ProjectorServiceClient<T>
2079    where
2080        T: tonic::client::GrpcService<tonic::body::BoxBody>,
2081        T::Error: Into<StdError>,
2082        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2083        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2084    {
2085        pub fn new(inner: T) -> Self {
2086            let inner = tonic::client::Grpc::new(inner);
2087            Self { inner }
2088        }
2089        pub fn with_origin(inner: T, origin: Uri) -> Self {
2090            let inner = tonic::client::Grpc::with_origin(inner, origin);
2091            Self { inner }
2092        }
2093        pub fn with_interceptor<F>(
2094            inner: T,
2095            interceptor: F,
2096        ) -> ProjectorServiceClient<InterceptedService<T, F>>
2097        where
2098            F: tonic::service::Interceptor,
2099            T::ResponseBody: Default,
2100            T: tonic::codegen::Service<
2101                http::Request<tonic::body::BoxBody>,
2102                Response = http::Response<
2103                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
2104                >,
2105            >,
2106            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
2107                Into<StdError> + std::marker::Send + std::marker::Sync,
2108        {
2109            ProjectorServiceClient::new(InterceptedService::new(inner, interceptor))
2110        }
2111        /// Compress requests with the given encoding.
2112        ///
2113        /// This requires the server to support it otherwise it might respond with an
2114        /// error.
2115        #[must_use]
2116        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2117            self.inner = self.inner.send_compressed(encoding);
2118            self
2119        }
2120        /// Enable decompressing responses.
2121        #[must_use]
2122        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2123            self.inner = self.inner.accept_compressed(encoding);
2124            self
2125        }
2126        /// Limits the maximum size of a decoded message.
2127        ///
2128        /// Default: `4MB`
2129        #[must_use]
2130        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2131            self.inner = self.inner.max_decoding_message_size(limit);
2132            self
2133        }
2134        /// Limits the maximum size of an encoded message.
2135        ///
2136        /// Default: `usize::MAX`
2137        #[must_use]
2138        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2139            self.inner = self.inner.max_encoding_message_size(limit);
2140            self
2141        }
2142        /// Async projection - projector should persist and return
2143        pub async fn handle(
2144            &mut self,
2145            request: impl tonic::IntoRequest<super::EventBook>,
2146        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status> {
2147            self.inner.ready().await.map_err(|e| {
2148                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2149            })?;
2150            let codec = tonic::codec::ProstCodec::default();
2151            let path = http::uri::PathAndQuery::from_static("/angzarr.ProjectorService/Handle");
2152            let mut req = request.into_request();
2153            req.extensions_mut()
2154                .insert(GrpcMethod::new("angzarr.ProjectorService", "Handle"));
2155            self.inner.unary(req, path, codec).await
2156        }
2157        /// Speculative processing - projector must avoid external side effects
2158        pub async fn handle_speculative(
2159            &mut self,
2160            request: impl tonic::IntoRequest<super::EventBook>,
2161        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status> {
2162            self.inner.ready().await.map_err(|e| {
2163                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2164            })?;
2165            let codec = tonic::codec::ProstCodec::default();
2166            let path =
2167                http::uri::PathAndQuery::from_static("/angzarr.ProjectorService/HandleSpeculative");
2168            let mut req = request.into_request();
2169            req.extensions_mut().insert(GrpcMethod::new(
2170                "angzarr.ProjectorService",
2171                "HandleSpeculative",
2172            ));
2173            self.inner.unary(req, path, codec).await
2174        }
2175    }
2176}
2177/// Generated client implementations.
2178pub mod projector_coordinator_service_client {
2179    #![allow(
2180        unused_variables,
2181        dead_code,
2182        missing_docs,
2183        clippy::wildcard_imports,
2184        clippy::let_unit_value
2185    )]
2186    use tonic::codegen::http::Uri;
2187    use tonic::codegen::*;
2188    /// ProjectorCoordinatorService: orchestrates projection processing
2189    #[derive(Debug, Clone)]
2190    pub struct ProjectorCoordinatorServiceClient<T> {
2191        inner: tonic::client::Grpc<T>,
2192    }
2193    impl ProjectorCoordinatorServiceClient<tonic::transport::Channel> {
2194        /// Attempt to create a new client by connecting to a given endpoint.
2195        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2196        where
2197            D: TryInto<tonic::transport::Endpoint>,
2198            D::Error: Into<StdError>,
2199        {
2200            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2201            Ok(Self::new(conn))
2202        }
2203    }
2204    impl<T> ProjectorCoordinatorServiceClient<T>
2205    where
2206        T: tonic::client::GrpcService<tonic::body::BoxBody>,
2207        T::Error: Into<StdError>,
2208        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2209        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2210    {
2211        pub fn new(inner: T) -> Self {
2212            let inner = tonic::client::Grpc::new(inner);
2213            Self { inner }
2214        }
2215        pub fn with_origin(inner: T, origin: Uri) -> Self {
2216            let inner = tonic::client::Grpc::with_origin(inner, origin);
2217            Self { inner }
2218        }
2219        pub fn with_interceptor<F>(
2220            inner: T,
2221            interceptor: F,
2222        ) -> ProjectorCoordinatorServiceClient<InterceptedService<T, F>>
2223        where
2224            F: tonic::service::Interceptor,
2225            T::ResponseBody: Default,
2226            T: tonic::codegen::Service<
2227                http::Request<tonic::body::BoxBody>,
2228                Response = http::Response<
2229                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
2230                >,
2231            >,
2232            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
2233                Into<StdError> + std::marker::Send + std::marker::Sync,
2234        {
2235            ProjectorCoordinatorServiceClient::new(InterceptedService::new(inner, interceptor))
2236        }
2237        /// Compress requests with the given encoding.
2238        ///
2239        /// This requires the server to support it otherwise it might respond with an
2240        /// error.
2241        #[must_use]
2242        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2243            self.inner = self.inner.send_compressed(encoding);
2244            self
2245        }
2246        /// Enable decompressing responses.
2247        #[must_use]
2248        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2249            self.inner = self.inner.accept_compressed(encoding);
2250            self
2251        }
2252        /// Limits the maximum size of a decoded message.
2253        ///
2254        /// Default: `4MB`
2255        #[must_use]
2256        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2257            self.inner = self.inner.max_decoding_message_size(limit);
2258            self
2259        }
2260        /// Limits the maximum size of an encoded message.
2261        ///
2262        /// Default: `usize::MAX`
2263        #[must_use]
2264        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2265            self.inner = self.inner.max_encoding_message_size(limit);
2266            self
2267        }
2268        /// Sync processing - returns projection based on sync_mode
2269        pub async fn handle_sync(
2270            &mut self,
2271            request: impl tonic::IntoRequest<super::EventRequest>,
2272        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status> {
2273            self.inner.ready().await.map_err(|e| {
2274                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2275            })?;
2276            let codec = tonic::codec::ProstCodec::default();
2277            let path = http::uri::PathAndQuery::from_static(
2278                "/angzarr.ProjectorCoordinatorService/HandleSync",
2279            );
2280            let mut req = request.into_request();
2281            req.extensions_mut().insert(GrpcMethod::new(
2282                "angzarr.ProjectorCoordinatorService",
2283                "HandleSync",
2284            ));
2285            self.inner.unary(req, path, codec).await
2286        }
2287        /// Async processing - fire and forget
2288        pub async fn handle(
2289            &mut self,
2290            request: impl tonic::IntoRequest<super::EventBook>,
2291        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
2292            self.inner.ready().await.map_err(|e| {
2293                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2294            })?;
2295            let codec = tonic::codec::ProstCodec::default();
2296            let path =
2297                http::uri::PathAndQuery::from_static("/angzarr.ProjectorCoordinatorService/Handle");
2298            let mut req = request.into_request();
2299            req.extensions_mut().insert(GrpcMethod::new(
2300                "angzarr.ProjectorCoordinatorService",
2301                "Handle",
2302            ));
2303            self.inner.unary(req, path, codec).await
2304        }
2305        /// Speculative processing - returns projection without side effects
2306        pub async fn handle_speculative(
2307            &mut self,
2308            request: impl tonic::IntoRequest<super::SpeculateProjectorRequest>,
2309        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status> {
2310            self.inner.ready().await.map_err(|e| {
2311                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2312            })?;
2313            let codec = tonic::codec::ProstCodec::default();
2314            let path = http::uri::PathAndQuery::from_static(
2315                "/angzarr.ProjectorCoordinatorService/HandleSpeculative",
2316            );
2317            let mut req = request.into_request();
2318            req.extensions_mut().insert(GrpcMethod::new(
2319                "angzarr.ProjectorCoordinatorService",
2320                "HandleSpeculative",
2321            ));
2322            self.inner.unary(req, path, codec).await
2323        }
2324    }
2325}
2326/// Generated server implementations.
2327pub mod projector_service_server {
2328    #![allow(
2329        unused_variables,
2330        dead_code,
2331        missing_docs,
2332        clippy::wildcard_imports,
2333        clippy::let_unit_value
2334    )]
2335    use tonic::codegen::*;
2336    /// Generated trait containing gRPC methods that should be implemented for use with ProjectorServiceServer.
2337    #[async_trait]
2338    pub trait ProjectorService: std::marker::Send + std::marker::Sync + 'static {
2339        /// Async projection - projector should persist and return
2340        async fn handle(
2341            &self,
2342            request: tonic::Request<super::EventBook>,
2343        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status>;
2344        /// Speculative processing - projector must avoid external side effects
2345        async fn handle_speculative(
2346            &self,
2347            request: tonic::Request<super::EventBook>,
2348        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status>;
2349    }
2350    /// ProjectorService: client logic that projects events to read models
2351    /// client logic doesn't care about sync - coordinator decides
2352    #[derive(Debug)]
2353    pub struct ProjectorServiceServer<T> {
2354        inner: Arc<T>,
2355        accept_compression_encodings: EnabledCompressionEncodings,
2356        send_compression_encodings: EnabledCompressionEncodings,
2357        max_decoding_message_size: Option<usize>,
2358        max_encoding_message_size: Option<usize>,
2359    }
2360    impl<T> ProjectorServiceServer<T> {
2361        pub fn new(inner: T) -> Self {
2362            Self::from_arc(Arc::new(inner))
2363        }
2364        pub fn from_arc(inner: Arc<T>) -> Self {
2365            Self {
2366                inner,
2367                accept_compression_encodings: Default::default(),
2368                send_compression_encodings: Default::default(),
2369                max_decoding_message_size: None,
2370                max_encoding_message_size: None,
2371            }
2372        }
2373        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
2374        where
2375            F: tonic::service::Interceptor,
2376        {
2377            InterceptedService::new(Self::new(inner), interceptor)
2378        }
2379        /// Enable decompressing requests with the given encoding.
2380        #[must_use]
2381        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2382            self.accept_compression_encodings.enable(encoding);
2383            self
2384        }
2385        /// Compress responses with the given encoding, if the client supports it.
2386        #[must_use]
2387        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2388            self.send_compression_encodings.enable(encoding);
2389            self
2390        }
2391        /// Limits the maximum size of a decoded message.
2392        ///
2393        /// Default: `4MB`
2394        #[must_use]
2395        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2396            self.max_decoding_message_size = Some(limit);
2397            self
2398        }
2399        /// Limits the maximum size of an encoded message.
2400        ///
2401        /// Default: `usize::MAX`
2402        #[must_use]
2403        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2404            self.max_encoding_message_size = Some(limit);
2405            self
2406        }
2407    }
2408    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProjectorServiceServer<T>
2409    where
2410        T: ProjectorService,
2411        B: Body + std::marker::Send + 'static,
2412        B::Error: Into<StdError> + std::marker::Send + 'static,
2413    {
2414        type Response = http::Response<tonic::body::BoxBody>;
2415        type Error = std::convert::Infallible;
2416        type Future = BoxFuture<Self::Response, Self::Error>;
2417        fn poll_ready(
2418            &mut self,
2419            _cx: &mut Context<'_>,
2420        ) -> Poll<std::result::Result<(), Self::Error>> {
2421            Poll::Ready(Ok(()))
2422        }
2423        fn call(&mut self, req: http::Request<B>) -> Self::Future {
2424            match req.uri().path() {
2425                "/angzarr.ProjectorService/Handle" => {
2426                    #[allow(non_camel_case_types)]
2427                    struct HandleSvc<T: ProjectorService>(pub Arc<T>);
2428                    impl<T: ProjectorService> tonic::server::UnaryService<super::EventBook> for HandleSvc<T> {
2429                        type Response = super::Projection;
2430                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2431                        fn call(
2432                            &mut self,
2433                            request: tonic::Request<super::EventBook>,
2434                        ) -> Self::Future {
2435                            let inner = Arc::clone(&self.0);
2436                            let fut = async move {
2437                                <T as ProjectorService>::handle(&inner, request).await
2438                            };
2439                            Box::pin(fut)
2440                        }
2441                    }
2442                    let accept_compression_encodings = self.accept_compression_encodings;
2443                    let send_compression_encodings = self.send_compression_encodings;
2444                    let max_decoding_message_size = self.max_decoding_message_size;
2445                    let max_encoding_message_size = self.max_encoding_message_size;
2446                    let inner = self.inner.clone();
2447                    let fut = async move {
2448                        let method = HandleSvc(inner);
2449                        let codec = tonic::codec::ProstCodec::default();
2450                        let mut grpc = tonic::server::Grpc::new(codec)
2451                            .apply_compression_config(
2452                                accept_compression_encodings,
2453                                send_compression_encodings,
2454                            )
2455                            .apply_max_message_size_config(
2456                                max_decoding_message_size,
2457                                max_encoding_message_size,
2458                            );
2459                        let res = grpc.unary(method, req).await;
2460                        Ok(res)
2461                    };
2462                    Box::pin(fut)
2463                }
2464                "/angzarr.ProjectorService/HandleSpeculative" => {
2465                    #[allow(non_camel_case_types)]
2466                    struct HandleSpeculativeSvc<T: ProjectorService>(pub Arc<T>);
2467                    impl<T: ProjectorService> tonic::server::UnaryService<super::EventBook>
2468                        for HandleSpeculativeSvc<T>
2469                    {
2470                        type Response = super::Projection;
2471                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2472                        fn call(
2473                            &mut self,
2474                            request: tonic::Request<super::EventBook>,
2475                        ) -> Self::Future {
2476                            let inner = Arc::clone(&self.0);
2477                            let fut = async move {
2478                                <T as ProjectorService>::handle_speculative(&inner, request).await
2479                            };
2480                            Box::pin(fut)
2481                        }
2482                    }
2483                    let accept_compression_encodings = self.accept_compression_encodings;
2484                    let send_compression_encodings = self.send_compression_encodings;
2485                    let max_decoding_message_size = self.max_decoding_message_size;
2486                    let max_encoding_message_size = self.max_encoding_message_size;
2487                    let inner = self.inner.clone();
2488                    let fut = async move {
2489                        let method = HandleSpeculativeSvc(inner);
2490                        let codec = tonic::codec::ProstCodec::default();
2491                        let mut grpc = tonic::server::Grpc::new(codec)
2492                            .apply_compression_config(
2493                                accept_compression_encodings,
2494                                send_compression_encodings,
2495                            )
2496                            .apply_max_message_size_config(
2497                                max_decoding_message_size,
2498                                max_encoding_message_size,
2499                            );
2500                        let res = grpc.unary(method, req).await;
2501                        Ok(res)
2502                    };
2503                    Box::pin(fut)
2504                }
2505                _ => Box::pin(async move {
2506                    let mut response = http::Response::new(empty_body());
2507                    let headers = response.headers_mut();
2508                    headers.insert(
2509                        tonic::Status::GRPC_STATUS,
2510                        (tonic::Code::Unimplemented as i32).into(),
2511                    );
2512                    headers.insert(
2513                        http::header::CONTENT_TYPE,
2514                        tonic::metadata::GRPC_CONTENT_TYPE,
2515                    );
2516                    Ok(response)
2517                }),
2518            }
2519        }
2520    }
2521    impl<T> Clone for ProjectorServiceServer<T> {
2522        fn clone(&self) -> Self {
2523            let inner = self.inner.clone();
2524            Self {
2525                inner,
2526                accept_compression_encodings: self.accept_compression_encodings,
2527                send_compression_encodings: self.send_compression_encodings,
2528                max_decoding_message_size: self.max_decoding_message_size,
2529                max_encoding_message_size: self.max_encoding_message_size,
2530            }
2531        }
2532    }
2533    /// Generated gRPC service name
2534    pub const SERVICE_NAME: &str = "angzarr.ProjectorService";
2535    impl<T> tonic::server::NamedService for ProjectorServiceServer<T> {
2536        const NAME: &'static str = SERVICE_NAME;
2537    }
2538}
2539/// Generated server implementations.
2540pub mod projector_coordinator_service_server {
2541    #![allow(
2542        unused_variables,
2543        dead_code,
2544        missing_docs,
2545        clippy::wildcard_imports,
2546        clippy::let_unit_value
2547    )]
2548    use tonic::codegen::*;
2549    /// Generated trait containing gRPC methods that should be implemented for use with ProjectorCoordinatorServiceServer.
2550    #[async_trait]
2551    pub trait ProjectorCoordinatorService: std::marker::Send + std::marker::Sync + 'static {
2552        /// Sync processing - returns projection based on sync_mode
2553        async fn handle_sync(
2554            &self,
2555            request: tonic::Request<super::EventRequest>,
2556        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status>;
2557        /// Async processing - fire and forget
2558        async fn handle(
2559            &self,
2560            request: tonic::Request<super::EventBook>,
2561        ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
2562        /// Speculative processing - returns projection without side effects
2563        async fn handle_speculative(
2564            &self,
2565            request: tonic::Request<super::SpeculateProjectorRequest>,
2566        ) -> std::result::Result<tonic::Response<super::Projection>, tonic::Status>;
2567    }
2568    /// ProjectorCoordinatorService: orchestrates projection processing
2569    #[derive(Debug)]
2570    pub struct ProjectorCoordinatorServiceServer<T> {
2571        inner: Arc<T>,
2572        accept_compression_encodings: EnabledCompressionEncodings,
2573        send_compression_encodings: EnabledCompressionEncodings,
2574        max_decoding_message_size: Option<usize>,
2575        max_encoding_message_size: Option<usize>,
2576    }
2577    impl<T> ProjectorCoordinatorServiceServer<T> {
2578        pub fn new(inner: T) -> Self {
2579            Self::from_arc(Arc::new(inner))
2580        }
2581        pub fn from_arc(inner: Arc<T>) -> Self {
2582            Self {
2583                inner,
2584                accept_compression_encodings: Default::default(),
2585                send_compression_encodings: Default::default(),
2586                max_decoding_message_size: None,
2587                max_encoding_message_size: None,
2588            }
2589        }
2590        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
2591        where
2592            F: tonic::service::Interceptor,
2593        {
2594            InterceptedService::new(Self::new(inner), interceptor)
2595        }
2596        /// Enable decompressing requests with the given encoding.
2597        #[must_use]
2598        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2599            self.accept_compression_encodings.enable(encoding);
2600            self
2601        }
2602        /// Compress responses with the given encoding, if the client supports it.
2603        #[must_use]
2604        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2605            self.send_compression_encodings.enable(encoding);
2606            self
2607        }
2608        /// Limits the maximum size of a decoded message.
2609        ///
2610        /// Default: `4MB`
2611        #[must_use]
2612        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2613            self.max_decoding_message_size = Some(limit);
2614            self
2615        }
2616        /// Limits the maximum size of an encoded message.
2617        ///
2618        /// Default: `usize::MAX`
2619        #[must_use]
2620        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2621            self.max_encoding_message_size = Some(limit);
2622            self
2623        }
2624    }
2625    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProjectorCoordinatorServiceServer<T>
2626    where
2627        T: ProjectorCoordinatorService,
2628        B: Body + std::marker::Send + 'static,
2629        B::Error: Into<StdError> + std::marker::Send + 'static,
2630    {
2631        type Response = http::Response<tonic::body::BoxBody>;
2632        type Error = std::convert::Infallible;
2633        type Future = BoxFuture<Self::Response, Self::Error>;
2634        fn poll_ready(
2635            &mut self,
2636            _cx: &mut Context<'_>,
2637        ) -> Poll<std::result::Result<(), Self::Error>> {
2638            Poll::Ready(Ok(()))
2639        }
2640        fn call(&mut self, req: http::Request<B>) -> Self::Future {
2641            match req.uri().path() {
2642                "/angzarr.ProjectorCoordinatorService/HandleSync" => {
2643                    #[allow(non_camel_case_types)]
2644                    struct HandleSyncSvc<T: ProjectorCoordinatorService>(pub Arc<T>);
2645                    impl<T: ProjectorCoordinatorService>
2646                        tonic::server::UnaryService<super::EventRequest> for HandleSyncSvc<T>
2647                    {
2648                        type Response = super::Projection;
2649                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2650                        fn call(
2651                            &mut self,
2652                            request: tonic::Request<super::EventRequest>,
2653                        ) -> Self::Future {
2654                            let inner = Arc::clone(&self.0);
2655                            let fut = async move {
2656                                <T as ProjectorCoordinatorService>::handle_sync(&inner, request)
2657                                    .await
2658                            };
2659                            Box::pin(fut)
2660                        }
2661                    }
2662                    let accept_compression_encodings = self.accept_compression_encodings;
2663                    let send_compression_encodings = self.send_compression_encodings;
2664                    let max_decoding_message_size = self.max_decoding_message_size;
2665                    let max_encoding_message_size = self.max_encoding_message_size;
2666                    let inner = self.inner.clone();
2667                    let fut = async move {
2668                        let method = HandleSyncSvc(inner);
2669                        let codec = tonic::codec::ProstCodec::default();
2670                        let mut grpc = tonic::server::Grpc::new(codec)
2671                            .apply_compression_config(
2672                                accept_compression_encodings,
2673                                send_compression_encodings,
2674                            )
2675                            .apply_max_message_size_config(
2676                                max_decoding_message_size,
2677                                max_encoding_message_size,
2678                            );
2679                        let res = grpc.unary(method, req).await;
2680                        Ok(res)
2681                    };
2682                    Box::pin(fut)
2683                }
2684                "/angzarr.ProjectorCoordinatorService/Handle" => {
2685                    #[allow(non_camel_case_types)]
2686                    struct HandleSvc<T: ProjectorCoordinatorService>(pub Arc<T>);
2687                    impl<T: ProjectorCoordinatorService>
2688                        tonic::server::UnaryService<super::EventBook> for HandleSvc<T>
2689                    {
2690                        type Response = ();
2691                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2692                        fn call(
2693                            &mut self,
2694                            request: tonic::Request<super::EventBook>,
2695                        ) -> Self::Future {
2696                            let inner = Arc::clone(&self.0);
2697                            let fut = async move {
2698                                <T as ProjectorCoordinatorService>::handle(&inner, request).await
2699                            };
2700                            Box::pin(fut)
2701                        }
2702                    }
2703                    let accept_compression_encodings = self.accept_compression_encodings;
2704                    let send_compression_encodings = self.send_compression_encodings;
2705                    let max_decoding_message_size = self.max_decoding_message_size;
2706                    let max_encoding_message_size = self.max_encoding_message_size;
2707                    let inner = self.inner.clone();
2708                    let fut = async move {
2709                        let method = HandleSvc(inner);
2710                        let codec = tonic::codec::ProstCodec::default();
2711                        let mut grpc = tonic::server::Grpc::new(codec)
2712                            .apply_compression_config(
2713                                accept_compression_encodings,
2714                                send_compression_encodings,
2715                            )
2716                            .apply_max_message_size_config(
2717                                max_decoding_message_size,
2718                                max_encoding_message_size,
2719                            );
2720                        let res = grpc.unary(method, req).await;
2721                        Ok(res)
2722                    };
2723                    Box::pin(fut)
2724                }
2725                "/angzarr.ProjectorCoordinatorService/HandleSpeculative" => {
2726                    #[allow(non_camel_case_types)]
2727                    struct HandleSpeculativeSvc<T: ProjectorCoordinatorService>(pub Arc<T>);
2728                    impl<T: ProjectorCoordinatorService>
2729                        tonic::server::UnaryService<super::SpeculateProjectorRequest>
2730                        for HandleSpeculativeSvc<T>
2731                    {
2732                        type Response = super::Projection;
2733                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2734                        fn call(
2735                            &mut self,
2736                            request: tonic::Request<super::SpeculateProjectorRequest>,
2737                        ) -> Self::Future {
2738                            let inner = Arc::clone(&self.0);
2739                            let fut = async move {
2740                                <T as ProjectorCoordinatorService>::handle_speculative(
2741                                    &inner, request,
2742                                )
2743                                .await
2744                            };
2745                            Box::pin(fut)
2746                        }
2747                    }
2748                    let accept_compression_encodings = self.accept_compression_encodings;
2749                    let send_compression_encodings = self.send_compression_encodings;
2750                    let max_decoding_message_size = self.max_decoding_message_size;
2751                    let max_encoding_message_size = self.max_encoding_message_size;
2752                    let inner = self.inner.clone();
2753                    let fut = async move {
2754                        let method = HandleSpeculativeSvc(inner);
2755                        let codec = tonic::codec::ProstCodec::default();
2756                        let mut grpc = tonic::server::Grpc::new(codec)
2757                            .apply_compression_config(
2758                                accept_compression_encodings,
2759                                send_compression_encodings,
2760                            )
2761                            .apply_max_message_size_config(
2762                                max_decoding_message_size,
2763                                max_encoding_message_size,
2764                            );
2765                        let res = grpc.unary(method, req).await;
2766                        Ok(res)
2767                    };
2768                    Box::pin(fut)
2769                }
2770                _ => Box::pin(async move {
2771                    let mut response = http::Response::new(empty_body());
2772                    let headers = response.headers_mut();
2773                    headers.insert(
2774                        tonic::Status::GRPC_STATUS,
2775                        (tonic::Code::Unimplemented as i32).into(),
2776                    );
2777                    headers.insert(
2778                        http::header::CONTENT_TYPE,
2779                        tonic::metadata::GRPC_CONTENT_TYPE,
2780                    );
2781                    Ok(response)
2782                }),
2783            }
2784        }
2785    }
2786    impl<T> Clone for ProjectorCoordinatorServiceServer<T> {
2787        fn clone(&self) -> Self {
2788            let inner = self.inner.clone();
2789            Self {
2790                inner,
2791                accept_compression_encodings: self.accept_compression_encodings,
2792                send_compression_encodings: self.send_compression_encodings,
2793                max_decoding_message_size: self.max_decoding_message_size,
2794                max_encoding_message_size: self.max_encoding_message_size,
2795            }
2796        }
2797    }
2798    /// Generated gRPC service name
2799    pub const SERVICE_NAME: &str = "angzarr.ProjectorCoordinatorService";
2800    impl<T> tonic::server::NamedService for ProjectorCoordinatorServiceServer<T> {
2801        const NAME: &'static str = SERVICE_NAME;
2802    }
2803}
2804/// Request for saga execution - source events only.
2805/// Sagas are pure translators: source events → commands with angzarr_deferred.
2806#[derive(Clone, PartialEq, ::prost::Message)]
2807pub struct SagaHandleRequest {
2808    /// Source events that triggered the saga
2809    #[prost(message, optional, tag = "1")]
2810    pub source: ::core::option::Option<EventBook>,
2811    /// Propagate for CASCADE recursion
2812    #[prost(enumeration = "SyncMode", tag = "2")]
2813    pub sync_mode: i32,
2814    /// How to handle errors in CASCADE mode
2815    #[prost(enumeration = "CascadeErrorMode", tag = "3")]
2816    pub cascade_error_mode: i32,
2817}
2818impl ::prost::Name for SagaHandleRequest {
2819    const NAME: &'static str = "SagaHandleRequest";
2820    const PACKAGE: &'static str = "angzarr";
2821    fn full_name() -> ::prost::alloc::string::String {
2822        "angzarr.SagaHandleRequest".into()
2823    }
2824    fn type_url() -> ::prost::alloc::string::String {
2825        "/angzarr.SagaHandleRequest".into()
2826    }
2827}
2828/// Request for speculative saga execution.
2829#[derive(Clone, PartialEq, ::prost::Message)]
2830pub struct SpeculateSagaRequest {
2831    #[prost(message, optional, tag = "1")]
2832    pub request: ::core::option::Option<SagaHandleRequest>,
2833}
2834impl ::prost::Name for SpeculateSagaRequest {
2835    const NAME: &'static str = "SpeculateSagaRequest";
2836    const PACKAGE: &'static str = "angzarr";
2837    fn full_name() -> ::prost::alloc::string::String {
2838        "angzarr.SpeculateSagaRequest".into()
2839    }
2840    fn type_url() -> ::prost::alloc::string::String {
2841        "/angzarr.SpeculateSagaRequest".into()
2842    }
2843}
2844/// Response from saga - commands for other aggregates
2845#[derive(Clone, PartialEq, ::prost::Message)]
2846pub struct SagaResponse {
2847    /// Commands to execute on other aggregates (with angzarr_deferred)
2848    #[prost(message, repeated, tag = "1")]
2849    pub commands: ::prost::alloc::vec::Vec<CommandBook>,
2850    /// Events (facts) to inject directly
2851    #[prost(message, repeated, tag = "2")]
2852    pub events: ::prost::alloc::vec::Vec<EventBook>,
2853}
2854impl ::prost::Name for SagaResponse {
2855    const NAME: &'static str = "SagaResponse";
2856    const PACKAGE: &'static str = "angzarr";
2857    fn full_name() -> ::prost::alloc::string::String {
2858        "angzarr.SagaResponse".into()
2859    }
2860    fn type_url() -> ::prost::alloc::string::String {
2861        "/angzarr.SagaResponse".into()
2862    }
2863}
2864/// System event when compensation fails/requested
2865#[derive(Clone, PartialEq, ::prost::Message)]
2866pub struct SagaCompensationFailed {
2867    #[prost(message, optional, tag = "1")]
2868    pub triggering_aggregate: ::core::option::Option<Cover>,
2869    #[prost(uint32, tag = "2")]
2870    pub triggering_event_sequence: u32,
2871    #[prost(string, tag = "3")]
2872    pub saga_name: ::prost::alloc::string::String,
2873    #[prost(string, tag = "4")]
2874    pub rejection_reason: ::prost::alloc::string::String,
2875    #[prost(string, tag = "5")]
2876    pub compensation_failure_reason: ::prost::alloc::string::String,
2877    #[prost(message, optional, tag = "6")]
2878    pub rejected_command: ::core::option::Option<CommandBook>,
2879    #[prost(message, optional, tag = "7")]
2880    pub occurred_at: ::core::option::Option<::prost_types::Timestamp>,
2881}
2882impl ::prost::Name for SagaCompensationFailed {
2883    const NAME: &'static str = "SagaCompensationFailed";
2884    const PACKAGE: &'static str = "angzarr";
2885    fn full_name() -> ::prost::alloc::string::String {
2886        "angzarr.SagaCompensationFailed".into()
2887    }
2888    fn type_url() -> ::prost::alloc::string::String {
2889        "/angzarr.SagaCompensationFailed".into()
2890    }
2891}
2892/// Generated client implementations.
2893pub mod saga_service_client {
2894    #![allow(
2895        unused_variables,
2896        dead_code,
2897        missing_docs,
2898        clippy::wildcard_imports,
2899        clippy::let_unit_value
2900    )]
2901    use tonic::codegen::http::Uri;
2902    use tonic::codegen::*;
2903    /// SagaService: stateless translation from source events to commands.
2904    /// Sagas receive only source events — framework handles sequence stamping and delivery.
2905    #[derive(Debug, Clone)]
2906    pub struct SagaServiceClient<T> {
2907        inner: tonic::client::Grpc<T>,
2908    }
2909    impl SagaServiceClient<tonic::transport::Channel> {
2910        /// Attempt to create a new client by connecting to a given endpoint.
2911        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2912        where
2913            D: TryInto<tonic::transport::Endpoint>,
2914            D::Error: Into<StdError>,
2915        {
2916            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2917            Ok(Self::new(conn))
2918        }
2919    }
2920    impl<T> SagaServiceClient<T>
2921    where
2922        T: tonic::client::GrpcService<tonic::body::BoxBody>,
2923        T::Error: Into<StdError>,
2924        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2925        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2926    {
2927        pub fn new(inner: T) -> Self {
2928            let inner = tonic::client::Grpc::new(inner);
2929            Self { inner }
2930        }
2931        pub fn with_origin(inner: T, origin: Uri) -> Self {
2932            let inner = tonic::client::Grpc::with_origin(inner, origin);
2933            Self { inner }
2934        }
2935        pub fn with_interceptor<F>(
2936            inner: T,
2937            interceptor: F,
2938        ) -> SagaServiceClient<InterceptedService<T, F>>
2939        where
2940            F: tonic::service::Interceptor,
2941            T::ResponseBody: Default,
2942            T: tonic::codegen::Service<
2943                http::Request<tonic::body::BoxBody>,
2944                Response = http::Response<
2945                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
2946                >,
2947            >,
2948            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
2949                Into<StdError> + std::marker::Send + std::marker::Sync,
2950        {
2951            SagaServiceClient::new(InterceptedService::new(inner, interceptor))
2952        }
2953        /// Compress requests with the given encoding.
2954        ///
2955        /// This requires the server to support it otherwise it might respond with an
2956        /// error.
2957        #[must_use]
2958        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2959            self.inner = self.inner.send_compressed(encoding);
2960            self
2961        }
2962        /// Enable decompressing responses.
2963        #[must_use]
2964        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2965            self.inner = self.inner.accept_compressed(encoding);
2966            self
2967        }
2968        /// Limits the maximum size of a decoded message.
2969        ///
2970        /// Default: `4MB`
2971        #[must_use]
2972        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2973            self.inner = self.inner.max_decoding_message_size(limit);
2974            self
2975        }
2976        /// Limits the maximum size of an encoded message.
2977        ///
2978        /// Default: `usize::MAX`
2979        #[must_use]
2980        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2981            self.inner = self.inner.max_encoding_message_size(limit);
2982            self
2983        }
2984        /// Translate source events into commands for target domains.
2985        /// Commands use angzarr_deferred — framework stamps explicit sequences on delivery.
2986        pub async fn handle(
2987            &mut self,
2988            request: impl tonic::IntoRequest<super::SagaHandleRequest>,
2989        ) -> std::result::Result<tonic::Response<super::SagaResponse>, tonic::Status> {
2990            self.inner.ready().await.map_err(|e| {
2991                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2992            })?;
2993            let codec = tonic::codec::ProstCodec::default();
2994            let path = http::uri::PathAndQuery::from_static("/angzarr.SagaService/Handle");
2995            let mut req = request.into_request();
2996            req.extensions_mut()
2997                .insert(GrpcMethod::new("angzarr.SagaService", "Handle"));
2998            self.inner.unary(req, path, codec).await
2999        }
3000    }
3001}
3002/// Generated client implementations.
3003pub mod saga_coordinator_service_client {
3004    #![allow(
3005        unused_variables,
3006        dead_code,
3007        missing_docs,
3008        clippy::wildcard_imports,
3009        clippy::let_unit_value
3010    )]
3011    use tonic::codegen::http::Uri;
3012    use tonic::codegen::*;
3013    /// SagaCoordinatorService: orchestrates saga execution.
3014    /// Framework handles sequence stamping and delivery retry.
3015    #[derive(Debug, Clone)]
3016    pub struct SagaCoordinatorServiceClient<T> {
3017        inner: tonic::client::Grpc<T>,
3018    }
3019    impl SagaCoordinatorServiceClient<tonic::transport::Channel> {
3020        /// Attempt to create a new client by connecting to a given endpoint.
3021        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3022        where
3023            D: TryInto<tonic::transport::Endpoint>,
3024            D::Error: Into<StdError>,
3025        {
3026            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3027            Ok(Self::new(conn))
3028        }
3029    }
3030    impl<T> SagaCoordinatorServiceClient<T>
3031    where
3032        T: tonic::client::GrpcService<tonic::body::BoxBody>,
3033        T::Error: Into<StdError>,
3034        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3035        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3036    {
3037        pub fn new(inner: T) -> Self {
3038            let inner = tonic::client::Grpc::new(inner);
3039            Self { inner }
3040        }
3041        pub fn with_origin(inner: T, origin: Uri) -> Self {
3042            let inner = tonic::client::Grpc::with_origin(inner, origin);
3043            Self { inner }
3044        }
3045        pub fn with_interceptor<F>(
3046            inner: T,
3047            interceptor: F,
3048        ) -> SagaCoordinatorServiceClient<InterceptedService<T, F>>
3049        where
3050            F: tonic::service::Interceptor,
3051            T::ResponseBody: Default,
3052            T: tonic::codegen::Service<
3053                http::Request<tonic::body::BoxBody>,
3054                Response = http::Response<
3055                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
3056                >,
3057            >,
3058            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
3059                Into<StdError> + std::marker::Send + std::marker::Sync,
3060        {
3061            SagaCoordinatorServiceClient::new(InterceptedService::new(inner, interceptor))
3062        }
3063        /// Compress requests with the given encoding.
3064        ///
3065        /// This requires the server to support it otherwise it might respond with an
3066        /// error.
3067        #[must_use]
3068        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3069            self.inner = self.inner.send_compressed(encoding);
3070            self
3071        }
3072        /// Enable decompressing responses.
3073        #[must_use]
3074        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3075            self.inner = self.inner.accept_compressed(encoding);
3076            self
3077        }
3078        /// Limits the maximum size of a decoded message.
3079        ///
3080        /// Default: `4MB`
3081        #[must_use]
3082        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3083            self.inner = self.inner.max_decoding_message_size(limit);
3084            self
3085        }
3086        /// Limits the maximum size of an encoded message.
3087        ///
3088        /// Default: `usize::MAX`
3089        #[must_use]
3090        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3091            self.inner = self.inner.max_encoding_message_size(limit);
3092            self
3093        }
3094        /// Execute saga: translate source events → commands, deliver to targets
3095        pub async fn execute(
3096            &mut self,
3097            request: impl tonic::IntoRequest<super::SagaHandleRequest>,
3098        ) -> std::result::Result<tonic::Response<super::SagaResponse>, tonic::Status> {
3099            self.inner.ready().await.map_err(|e| {
3100                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3101            })?;
3102            let codec = tonic::codec::ProstCodec::default();
3103            let path =
3104                http::uri::PathAndQuery::from_static("/angzarr.SagaCoordinatorService/Execute");
3105            let mut req = request.into_request();
3106            req.extensions_mut()
3107                .insert(GrpcMethod::new("angzarr.SagaCoordinatorService", "Execute"));
3108            self.inner.unary(req, path, codec).await
3109        }
3110        /// Speculative execution - returns commands without side effects
3111        pub async fn execute_speculative(
3112            &mut self,
3113            request: impl tonic::IntoRequest<super::SpeculateSagaRequest>,
3114        ) -> std::result::Result<tonic::Response<super::SagaResponse>, tonic::Status> {
3115            self.inner.ready().await.map_err(|e| {
3116                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3117            })?;
3118            let codec = tonic::codec::ProstCodec::default();
3119            let path = http::uri::PathAndQuery::from_static(
3120                "/angzarr.SagaCoordinatorService/ExecuteSpeculative",
3121            );
3122            let mut req = request.into_request();
3123            req.extensions_mut().insert(GrpcMethod::new(
3124                "angzarr.SagaCoordinatorService",
3125                "ExecuteSpeculative",
3126            ));
3127            self.inner.unary(req, path, codec).await
3128        }
3129    }
3130}
3131/// Generated server implementations.
3132pub mod saga_service_server {
3133    #![allow(
3134        unused_variables,
3135        dead_code,
3136        missing_docs,
3137        clippy::wildcard_imports,
3138        clippy::let_unit_value
3139    )]
3140    use tonic::codegen::*;
3141    /// Generated trait containing gRPC methods that should be implemented for use with SagaServiceServer.
3142    #[async_trait]
3143    pub trait SagaService: std::marker::Send + std::marker::Sync + 'static {
3144        /// Translate source events into commands for target domains.
3145        /// Commands use angzarr_deferred — framework stamps explicit sequences on delivery.
3146        async fn handle(
3147            &self,
3148            request: tonic::Request<super::SagaHandleRequest>,
3149        ) -> std::result::Result<tonic::Response<super::SagaResponse>, tonic::Status>;
3150    }
3151    /// SagaService: stateless translation from source events to commands.
3152    /// Sagas receive only source events — framework handles sequence stamping and delivery.
3153    #[derive(Debug)]
3154    pub struct SagaServiceServer<T> {
3155        inner: Arc<T>,
3156        accept_compression_encodings: EnabledCompressionEncodings,
3157        send_compression_encodings: EnabledCompressionEncodings,
3158        max_decoding_message_size: Option<usize>,
3159        max_encoding_message_size: Option<usize>,
3160    }
3161    impl<T> SagaServiceServer<T> {
3162        pub fn new(inner: T) -> Self {
3163            Self::from_arc(Arc::new(inner))
3164        }
3165        pub fn from_arc(inner: Arc<T>) -> Self {
3166            Self {
3167                inner,
3168                accept_compression_encodings: Default::default(),
3169                send_compression_encodings: Default::default(),
3170                max_decoding_message_size: None,
3171                max_encoding_message_size: None,
3172            }
3173        }
3174        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
3175        where
3176            F: tonic::service::Interceptor,
3177        {
3178            InterceptedService::new(Self::new(inner), interceptor)
3179        }
3180        /// Enable decompressing requests with the given encoding.
3181        #[must_use]
3182        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3183            self.accept_compression_encodings.enable(encoding);
3184            self
3185        }
3186        /// Compress responses with the given encoding, if the client supports it.
3187        #[must_use]
3188        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3189            self.send_compression_encodings.enable(encoding);
3190            self
3191        }
3192        /// Limits the maximum size of a decoded message.
3193        ///
3194        /// Default: `4MB`
3195        #[must_use]
3196        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3197            self.max_decoding_message_size = Some(limit);
3198            self
3199        }
3200        /// Limits the maximum size of an encoded message.
3201        ///
3202        /// Default: `usize::MAX`
3203        #[must_use]
3204        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3205            self.max_encoding_message_size = Some(limit);
3206            self
3207        }
3208    }
3209    impl<T, B> tonic::codegen::Service<http::Request<B>> for SagaServiceServer<T>
3210    where
3211        T: SagaService,
3212        B: Body + std::marker::Send + 'static,
3213        B::Error: Into<StdError> + std::marker::Send + 'static,
3214    {
3215        type Response = http::Response<tonic::body::BoxBody>;
3216        type Error = std::convert::Infallible;
3217        type Future = BoxFuture<Self::Response, Self::Error>;
3218        fn poll_ready(
3219            &mut self,
3220            _cx: &mut Context<'_>,
3221        ) -> Poll<std::result::Result<(), Self::Error>> {
3222            Poll::Ready(Ok(()))
3223        }
3224        fn call(&mut self, req: http::Request<B>) -> Self::Future {
3225            match req.uri().path() {
3226                "/angzarr.SagaService/Handle" => {
3227                    #[allow(non_camel_case_types)]
3228                    struct HandleSvc<T: SagaService>(pub Arc<T>);
3229                    impl<T: SagaService> tonic::server::UnaryService<super::SagaHandleRequest> for HandleSvc<T> {
3230                        type Response = super::SagaResponse;
3231                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3232                        fn call(
3233                            &mut self,
3234                            request: tonic::Request<super::SagaHandleRequest>,
3235                        ) -> Self::Future {
3236                            let inner = Arc::clone(&self.0);
3237                            let fut =
3238                                async move { <T as SagaService>::handle(&inner, request).await };
3239                            Box::pin(fut)
3240                        }
3241                    }
3242                    let accept_compression_encodings = self.accept_compression_encodings;
3243                    let send_compression_encodings = self.send_compression_encodings;
3244                    let max_decoding_message_size = self.max_decoding_message_size;
3245                    let max_encoding_message_size = self.max_encoding_message_size;
3246                    let inner = self.inner.clone();
3247                    let fut = async move {
3248                        let method = HandleSvc(inner);
3249                        let codec = tonic::codec::ProstCodec::default();
3250                        let mut grpc = tonic::server::Grpc::new(codec)
3251                            .apply_compression_config(
3252                                accept_compression_encodings,
3253                                send_compression_encodings,
3254                            )
3255                            .apply_max_message_size_config(
3256                                max_decoding_message_size,
3257                                max_encoding_message_size,
3258                            );
3259                        let res = grpc.unary(method, req).await;
3260                        Ok(res)
3261                    };
3262                    Box::pin(fut)
3263                }
3264                _ => Box::pin(async move {
3265                    let mut response = http::Response::new(empty_body());
3266                    let headers = response.headers_mut();
3267                    headers.insert(
3268                        tonic::Status::GRPC_STATUS,
3269                        (tonic::Code::Unimplemented as i32).into(),
3270                    );
3271                    headers.insert(
3272                        http::header::CONTENT_TYPE,
3273                        tonic::metadata::GRPC_CONTENT_TYPE,
3274                    );
3275                    Ok(response)
3276                }),
3277            }
3278        }
3279    }
3280    impl<T> Clone for SagaServiceServer<T> {
3281        fn clone(&self) -> Self {
3282            let inner = self.inner.clone();
3283            Self {
3284                inner,
3285                accept_compression_encodings: self.accept_compression_encodings,
3286                send_compression_encodings: self.send_compression_encodings,
3287                max_decoding_message_size: self.max_decoding_message_size,
3288                max_encoding_message_size: self.max_encoding_message_size,
3289            }
3290        }
3291    }
3292    /// Generated gRPC service name
3293    pub const SERVICE_NAME: &str = "angzarr.SagaService";
3294    impl<T> tonic::server::NamedService for SagaServiceServer<T> {
3295        const NAME: &'static str = SERVICE_NAME;
3296    }
3297}
3298/// Generated server implementations.
3299pub mod saga_coordinator_service_server {
3300    #![allow(
3301        unused_variables,
3302        dead_code,
3303        missing_docs,
3304        clippy::wildcard_imports,
3305        clippy::let_unit_value
3306    )]
3307    use tonic::codegen::*;
3308    /// Generated trait containing gRPC methods that should be implemented for use with SagaCoordinatorServiceServer.
3309    #[async_trait]
3310    pub trait SagaCoordinatorService: std::marker::Send + std::marker::Sync + 'static {
3311        /// Execute saga: translate source events → commands, deliver to targets
3312        async fn execute(
3313            &self,
3314            request: tonic::Request<super::SagaHandleRequest>,
3315        ) -> std::result::Result<tonic::Response<super::SagaResponse>, tonic::Status>;
3316        /// Speculative execution - returns commands without side effects
3317        async fn execute_speculative(
3318            &self,
3319            request: tonic::Request<super::SpeculateSagaRequest>,
3320        ) -> std::result::Result<tonic::Response<super::SagaResponse>, tonic::Status>;
3321    }
3322    /// SagaCoordinatorService: orchestrates saga execution.
3323    /// Framework handles sequence stamping and delivery retry.
3324    #[derive(Debug)]
3325    pub struct SagaCoordinatorServiceServer<T> {
3326        inner: Arc<T>,
3327        accept_compression_encodings: EnabledCompressionEncodings,
3328        send_compression_encodings: EnabledCompressionEncodings,
3329        max_decoding_message_size: Option<usize>,
3330        max_encoding_message_size: Option<usize>,
3331    }
3332    impl<T> SagaCoordinatorServiceServer<T> {
3333        pub fn new(inner: T) -> Self {
3334            Self::from_arc(Arc::new(inner))
3335        }
3336        pub fn from_arc(inner: Arc<T>) -> Self {
3337            Self {
3338                inner,
3339                accept_compression_encodings: Default::default(),
3340                send_compression_encodings: Default::default(),
3341                max_decoding_message_size: None,
3342                max_encoding_message_size: None,
3343            }
3344        }
3345        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
3346        where
3347            F: tonic::service::Interceptor,
3348        {
3349            InterceptedService::new(Self::new(inner), interceptor)
3350        }
3351        /// Enable decompressing requests with the given encoding.
3352        #[must_use]
3353        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3354            self.accept_compression_encodings.enable(encoding);
3355            self
3356        }
3357        /// Compress responses with the given encoding, if the client supports it.
3358        #[must_use]
3359        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3360            self.send_compression_encodings.enable(encoding);
3361            self
3362        }
3363        /// Limits the maximum size of a decoded message.
3364        ///
3365        /// Default: `4MB`
3366        #[must_use]
3367        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3368            self.max_decoding_message_size = Some(limit);
3369            self
3370        }
3371        /// Limits the maximum size of an encoded message.
3372        ///
3373        /// Default: `usize::MAX`
3374        #[must_use]
3375        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3376            self.max_encoding_message_size = Some(limit);
3377            self
3378        }
3379    }
3380    impl<T, B> tonic::codegen::Service<http::Request<B>> for SagaCoordinatorServiceServer<T>
3381    where
3382        T: SagaCoordinatorService,
3383        B: Body + std::marker::Send + 'static,
3384        B::Error: Into<StdError> + std::marker::Send + 'static,
3385    {
3386        type Response = http::Response<tonic::body::BoxBody>;
3387        type Error = std::convert::Infallible;
3388        type Future = BoxFuture<Self::Response, Self::Error>;
3389        fn poll_ready(
3390            &mut self,
3391            _cx: &mut Context<'_>,
3392        ) -> Poll<std::result::Result<(), Self::Error>> {
3393            Poll::Ready(Ok(()))
3394        }
3395        fn call(&mut self, req: http::Request<B>) -> Self::Future {
3396            match req.uri().path() {
3397                "/angzarr.SagaCoordinatorService/Execute" => {
3398                    #[allow(non_camel_case_types)]
3399                    struct ExecuteSvc<T: SagaCoordinatorService>(pub Arc<T>);
3400                    impl<T: SagaCoordinatorService>
3401                        tonic::server::UnaryService<super::SagaHandleRequest> for ExecuteSvc<T>
3402                    {
3403                        type Response = super::SagaResponse;
3404                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3405                        fn call(
3406                            &mut self,
3407                            request: tonic::Request<super::SagaHandleRequest>,
3408                        ) -> Self::Future {
3409                            let inner = Arc::clone(&self.0);
3410                            let fut = async move {
3411                                <T as SagaCoordinatorService>::execute(&inner, request).await
3412                            };
3413                            Box::pin(fut)
3414                        }
3415                    }
3416                    let accept_compression_encodings = self.accept_compression_encodings;
3417                    let send_compression_encodings = self.send_compression_encodings;
3418                    let max_decoding_message_size = self.max_decoding_message_size;
3419                    let max_encoding_message_size = self.max_encoding_message_size;
3420                    let inner = self.inner.clone();
3421                    let fut = async move {
3422                        let method = ExecuteSvc(inner);
3423                        let codec = tonic::codec::ProstCodec::default();
3424                        let mut grpc = tonic::server::Grpc::new(codec)
3425                            .apply_compression_config(
3426                                accept_compression_encodings,
3427                                send_compression_encodings,
3428                            )
3429                            .apply_max_message_size_config(
3430                                max_decoding_message_size,
3431                                max_encoding_message_size,
3432                            );
3433                        let res = grpc.unary(method, req).await;
3434                        Ok(res)
3435                    };
3436                    Box::pin(fut)
3437                }
3438                "/angzarr.SagaCoordinatorService/ExecuteSpeculative" => {
3439                    #[allow(non_camel_case_types)]
3440                    struct ExecuteSpeculativeSvc<T: SagaCoordinatorService>(pub Arc<T>);
3441                    impl<T: SagaCoordinatorService>
3442                        tonic::server::UnaryService<super::SpeculateSagaRequest>
3443                        for ExecuteSpeculativeSvc<T>
3444                    {
3445                        type Response = super::SagaResponse;
3446                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3447                        fn call(
3448                            &mut self,
3449                            request: tonic::Request<super::SpeculateSagaRequest>,
3450                        ) -> Self::Future {
3451                            let inner = Arc::clone(&self.0);
3452                            let fut = async move {
3453                                <T as SagaCoordinatorService>::execute_speculative(&inner, request)
3454                                    .await
3455                            };
3456                            Box::pin(fut)
3457                        }
3458                    }
3459                    let accept_compression_encodings = self.accept_compression_encodings;
3460                    let send_compression_encodings = self.send_compression_encodings;
3461                    let max_decoding_message_size = self.max_decoding_message_size;
3462                    let max_encoding_message_size = self.max_encoding_message_size;
3463                    let inner = self.inner.clone();
3464                    let fut = async move {
3465                        let method = ExecuteSpeculativeSvc(inner);
3466                        let codec = tonic::codec::ProstCodec::default();
3467                        let mut grpc = tonic::server::Grpc::new(codec)
3468                            .apply_compression_config(
3469                                accept_compression_encodings,
3470                                send_compression_encodings,
3471                            )
3472                            .apply_max_message_size_config(
3473                                max_decoding_message_size,
3474                                max_encoding_message_size,
3475                            );
3476                        let res = grpc.unary(method, req).await;
3477                        Ok(res)
3478                    };
3479                    Box::pin(fut)
3480                }
3481                _ => Box::pin(async move {
3482                    let mut response = http::Response::new(empty_body());
3483                    let headers = response.headers_mut();
3484                    headers.insert(
3485                        tonic::Status::GRPC_STATUS,
3486                        (tonic::Code::Unimplemented as i32).into(),
3487                    );
3488                    headers.insert(
3489                        http::header::CONTENT_TYPE,
3490                        tonic::metadata::GRPC_CONTENT_TYPE,
3491                    );
3492                    Ok(response)
3493                }),
3494            }
3495        }
3496    }
3497    impl<T> Clone for SagaCoordinatorServiceServer<T> {
3498        fn clone(&self) -> Self {
3499            let inner = self.inner.clone();
3500            Self {
3501                inner,
3502                accept_compression_encodings: self.accept_compression_encodings,
3503                send_compression_encodings: self.send_compression_encodings,
3504                max_decoding_message_size: self.max_decoding_message_size,
3505                max_encoding_message_size: self.max_encoding_message_size,
3506            }
3507        }
3508    }
3509    /// Generated gRPC service name
3510    pub const SERVICE_NAME: &str = "angzarr.SagaCoordinatorService";
3511    impl<T> tonic::server::NamedService for SagaCoordinatorServiceServer<T> {
3512        const NAME: &'static str = SERVICE_NAME;
3513    }
3514}
3515/// Request for PM coordinator orchestration.
3516/// Used by CASCADE mode to invoke PM synchronously.
3517#[derive(Clone, PartialEq, ::prost::Message)]
3518pub struct ProcessManagerCoordinatorRequest {
3519    /// Triggering events
3520    #[prost(message, optional, tag = "1")]
3521    pub trigger: ::core::option::Option<EventBook>,
3522    /// Propagate for CASCADE recursion
3523    #[prost(enumeration = "SyncMode", tag = "2")]
3524    pub sync_mode: i32,
3525    /// How to handle errors in CASCADE mode
3526    #[prost(enumeration = "CascadeErrorMode", tag = "3")]
3527    pub cascade_error_mode: i32,
3528}
3529impl ::prost::Name for ProcessManagerCoordinatorRequest {
3530    const NAME: &'static str = "ProcessManagerCoordinatorRequest";
3531    const PACKAGE: &'static str = "angzarr";
3532    fn full_name() -> ::prost::alloc::string::String {
3533        "angzarr.ProcessManagerCoordinatorRequest".into()
3534    }
3535    fn type_url() -> ::prost::alloc::string::String {
3536        "/angzarr.ProcessManagerCoordinatorRequest".into()
3537    }
3538}
3539/// Request for speculative PM execution.
3540#[derive(Clone, PartialEq, ::prost::Message)]
3541pub struct SpeculatePmRequest {
3542    #[prost(message, optional, tag = "1")]
3543    pub request: ::core::option::Option<ProcessManagerHandleRequest>,
3544}
3545impl ::prost::Name for SpeculatePmRequest {
3546    const NAME: &'static str = "SpeculatePmRequest";
3547    const PACKAGE: &'static str = "angzarr";
3548    fn full_name() -> ::prost::alloc::string::String {
3549        "angzarr.SpeculatePmRequest".into()
3550    }
3551    fn type_url() -> ::prost::alloc::string::String {
3552        "/angzarr.SpeculatePmRequest".into()
3553    }
3554}
3555/// Phase 1 request: PM declares additional destinations needed.
3556#[derive(Clone, PartialEq, ::prost::Message)]
3557pub struct ProcessManagerPrepareRequest {
3558    /// Full state of triggering domain (by correlation_id).
3559    #[prost(message, optional, tag = "1")]
3560    pub trigger: ::core::option::Option<EventBook>,
3561    /// Current process manager state (by correlation_id). May be empty for new workflow.
3562    #[prost(message, optional, tag = "2")]
3563    pub process_state: ::core::option::Option<EventBook>,
3564}
3565impl ::prost::Name for ProcessManagerPrepareRequest {
3566    const NAME: &'static str = "ProcessManagerPrepareRequest";
3567    const PACKAGE: &'static str = "angzarr";
3568    fn full_name() -> ::prost::alloc::string::String {
3569        "angzarr.ProcessManagerPrepareRequest".into()
3570    }
3571    fn type_url() -> ::prost::alloc::string::String {
3572        "/angzarr.ProcessManagerPrepareRequest".into()
3573    }
3574}
3575/// Phase 1 response: destinations to fetch before Handle.
3576#[derive(Clone, PartialEq, ::prost::Message)]
3577pub struct ProcessManagerPrepareResponse {
3578    /// Additional aggregates needed beyond trigger. Query by correlation_id.
3579    /// Minimize fetches - only declare what's actually needed.
3580    #[prost(message, repeated, tag = "1")]
3581    pub destinations: ::prost::alloc::vec::Vec<Cover>,
3582}
3583impl ::prost::Name for ProcessManagerPrepareResponse {
3584    const NAME: &'static str = "ProcessManagerPrepareResponse";
3585    const PACKAGE: &'static str = "angzarr";
3586    fn full_name() -> ::prost::alloc::string::String {
3587        "angzarr.ProcessManagerPrepareResponse".into()
3588    }
3589    fn type_url() -> ::prost::alloc::string::String {
3590        "/angzarr.ProcessManagerPrepareResponse".into()
3591    }
3592}
3593/// Phase 2 request: full context for PM decision.
3594#[derive(Clone, PartialEq, ::prost::Message)]
3595pub struct ProcessManagerHandleRequest {
3596    /// Full state of triggering domain.
3597    #[prost(message, optional, tag = "1")]
3598    pub trigger: ::core::option::Option<EventBook>,
3599    /// Current process manager state (event-sourced).
3600    #[prost(message, optional, tag = "2")]
3601    pub process_state: ::core::option::Option<EventBook>,
3602    /// Additional destinations fetched per Prepare response.
3603    #[prost(message, repeated, tag = "3")]
3604    pub destinations: ::prost::alloc::vec::Vec<EventBook>,
3605}
3606impl ::prost::Name for ProcessManagerHandleRequest {
3607    const NAME: &'static str = "ProcessManagerHandleRequest";
3608    const PACKAGE: &'static str = "angzarr";
3609    fn full_name() -> ::prost::alloc::string::String {
3610        "angzarr.ProcessManagerHandleRequest".into()
3611    }
3612    fn type_url() -> ::prost::alloc::string::String {
3613        "/angzarr.ProcessManagerHandleRequest".into()
3614    }
3615}
3616/// Phase 2 response: local events, then remote commands and facts.
3617/// Execution order: process_events persisted first, then commands sent, then facts injected.
3618#[derive(Clone, PartialEq, ::prost::Message)]
3619pub struct ProcessManagerHandleResponse {
3620    /// Local: Events for the process manager's own domain (non-duplicative workflow state).
3621    /// These are persisted via AggregateCoordinator to the PM's domain.
3622    #[prost(message, optional, tag = "1")]
3623    pub process_events: ::core::option::Option<EventBook>,
3624    /// Remote: Commands to issue to other aggregates.
3625    #[prost(message, repeated, tag = "2")]
3626    pub commands: ::prost::alloc::vec::Vec<CommandBook>,
3627    /// Remote: Facts to inject to other aggregates.
3628    /// Each EventBook targets a specific aggregate via its Cover.
3629    #[prost(message, repeated, tag = "3")]
3630    pub facts: ::prost::alloc::vec::Vec<EventBook>,
3631}
3632impl ::prost::Name for ProcessManagerHandleResponse {
3633    const NAME: &'static str = "ProcessManagerHandleResponse";
3634    const PACKAGE: &'static str = "angzarr";
3635    fn full_name() -> ::prost::alloc::string::String {
3636        "angzarr.ProcessManagerHandleResponse".into()
3637    }
3638    fn type_url() -> ::prost::alloc::string::String {
3639        "/angzarr.ProcessManagerHandleResponse".into()
3640    }
3641}
3642/// Generated client implementations.
3643pub mod process_manager_service_client {
3644    #![allow(
3645        unused_variables,
3646        dead_code,
3647        missing_docs,
3648        clippy::wildcard_imports,
3649        clippy::let_unit_value
3650    )]
3651    use tonic::codegen::http::Uri;
3652    use tonic::codegen::*;
3653    /// ProcessManagerService: stateful coordinator for long-running workflows across multiple aggregates.
3654    ///
3655    /// WARNING: Only use when saga + queries is insufficient. Consider:
3656    /// - Can a simple saga + destination queries solve this?
3657    /// - Is the "state" you want to track already derivable from existing aggregates?
3658    /// - Are you adding Process Manager because the workflow is genuinely complex?
3659    ///
3660    /// Process Manager is warranted when:
3661    /// - Workflow state is NOT derivable from aggregates (PM owns unique state)
3662    /// - You need to query workflow status independently ("show all pending fulfillments")
3663    /// - Timeout/scheduling logic is complex enough to merit its own aggregate
3664    /// - You must react to events from MULTIPLE domains (saga recommends single domain)
3665    ///
3666    /// Process Manager IS an aggregate with its own domain, events, and state.
3667    /// It reuses all aggregate infrastructure (EventStore, SnapshotStore, AggregateCoordinator).
3668    #[derive(Debug, Clone)]
3669    pub struct ProcessManagerServiceClient<T> {
3670        inner: tonic::client::Grpc<T>,
3671    }
3672    impl ProcessManagerServiceClient<tonic::transport::Channel> {
3673        /// Attempt to create a new client by connecting to a given endpoint.
3674        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3675        where
3676            D: TryInto<tonic::transport::Endpoint>,
3677            D::Error: Into<StdError>,
3678        {
3679            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3680            Ok(Self::new(conn))
3681        }
3682    }
3683    impl<T> ProcessManagerServiceClient<T>
3684    where
3685        T: tonic::client::GrpcService<tonic::body::BoxBody>,
3686        T::Error: Into<StdError>,
3687        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3688        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3689    {
3690        pub fn new(inner: T) -> Self {
3691            let inner = tonic::client::Grpc::new(inner);
3692            Self { inner }
3693        }
3694        pub fn with_origin(inner: T, origin: Uri) -> Self {
3695            let inner = tonic::client::Grpc::with_origin(inner, origin);
3696            Self { inner }
3697        }
3698        pub fn with_interceptor<F>(
3699            inner: T,
3700            interceptor: F,
3701        ) -> ProcessManagerServiceClient<InterceptedService<T, F>>
3702        where
3703            F: tonic::service::Interceptor,
3704            T::ResponseBody: Default,
3705            T: tonic::codegen::Service<
3706                http::Request<tonic::body::BoxBody>,
3707                Response = http::Response<
3708                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
3709                >,
3710            >,
3711            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
3712                Into<StdError> + std::marker::Send + std::marker::Sync,
3713        {
3714            ProcessManagerServiceClient::new(InterceptedService::new(inner, interceptor))
3715        }
3716        /// Compress requests with the given encoding.
3717        ///
3718        /// This requires the server to support it otherwise it might respond with an
3719        /// error.
3720        #[must_use]
3721        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3722            self.inner = self.inner.send_compressed(encoding);
3723            self
3724        }
3725        /// Enable decompressing responses.
3726        #[must_use]
3727        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3728            self.inner = self.inner.accept_compressed(encoding);
3729            self
3730        }
3731        /// Limits the maximum size of a decoded message.
3732        ///
3733        /// Default: `4MB`
3734        #[must_use]
3735        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3736            self.inner = self.inner.max_decoding_message_size(limit);
3737            self
3738        }
3739        /// Limits the maximum size of an encoded message.
3740        ///
3741        /// Default: `usize::MAX`
3742        #[must_use]
3743        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3744            self.inner = self.inner.max_encoding_message_size(limit);
3745            self
3746        }
3747        /// Phase 1: Declare which additional destinations are needed beyond the trigger.
3748        /// PM automatically receives triggering event's domain state.
3749        pub async fn prepare(
3750            &mut self,
3751            request: impl tonic::IntoRequest<super::ProcessManagerPrepareRequest>,
3752        ) -> std::result::Result<tonic::Response<super::ProcessManagerPrepareResponse>, tonic::Status>
3753        {
3754            self.inner.ready().await.map_err(|e| {
3755                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3756            })?;
3757            let codec = tonic::codec::ProstCodec::default();
3758            let path =
3759                http::uri::PathAndQuery::from_static("/angzarr.ProcessManagerService/Prepare");
3760            let mut req = request.into_request();
3761            req.extensions_mut()
3762                .insert(GrpcMethod::new("angzarr.ProcessManagerService", "Prepare"));
3763            self.inner.unary(req, path, codec).await
3764        }
3765        /// Phase 2: Handle with trigger + process state + fetched destinations.
3766        /// Returns commands for other aggregates and events for the PM's own domain.
3767        pub async fn handle(
3768            &mut self,
3769            request: impl tonic::IntoRequest<super::ProcessManagerHandleRequest>,
3770        ) -> std::result::Result<tonic::Response<super::ProcessManagerHandleResponse>, tonic::Status>
3771        {
3772            self.inner.ready().await.map_err(|e| {
3773                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3774            })?;
3775            let codec = tonic::codec::ProstCodec::default();
3776            let path =
3777                http::uri::PathAndQuery::from_static("/angzarr.ProcessManagerService/Handle");
3778            let mut req = request.into_request();
3779            req.extensions_mut()
3780                .insert(GrpcMethod::new("angzarr.ProcessManagerService", "Handle"));
3781            self.inner.unary(req, path, codec).await
3782        }
3783    }
3784}
3785/// Generated client implementations.
3786pub mod process_manager_coordinator_service_client {
3787    #![allow(
3788        unused_variables,
3789        dead_code,
3790        missing_docs,
3791        clippy::wildcard_imports,
3792        clippy::let_unit_value
3793    )]
3794    use tonic::codegen::http::Uri;
3795    use tonic::codegen::*;
3796    /// ProcessManagerCoordinatorService: orchestrates PM execution
3797    #[derive(Debug, Clone)]
3798    pub struct ProcessManagerCoordinatorServiceClient<T> {
3799        inner: tonic::client::Grpc<T>,
3800    }
3801    impl ProcessManagerCoordinatorServiceClient<tonic::transport::Channel> {
3802        /// Attempt to create a new client by connecting to a given endpoint.
3803        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3804        where
3805            D: TryInto<tonic::transport::Endpoint>,
3806            D::Error: Into<StdError>,
3807        {
3808            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3809            Ok(Self::new(conn))
3810        }
3811    }
3812    impl<T> ProcessManagerCoordinatorServiceClient<T>
3813    where
3814        T: tonic::client::GrpcService<tonic::body::BoxBody>,
3815        T::Error: Into<StdError>,
3816        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3817        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3818    {
3819        pub fn new(inner: T) -> Self {
3820            let inner = tonic::client::Grpc::new(inner);
3821            Self { inner }
3822        }
3823        pub fn with_origin(inner: T, origin: Uri) -> Self {
3824            let inner = tonic::client::Grpc::with_origin(inner, origin);
3825            Self { inner }
3826        }
3827        pub fn with_interceptor<F>(
3828            inner: T,
3829            interceptor: F,
3830        ) -> ProcessManagerCoordinatorServiceClient<InterceptedService<T, F>>
3831        where
3832            F: tonic::service::Interceptor,
3833            T::ResponseBody: Default,
3834            T: tonic::codegen::Service<
3835                http::Request<tonic::body::BoxBody>,
3836                Response = http::Response<
3837                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
3838                >,
3839            >,
3840            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
3841                Into<StdError> + std::marker::Send + std::marker::Sync,
3842        {
3843            ProcessManagerCoordinatorServiceClient::new(InterceptedService::new(inner, interceptor))
3844        }
3845        /// Compress requests with the given encoding.
3846        ///
3847        /// This requires the server to support it otherwise it might respond with an
3848        /// error.
3849        #[must_use]
3850        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3851            self.inner = self.inner.send_compressed(encoding);
3852            self
3853        }
3854        /// Enable decompressing responses.
3855        #[must_use]
3856        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3857            self.inner = self.inner.accept_compressed(encoding);
3858            self
3859        }
3860        /// Limits the maximum size of a decoded message.
3861        ///
3862        /// Default: `4MB`
3863        #[must_use]
3864        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3865            self.inner = self.inner.max_decoding_message_size(limit);
3866            self
3867        }
3868        /// Limits the maximum size of an encoded message.
3869        ///
3870        /// Default: `usize::MAX`
3871        #[must_use]
3872        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3873            self.inner = self.inner.max_encoding_message_size(limit);
3874            self
3875        }
3876        /// Full orchestration with sync mode.
3877        /// Used by CASCADE mode to call PMs synchronously.
3878        pub async fn handle(
3879            &mut self,
3880            request: impl tonic::IntoRequest<super::ProcessManagerCoordinatorRequest>,
3881        ) -> std::result::Result<tonic::Response<super::ProcessManagerHandleResponse>, tonic::Status>
3882        {
3883            self.inner.ready().await.map_err(|e| {
3884                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3885            })?;
3886            let codec = tonic::codec::ProstCodec::default();
3887            let path = http::uri::PathAndQuery::from_static(
3888                "/angzarr.ProcessManagerCoordinatorService/Handle",
3889            );
3890            let mut req = request.into_request();
3891            req.extensions_mut().insert(GrpcMethod::new(
3892                "angzarr.ProcessManagerCoordinatorService",
3893                "Handle",
3894            ));
3895            self.inner.unary(req, path, codec).await
3896        }
3897        /// Speculative execution - returns commands and events without persisting
3898        pub async fn handle_speculative(
3899            &mut self,
3900            request: impl tonic::IntoRequest<super::SpeculatePmRequest>,
3901        ) -> std::result::Result<tonic::Response<super::ProcessManagerHandleResponse>, tonic::Status>
3902        {
3903            self.inner.ready().await.map_err(|e| {
3904                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3905            })?;
3906            let codec = tonic::codec::ProstCodec::default();
3907            let path = http::uri::PathAndQuery::from_static(
3908                "/angzarr.ProcessManagerCoordinatorService/HandleSpeculative",
3909            );
3910            let mut req = request.into_request();
3911            req.extensions_mut().insert(GrpcMethod::new(
3912                "angzarr.ProcessManagerCoordinatorService",
3913                "HandleSpeculative",
3914            ));
3915            self.inner.unary(req, path, codec).await
3916        }
3917    }
3918}
3919/// Generated server implementations.
3920pub mod process_manager_service_server {
3921    #![allow(
3922        unused_variables,
3923        dead_code,
3924        missing_docs,
3925        clippy::wildcard_imports,
3926        clippy::let_unit_value
3927    )]
3928    use tonic::codegen::*;
3929    /// Generated trait containing gRPC methods that should be implemented for use with ProcessManagerServiceServer.
3930    #[async_trait]
3931    pub trait ProcessManagerService: std::marker::Send + std::marker::Sync + 'static {
3932        /// Phase 1: Declare which additional destinations are needed beyond the trigger.
3933        /// PM automatically receives triggering event's domain state.
3934        async fn prepare(
3935            &self,
3936            request: tonic::Request<super::ProcessManagerPrepareRequest>,
3937        ) -> std::result::Result<tonic::Response<super::ProcessManagerPrepareResponse>, tonic::Status>;
3938        /// Phase 2: Handle with trigger + process state + fetched destinations.
3939        /// Returns commands for other aggregates and events for the PM's own domain.
3940        async fn handle(
3941            &self,
3942            request: tonic::Request<super::ProcessManagerHandleRequest>,
3943        ) -> std::result::Result<tonic::Response<super::ProcessManagerHandleResponse>, tonic::Status>;
3944    }
3945    /// ProcessManagerService: stateful coordinator for long-running workflows across multiple aggregates.
3946    ///
3947    /// WARNING: Only use when saga + queries is insufficient. Consider:
3948    /// - Can a simple saga + destination queries solve this?
3949    /// - Is the "state" you want to track already derivable from existing aggregates?
3950    /// - Are you adding Process Manager because the workflow is genuinely complex?
3951    ///
3952    /// Process Manager is warranted when:
3953    /// - Workflow state is NOT derivable from aggregates (PM owns unique state)
3954    /// - You need to query workflow status independently ("show all pending fulfillments")
3955    /// - Timeout/scheduling logic is complex enough to merit its own aggregate
3956    /// - You must react to events from MULTIPLE domains (saga recommends single domain)
3957    ///
3958    /// Process Manager IS an aggregate with its own domain, events, and state.
3959    /// It reuses all aggregate infrastructure (EventStore, SnapshotStore, AggregateCoordinator).
3960    #[derive(Debug)]
3961    pub struct ProcessManagerServiceServer<T> {
3962        inner: Arc<T>,
3963        accept_compression_encodings: EnabledCompressionEncodings,
3964        send_compression_encodings: EnabledCompressionEncodings,
3965        max_decoding_message_size: Option<usize>,
3966        max_encoding_message_size: Option<usize>,
3967    }
3968    impl<T> ProcessManagerServiceServer<T> {
3969        pub fn new(inner: T) -> Self {
3970            Self::from_arc(Arc::new(inner))
3971        }
3972        pub fn from_arc(inner: Arc<T>) -> Self {
3973            Self {
3974                inner,
3975                accept_compression_encodings: Default::default(),
3976                send_compression_encodings: Default::default(),
3977                max_decoding_message_size: None,
3978                max_encoding_message_size: None,
3979            }
3980        }
3981        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
3982        where
3983            F: tonic::service::Interceptor,
3984        {
3985            InterceptedService::new(Self::new(inner), interceptor)
3986        }
3987        /// Enable decompressing requests with the given encoding.
3988        #[must_use]
3989        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3990            self.accept_compression_encodings.enable(encoding);
3991            self
3992        }
3993        /// Compress responses with the given encoding, if the client supports it.
3994        #[must_use]
3995        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3996            self.send_compression_encodings.enable(encoding);
3997            self
3998        }
3999        /// Limits the maximum size of a decoded message.
4000        ///
4001        /// Default: `4MB`
4002        #[must_use]
4003        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4004            self.max_decoding_message_size = Some(limit);
4005            self
4006        }
4007        /// Limits the maximum size of an encoded message.
4008        ///
4009        /// Default: `usize::MAX`
4010        #[must_use]
4011        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4012            self.max_encoding_message_size = Some(limit);
4013            self
4014        }
4015    }
4016    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProcessManagerServiceServer<T>
4017    where
4018        T: ProcessManagerService,
4019        B: Body + std::marker::Send + 'static,
4020        B::Error: Into<StdError> + std::marker::Send + 'static,
4021    {
4022        type Response = http::Response<tonic::body::BoxBody>;
4023        type Error = std::convert::Infallible;
4024        type Future = BoxFuture<Self::Response, Self::Error>;
4025        fn poll_ready(
4026            &mut self,
4027            _cx: &mut Context<'_>,
4028        ) -> Poll<std::result::Result<(), Self::Error>> {
4029            Poll::Ready(Ok(()))
4030        }
4031        fn call(&mut self, req: http::Request<B>) -> Self::Future {
4032            match req.uri().path() {
4033                "/angzarr.ProcessManagerService/Prepare" => {
4034                    #[allow(non_camel_case_types)]
4035                    struct PrepareSvc<T: ProcessManagerService>(pub Arc<T>);
4036                    impl<T: ProcessManagerService>
4037                        tonic::server::UnaryService<super::ProcessManagerPrepareRequest>
4038                        for PrepareSvc<T>
4039                    {
4040                        type Response = super::ProcessManagerPrepareResponse;
4041                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4042                        fn call(
4043                            &mut self,
4044                            request: tonic::Request<super::ProcessManagerPrepareRequest>,
4045                        ) -> Self::Future {
4046                            let inner = Arc::clone(&self.0);
4047                            let fut = async move {
4048                                <T as ProcessManagerService>::prepare(&inner, request).await
4049                            };
4050                            Box::pin(fut)
4051                        }
4052                    }
4053                    let accept_compression_encodings = self.accept_compression_encodings;
4054                    let send_compression_encodings = self.send_compression_encodings;
4055                    let max_decoding_message_size = self.max_decoding_message_size;
4056                    let max_encoding_message_size = self.max_encoding_message_size;
4057                    let inner = self.inner.clone();
4058                    let fut = async move {
4059                        let method = PrepareSvc(inner);
4060                        let codec = tonic::codec::ProstCodec::default();
4061                        let mut grpc = tonic::server::Grpc::new(codec)
4062                            .apply_compression_config(
4063                                accept_compression_encodings,
4064                                send_compression_encodings,
4065                            )
4066                            .apply_max_message_size_config(
4067                                max_decoding_message_size,
4068                                max_encoding_message_size,
4069                            );
4070                        let res = grpc.unary(method, req).await;
4071                        Ok(res)
4072                    };
4073                    Box::pin(fut)
4074                }
4075                "/angzarr.ProcessManagerService/Handle" => {
4076                    #[allow(non_camel_case_types)]
4077                    struct HandleSvc<T: ProcessManagerService>(pub Arc<T>);
4078                    impl<T: ProcessManagerService>
4079                        tonic::server::UnaryService<super::ProcessManagerHandleRequest>
4080                        for HandleSvc<T>
4081                    {
4082                        type Response = super::ProcessManagerHandleResponse;
4083                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4084                        fn call(
4085                            &mut self,
4086                            request: tonic::Request<super::ProcessManagerHandleRequest>,
4087                        ) -> Self::Future {
4088                            let inner = Arc::clone(&self.0);
4089                            let fut = async move {
4090                                <T as ProcessManagerService>::handle(&inner, request).await
4091                            };
4092                            Box::pin(fut)
4093                        }
4094                    }
4095                    let accept_compression_encodings = self.accept_compression_encodings;
4096                    let send_compression_encodings = self.send_compression_encodings;
4097                    let max_decoding_message_size = self.max_decoding_message_size;
4098                    let max_encoding_message_size = self.max_encoding_message_size;
4099                    let inner = self.inner.clone();
4100                    let fut = async move {
4101                        let method = HandleSvc(inner);
4102                        let codec = tonic::codec::ProstCodec::default();
4103                        let mut grpc = tonic::server::Grpc::new(codec)
4104                            .apply_compression_config(
4105                                accept_compression_encodings,
4106                                send_compression_encodings,
4107                            )
4108                            .apply_max_message_size_config(
4109                                max_decoding_message_size,
4110                                max_encoding_message_size,
4111                            );
4112                        let res = grpc.unary(method, req).await;
4113                        Ok(res)
4114                    };
4115                    Box::pin(fut)
4116                }
4117                _ => Box::pin(async move {
4118                    let mut response = http::Response::new(empty_body());
4119                    let headers = response.headers_mut();
4120                    headers.insert(
4121                        tonic::Status::GRPC_STATUS,
4122                        (tonic::Code::Unimplemented as i32).into(),
4123                    );
4124                    headers.insert(
4125                        http::header::CONTENT_TYPE,
4126                        tonic::metadata::GRPC_CONTENT_TYPE,
4127                    );
4128                    Ok(response)
4129                }),
4130            }
4131        }
4132    }
4133    impl<T> Clone for ProcessManagerServiceServer<T> {
4134        fn clone(&self) -> Self {
4135            let inner = self.inner.clone();
4136            Self {
4137                inner,
4138                accept_compression_encodings: self.accept_compression_encodings,
4139                send_compression_encodings: self.send_compression_encodings,
4140                max_decoding_message_size: self.max_decoding_message_size,
4141                max_encoding_message_size: self.max_encoding_message_size,
4142            }
4143        }
4144    }
4145    /// Generated gRPC service name
4146    pub const SERVICE_NAME: &str = "angzarr.ProcessManagerService";
4147    impl<T> tonic::server::NamedService for ProcessManagerServiceServer<T> {
4148        const NAME: &'static str = SERVICE_NAME;
4149    }
4150}
4151/// Generated server implementations.
4152pub mod process_manager_coordinator_service_server {
4153    #![allow(
4154        unused_variables,
4155        dead_code,
4156        missing_docs,
4157        clippy::wildcard_imports,
4158        clippy::let_unit_value
4159    )]
4160    use tonic::codegen::*;
4161    /// Generated trait containing gRPC methods that should be implemented for use with ProcessManagerCoordinatorServiceServer.
4162    #[async_trait]
4163    pub trait ProcessManagerCoordinatorService:
4164        std::marker::Send + std::marker::Sync + 'static
4165    {
4166        /// Full orchestration with sync mode.
4167        /// Used by CASCADE mode to call PMs synchronously.
4168        async fn handle(
4169            &self,
4170            request: tonic::Request<super::ProcessManagerCoordinatorRequest>,
4171        ) -> std::result::Result<tonic::Response<super::ProcessManagerHandleResponse>, tonic::Status>;
4172        /// Speculative execution - returns commands and events without persisting
4173        async fn handle_speculative(
4174            &self,
4175            request: tonic::Request<super::SpeculatePmRequest>,
4176        ) -> std::result::Result<tonic::Response<super::ProcessManagerHandleResponse>, tonic::Status>;
4177    }
4178    /// ProcessManagerCoordinatorService: orchestrates PM execution
4179    #[derive(Debug)]
4180    pub struct ProcessManagerCoordinatorServiceServer<T> {
4181        inner: Arc<T>,
4182        accept_compression_encodings: EnabledCompressionEncodings,
4183        send_compression_encodings: EnabledCompressionEncodings,
4184        max_decoding_message_size: Option<usize>,
4185        max_encoding_message_size: Option<usize>,
4186    }
4187    impl<T> ProcessManagerCoordinatorServiceServer<T> {
4188        pub fn new(inner: T) -> Self {
4189            Self::from_arc(Arc::new(inner))
4190        }
4191        pub fn from_arc(inner: Arc<T>) -> Self {
4192            Self {
4193                inner,
4194                accept_compression_encodings: Default::default(),
4195                send_compression_encodings: Default::default(),
4196                max_decoding_message_size: None,
4197                max_encoding_message_size: None,
4198            }
4199        }
4200        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
4201        where
4202            F: tonic::service::Interceptor,
4203        {
4204            InterceptedService::new(Self::new(inner), interceptor)
4205        }
4206        /// Enable decompressing requests with the given encoding.
4207        #[must_use]
4208        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
4209            self.accept_compression_encodings.enable(encoding);
4210            self
4211        }
4212        /// Compress responses with the given encoding, if the client supports it.
4213        #[must_use]
4214        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
4215            self.send_compression_encodings.enable(encoding);
4216            self
4217        }
4218        /// Limits the maximum size of a decoded message.
4219        ///
4220        /// Default: `4MB`
4221        #[must_use]
4222        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4223            self.max_decoding_message_size = Some(limit);
4224            self
4225        }
4226        /// Limits the maximum size of an encoded message.
4227        ///
4228        /// Default: `usize::MAX`
4229        #[must_use]
4230        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4231            self.max_encoding_message_size = Some(limit);
4232            self
4233        }
4234    }
4235    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProcessManagerCoordinatorServiceServer<T>
4236    where
4237        T: ProcessManagerCoordinatorService,
4238        B: Body + std::marker::Send + 'static,
4239        B::Error: Into<StdError> + std::marker::Send + 'static,
4240    {
4241        type Response = http::Response<tonic::body::BoxBody>;
4242        type Error = std::convert::Infallible;
4243        type Future = BoxFuture<Self::Response, Self::Error>;
4244        fn poll_ready(
4245            &mut self,
4246            _cx: &mut Context<'_>,
4247        ) -> Poll<std::result::Result<(), Self::Error>> {
4248            Poll::Ready(Ok(()))
4249        }
4250        fn call(&mut self, req: http::Request<B>) -> Self::Future {
4251            match req.uri().path() {
4252                "/angzarr.ProcessManagerCoordinatorService/Handle" => {
4253                    #[allow(non_camel_case_types)]
4254                    struct HandleSvc<T: ProcessManagerCoordinatorService>(pub Arc<T>);
4255                    impl<T: ProcessManagerCoordinatorService>
4256                        tonic::server::UnaryService<super::ProcessManagerCoordinatorRequest>
4257                        for HandleSvc<T>
4258                    {
4259                        type Response = super::ProcessManagerHandleResponse;
4260                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4261                        fn call(
4262                            &mut self,
4263                            request: tonic::Request<super::ProcessManagerCoordinatorRequest>,
4264                        ) -> Self::Future {
4265                            let inner = Arc::clone(&self.0);
4266                            let fut = async move {
4267                                <T as ProcessManagerCoordinatorService>::handle(&inner, request)
4268                                    .await
4269                            };
4270                            Box::pin(fut)
4271                        }
4272                    }
4273                    let accept_compression_encodings = self.accept_compression_encodings;
4274                    let send_compression_encodings = self.send_compression_encodings;
4275                    let max_decoding_message_size = self.max_decoding_message_size;
4276                    let max_encoding_message_size = self.max_encoding_message_size;
4277                    let inner = self.inner.clone();
4278                    let fut = async move {
4279                        let method = HandleSvc(inner);
4280                        let codec = tonic::codec::ProstCodec::default();
4281                        let mut grpc = tonic::server::Grpc::new(codec)
4282                            .apply_compression_config(
4283                                accept_compression_encodings,
4284                                send_compression_encodings,
4285                            )
4286                            .apply_max_message_size_config(
4287                                max_decoding_message_size,
4288                                max_encoding_message_size,
4289                            );
4290                        let res = grpc.unary(method, req).await;
4291                        Ok(res)
4292                    };
4293                    Box::pin(fut)
4294                }
4295                "/angzarr.ProcessManagerCoordinatorService/HandleSpeculative" => {
4296                    #[allow(non_camel_case_types)]
4297                    struct HandleSpeculativeSvc<T: ProcessManagerCoordinatorService>(pub Arc<T>);
4298                    impl<T: ProcessManagerCoordinatorService>
4299                        tonic::server::UnaryService<super::SpeculatePmRequest>
4300                        for HandleSpeculativeSvc<T>
4301                    {
4302                        type Response = super::ProcessManagerHandleResponse;
4303                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4304                        fn call(
4305                            &mut self,
4306                            request: tonic::Request<super::SpeculatePmRequest>,
4307                        ) -> Self::Future {
4308                            let inner = Arc::clone(&self.0);
4309                            let fut = async move {
4310                                <T as ProcessManagerCoordinatorService>::handle_speculative(
4311                                    &inner, request,
4312                                )
4313                                .await
4314                            };
4315                            Box::pin(fut)
4316                        }
4317                    }
4318                    let accept_compression_encodings = self.accept_compression_encodings;
4319                    let send_compression_encodings = self.send_compression_encodings;
4320                    let max_decoding_message_size = self.max_decoding_message_size;
4321                    let max_encoding_message_size = self.max_encoding_message_size;
4322                    let inner = self.inner.clone();
4323                    let fut = async move {
4324                        let method = HandleSpeculativeSvc(inner);
4325                        let codec = tonic::codec::ProstCodec::default();
4326                        let mut grpc = tonic::server::Grpc::new(codec)
4327                            .apply_compression_config(
4328                                accept_compression_encodings,
4329                                send_compression_encodings,
4330                            )
4331                            .apply_max_message_size_config(
4332                                max_decoding_message_size,
4333                                max_encoding_message_size,
4334                            );
4335                        let res = grpc.unary(method, req).await;
4336                        Ok(res)
4337                    };
4338                    Box::pin(fut)
4339                }
4340                _ => Box::pin(async move {
4341                    let mut response = http::Response::new(empty_body());
4342                    let headers = response.headers_mut();
4343                    headers.insert(
4344                        tonic::Status::GRPC_STATUS,
4345                        (tonic::Code::Unimplemented as i32).into(),
4346                    );
4347                    headers.insert(
4348                        http::header::CONTENT_TYPE,
4349                        tonic::metadata::GRPC_CONTENT_TYPE,
4350                    );
4351                    Ok(response)
4352                }),
4353            }
4354        }
4355    }
4356    impl<T> Clone for ProcessManagerCoordinatorServiceServer<T> {
4357        fn clone(&self) -> Self {
4358            let inner = self.inner.clone();
4359            Self {
4360                inner,
4361                accept_compression_encodings: self.accept_compression_encodings,
4362                send_compression_encodings: self.send_compression_encodings,
4363                max_decoding_message_size: self.max_decoding_message_size,
4364                max_encoding_message_size: self.max_encoding_message_size,
4365            }
4366        }
4367    }
4368    /// Generated gRPC service name
4369    pub const SERVICE_NAME: &str = "angzarr.ProcessManagerCoordinatorService";
4370    impl<T> tonic::server::NamedService for ProcessManagerCoordinatorServiceServer<T> {
4371        const NAME: &'static str = SERVICE_NAME;
4372    }
4373}
4374/// Generated client implementations.
4375pub mod event_query_service_client {
4376    #![allow(
4377        unused_variables,
4378        dead_code,
4379        missing_docs,
4380        clippy::wildcard_imports,
4381        clippy::let_unit_value
4382    )]
4383    use tonic::codegen::http::Uri;
4384    use tonic::codegen::*;
4385    /// EventQueryService: query interface for retrieving events
4386    #[derive(Debug, Clone)]
4387    pub struct EventQueryServiceClient<T> {
4388        inner: tonic::client::Grpc<T>,
4389    }
4390    impl EventQueryServiceClient<tonic::transport::Channel> {
4391        /// Attempt to create a new client by connecting to a given endpoint.
4392        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
4393        where
4394            D: TryInto<tonic::transport::Endpoint>,
4395            D::Error: Into<StdError>,
4396        {
4397            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
4398            Ok(Self::new(conn))
4399        }
4400    }
4401    impl<T> EventQueryServiceClient<T>
4402    where
4403        T: tonic::client::GrpcService<tonic::body::BoxBody>,
4404        T::Error: Into<StdError>,
4405        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
4406        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
4407    {
4408        pub fn new(inner: T) -> Self {
4409            let inner = tonic::client::Grpc::new(inner);
4410            Self { inner }
4411        }
4412        pub fn with_origin(inner: T, origin: Uri) -> Self {
4413            let inner = tonic::client::Grpc::with_origin(inner, origin);
4414            Self { inner }
4415        }
4416        pub fn with_interceptor<F>(
4417            inner: T,
4418            interceptor: F,
4419        ) -> EventQueryServiceClient<InterceptedService<T, F>>
4420        where
4421            F: tonic::service::Interceptor,
4422            T::ResponseBody: Default,
4423            T: tonic::codegen::Service<
4424                http::Request<tonic::body::BoxBody>,
4425                Response = http::Response<
4426                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
4427                >,
4428            >,
4429            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
4430                Into<StdError> + std::marker::Send + std::marker::Sync,
4431        {
4432            EventQueryServiceClient::new(InterceptedService::new(inner, interceptor))
4433        }
4434        /// Compress requests with the given encoding.
4435        ///
4436        /// This requires the server to support it otherwise it might respond with an
4437        /// error.
4438        #[must_use]
4439        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
4440            self.inner = self.inner.send_compressed(encoding);
4441            self
4442        }
4443        /// Enable decompressing responses.
4444        #[must_use]
4445        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
4446            self.inner = self.inner.accept_compressed(encoding);
4447            self
4448        }
4449        /// Limits the maximum size of a decoded message.
4450        ///
4451        /// Default: `4MB`
4452        #[must_use]
4453        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4454            self.inner = self.inner.max_decoding_message_size(limit);
4455            self
4456        }
4457        /// Limits the maximum size of an encoded message.
4458        ///
4459        /// Default: `usize::MAX`
4460        #[must_use]
4461        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4462            self.inner = self.inner.max_encoding_message_size(limit);
4463            self
4464        }
4465        /// Get a single EventBook (unary) - use for explicit queries with gRPC tooling
4466        pub async fn get_event_book(
4467            &mut self,
4468            request: impl tonic::IntoRequest<super::Query>,
4469        ) -> std::result::Result<tonic::Response<super::EventBook>, tonic::Status> {
4470            self.inner.ready().await.map_err(|e| {
4471                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4472            })?;
4473            let codec = tonic::codec::ProstCodec::default();
4474            let path =
4475                http::uri::PathAndQuery::from_static("/angzarr.EventQueryService/GetEventBook");
4476            let mut req = request.into_request();
4477            req.extensions_mut()
4478                .insert(GrpcMethod::new("angzarr.EventQueryService", "GetEventBook"));
4479            self.inner.unary(req, path, codec).await
4480        }
4481        /// Stream EventBooks matching query - use for bulk retrieval (SSE)
4482        pub async fn get_events(
4483            &mut self,
4484            request: impl tonic::IntoRequest<super::Query>,
4485        ) -> std::result::Result<
4486            tonic::Response<tonic::codec::Streaming<super::EventBook>>,
4487            tonic::Status,
4488        > {
4489            self.inner.ready().await.map_err(|e| {
4490                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4491            })?;
4492            let codec = tonic::codec::ProstCodec::default();
4493            let path = http::uri::PathAndQuery::from_static("/angzarr.EventQueryService/GetEvents");
4494            let mut req = request.into_request();
4495            req.extensions_mut()
4496                .insert(GrpcMethod::new("angzarr.EventQueryService", "GetEvents"));
4497            self.inner.server_streaming(req, path, codec).await
4498        }
4499        /// Bidirectional sync - not exposed via REST (use gRPC directly)
4500        pub async fn synchronize(
4501            &mut self,
4502            request: impl tonic::IntoStreamingRequest<Message = super::Query>,
4503        ) -> std::result::Result<
4504            tonic::Response<tonic::codec::Streaming<super::EventBook>>,
4505            tonic::Status,
4506        > {
4507            self.inner.ready().await.map_err(|e| {
4508                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4509            })?;
4510            let codec = tonic::codec::ProstCodec::default();
4511            let path =
4512                http::uri::PathAndQuery::from_static("/angzarr.EventQueryService/Synchronize");
4513            let mut req = request.into_streaming_request();
4514            req.extensions_mut()
4515                .insert(GrpcMethod::new("angzarr.EventQueryService", "Synchronize"));
4516            self.inner.streaming(req, path, codec).await
4517        }
4518        /// List all aggregate roots (SSE)
4519        pub async fn get_aggregate_roots(
4520            &mut self,
4521            request: impl tonic::IntoRequest<()>,
4522        ) -> std::result::Result<
4523            tonic::Response<tonic::codec::Streaming<super::AggregateRoot>>,
4524            tonic::Status,
4525        > {
4526            self.inner.ready().await.map_err(|e| {
4527                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4528            })?;
4529            let codec = tonic::codec::ProstCodec::default();
4530            let path = http::uri::PathAndQuery::from_static(
4531                "/angzarr.EventQueryService/GetAggregateRoots",
4532            );
4533            let mut req = request.into_request();
4534            req.extensions_mut().insert(GrpcMethod::new(
4535                "angzarr.EventQueryService",
4536                "GetAggregateRoots",
4537            ));
4538            self.inner.server_streaming(req, path, codec).await
4539        }
4540    }
4541}
4542/// Generated server implementations.
4543pub mod event_query_service_server {
4544    #![allow(
4545        unused_variables,
4546        dead_code,
4547        missing_docs,
4548        clippy::wildcard_imports,
4549        clippy::let_unit_value
4550    )]
4551    use tonic::codegen::*;
4552    /// Generated trait containing gRPC methods that should be implemented for use with EventQueryServiceServer.
4553    #[async_trait]
4554    pub trait EventQueryService: std::marker::Send + std::marker::Sync + 'static {
4555        /// Get a single EventBook (unary) - use for explicit queries with gRPC tooling
4556        async fn get_event_book(
4557            &self,
4558            request: tonic::Request<super::Query>,
4559        ) -> std::result::Result<tonic::Response<super::EventBook>, tonic::Status>;
4560        /// Server streaming response type for the GetEvents method.
4561        type GetEventsStream: tonic::codegen::tokio_stream::Stream<
4562                Item = std::result::Result<super::EventBook, tonic::Status>,
4563            > + std::marker::Send
4564            + 'static;
4565        /// Stream EventBooks matching query - use for bulk retrieval (SSE)
4566        async fn get_events(
4567            &self,
4568            request: tonic::Request<super::Query>,
4569        ) -> std::result::Result<tonic::Response<Self::GetEventsStream>, tonic::Status>;
4570        /// Server streaming response type for the Synchronize method.
4571        type SynchronizeStream: tonic::codegen::tokio_stream::Stream<
4572                Item = std::result::Result<super::EventBook, tonic::Status>,
4573            > + std::marker::Send
4574            + 'static;
4575        /// Bidirectional sync - not exposed via REST (use gRPC directly)
4576        async fn synchronize(
4577            &self,
4578            request: tonic::Request<tonic::Streaming<super::Query>>,
4579        ) -> std::result::Result<tonic::Response<Self::SynchronizeStream>, tonic::Status>;
4580        /// Server streaming response type for the GetAggregateRoots method.
4581        type GetAggregateRootsStream: tonic::codegen::tokio_stream::Stream<
4582                Item = std::result::Result<super::AggregateRoot, tonic::Status>,
4583            > + std::marker::Send
4584            + 'static;
4585        /// List all aggregate roots (SSE)
4586        async fn get_aggregate_roots(
4587            &self,
4588            request: tonic::Request<()>,
4589        ) -> std::result::Result<tonic::Response<Self::GetAggregateRootsStream>, tonic::Status>;
4590    }
4591    /// EventQueryService: query interface for retrieving events
4592    #[derive(Debug)]
4593    pub struct EventQueryServiceServer<T> {
4594        inner: Arc<T>,
4595        accept_compression_encodings: EnabledCompressionEncodings,
4596        send_compression_encodings: EnabledCompressionEncodings,
4597        max_decoding_message_size: Option<usize>,
4598        max_encoding_message_size: Option<usize>,
4599    }
4600    impl<T> EventQueryServiceServer<T> {
4601        pub fn new(inner: T) -> Self {
4602            Self::from_arc(Arc::new(inner))
4603        }
4604        pub fn from_arc(inner: Arc<T>) -> Self {
4605            Self {
4606                inner,
4607                accept_compression_encodings: Default::default(),
4608                send_compression_encodings: Default::default(),
4609                max_decoding_message_size: None,
4610                max_encoding_message_size: None,
4611            }
4612        }
4613        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
4614        where
4615            F: tonic::service::Interceptor,
4616        {
4617            InterceptedService::new(Self::new(inner), interceptor)
4618        }
4619        /// Enable decompressing requests with the given encoding.
4620        #[must_use]
4621        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
4622            self.accept_compression_encodings.enable(encoding);
4623            self
4624        }
4625        /// Compress responses with the given encoding, if the client supports it.
4626        #[must_use]
4627        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
4628            self.send_compression_encodings.enable(encoding);
4629            self
4630        }
4631        /// Limits the maximum size of a decoded message.
4632        ///
4633        /// Default: `4MB`
4634        #[must_use]
4635        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4636            self.max_decoding_message_size = Some(limit);
4637            self
4638        }
4639        /// Limits the maximum size of an encoded message.
4640        ///
4641        /// Default: `usize::MAX`
4642        #[must_use]
4643        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4644            self.max_encoding_message_size = Some(limit);
4645            self
4646        }
4647    }
4648    impl<T, B> tonic::codegen::Service<http::Request<B>> for EventQueryServiceServer<T>
4649    where
4650        T: EventQueryService,
4651        B: Body + std::marker::Send + 'static,
4652        B::Error: Into<StdError> + std::marker::Send + 'static,
4653    {
4654        type Response = http::Response<tonic::body::BoxBody>;
4655        type Error = std::convert::Infallible;
4656        type Future = BoxFuture<Self::Response, Self::Error>;
4657        fn poll_ready(
4658            &mut self,
4659            _cx: &mut Context<'_>,
4660        ) -> Poll<std::result::Result<(), Self::Error>> {
4661            Poll::Ready(Ok(()))
4662        }
4663        fn call(&mut self, req: http::Request<B>) -> Self::Future {
4664            match req.uri().path() {
4665                "/angzarr.EventQueryService/GetEventBook" => {
4666                    #[allow(non_camel_case_types)]
4667                    struct GetEventBookSvc<T: EventQueryService>(pub Arc<T>);
4668                    impl<T: EventQueryService> tonic::server::UnaryService<super::Query> for GetEventBookSvc<T> {
4669                        type Response = super::EventBook;
4670                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4671                        fn call(&mut self, request: tonic::Request<super::Query>) -> Self::Future {
4672                            let inner = Arc::clone(&self.0);
4673                            let fut = async move {
4674                                <T as EventQueryService>::get_event_book(&inner, request).await
4675                            };
4676                            Box::pin(fut)
4677                        }
4678                    }
4679                    let accept_compression_encodings = self.accept_compression_encodings;
4680                    let send_compression_encodings = self.send_compression_encodings;
4681                    let max_decoding_message_size = self.max_decoding_message_size;
4682                    let max_encoding_message_size = self.max_encoding_message_size;
4683                    let inner = self.inner.clone();
4684                    let fut = async move {
4685                        let method = GetEventBookSvc(inner);
4686                        let codec = tonic::codec::ProstCodec::default();
4687                        let mut grpc = tonic::server::Grpc::new(codec)
4688                            .apply_compression_config(
4689                                accept_compression_encodings,
4690                                send_compression_encodings,
4691                            )
4692                            .apply_max_message_size_config(
4693                                max_decoding_message_size,
4694                                max_encoding_message_size,
4695                            );
4696                        let res = grpc.unary(method, req).await;
4697                        Ok(res)
4698                    };
4699                    Box::pin(fut)
4700                }
4701                "/angzarr.EventQueryService/GetEvents" => {
4702                    #[allow(non_camel_case_types)]
4703                    struct GetEventsSvc<T: EventQueryService>(pub Arc<T>);
4704                    impl<T: EventQueryService> tonic::server::ServerStreamingService<super::Query> for GetEventsSvc<T> {
4705                        type Response = super::EventBook;
4706                        type ResponseStream = T::GetEventsStream;
4707                        type Future =
4708                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
4709                        fn call(&mut self, request: tonic::Request<super::Query>) -> Self::Future {
4710                            let inner = Arc::clone(&self.0);
4711                            let fut = async move {
4712                                <T as EventQueryService>::get_events(&inner, request).await
4713                            };
4714                            Box::pin(fut)
4715                        }
4716                    }
4717                    let accept_compression_encodings = self.accept_compression_encodings;
4718                    let send_compression_encodings = self.send_compression_encodings;
4719                    let max_decoding_message_size = self.max_decoding_message_size;
4720                    let max_encoding_message_size = self.max_encoding_message_size;
4721                    let inner = self.inner.clone();
4722                    let fut = async move {
4723                        let method = GetEventsSvc(inner);
4724                        let codec = tonic::codec::ProstCodec::default();
4725                        let mut grpc = tonic::server::Grpc::new(codec)
4726                            .apply_compression_config(
4727                                accept_compression_encodings,
4728                                send_compression_encodings,
4729                            )
4730                            .apply_max_message_size_config(
4731                                max_decoding_message_size,
4732                                max_encoding_message_size,
4733                            );
4734                        let res = grpc.server_streaming(method, req).await;
4735                        Ok(res)
4736                    };
4737                    Box::pin(fut)
4738                }
4739                "/angzarr.EventQueryService/Synchronize" => {
4740                    #[allow(non_camel_case_types)]
4741                    struct SynchronizeSvc<T: EventQueryService>(pub Arc<T>);
4742                    impl<T: EventQueryService> tonic::server::StreamingService<super::Query> for SynchronizeSvc<T> {
4743                        type Response = super::EventBook;
4744                        type ResponseStream = T::SynchronizeStream;
4745                        type Future =
4746                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
4747                        fn call(
4748                            &mut self,
4749                            request: tonic::Request<tonic::Streaming<super::Query>>,
4750                        ) -> Self::Future {
4751                            let inner = Arc::clone(&self.0);
4752                            let fut = async move {
4753                                <T as EventQueryService>::synchronize(&inner, request).await
4754                            };
4755                            Box::pin(fut)
4756                        }
4757                    }
4758                    let accept_compression_encodings = self.accept_compression_encodings;
4759                    let send_compression_encodings = self.send_compression_encodings;
4760                    let max_decoding_message_size = self.max_decoding_message_size;
4761                    let max_encoding_message_size = self.max_encoding_message_size;
4762                    let inner = self.inner.clone();
4763                    let fut = async move {
4764                        let method = SynchronizeSvc(inner);
4765                        let codec = tonic::codec::ProstCodec::default();
4766                        let mut grpc = tonic::server::Grpc::new(codec)
4767                            .apply_compression_config(
4768                                accept_compression_encodings,
4769                                send_compression_encodings,
4770                            )
4771                            .apply_max_message_size_config(
4772                                max_decoding_message_size,
4773                                max_encoding_message_size,
4774                            );
4775                        let res = grpc.streaming(method, req).await;
4776                        Ok(res)
4777                    };
4778                    Box::pin(fut)
4779                }
4780                "/angzarr.EventQueryService/GetAggregateRoots" => {
4781                    #[allow(non_camel_case_types)]
4782                    struct GetAggregateRootsSvc<T: EventQueryService>(pub Arc<T>);
4783                    impl<T: EventQueryService> tonic::server::ServerStreamingService<()> for GetAggregateRootsSvc<T> {
4784                        type Response = super::AggregateRoot;
4785                        type ResponseStream = T::GetAggregateRootsStream;
4786                        type Future =
4787                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
4788                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
4789                            let inner = Arc::clone(&self.0);
4790                            let fut = async move {
4791                                <T as EventQueryService>::get_aggregate_roots(&inner, request).await
4792                            };
4793                            Box::pin(fut)
4794                        }
4795                    }
4796                    let accept_compression_encodings = self.accept_compression_encodings;
4797                    let send_compression_encodings = self.send_compression_encodings;
4798                    let max_decoding_message_size = self.max_decoding_message_size;
4799                    let max_encoding_message_size = self.max_encoding_message_size;
4800                    let inner = self.inner.clone();
4801                    let fut = async move {
4802                        let method = GetAggregateRootsSvc(inner);
4803                        let codec = tonic::codec::ProstCodec::default();
4804                        let mut grpc = tonic::server::Grpc::new(codec)
4805                            .apply_compression_config(
4806                                accept_compression_encodings,
4807                                send_compression_encodings,
4808                            )
4809                            .apply_max_message_size_config(
4810                                max_decoding_message_size,
4811                                max_encoding_message_size,
4812                            );
4813                        let res = grpc.server_streaming(method, req).await;
4814                        Ok(res)
4815                    };
4816                    Box::pin(fut)
4817                }
4818                _ => Box::pin(async move {
4819                    let mut response = http::Response::new(empty_body());
4820                    let headers = response.headers_mut();
4821                    headers.insert(
4822                        tonic::Status::GRPC_STATUS,
4823                        (tonic::Code::Unimplemented as i32).into(),
4824                    );
4825                    headers.insert(
4826                        http::header::CONTENT_TYPE,
4827                        tonic::metadata::GRPC_CONTENT_TYPE,
4828                    );
4829                    Ok(response)
4830                }),
4831            }
4832        }
4833    }
4834    impl<T> Clone for EventQueryServiceServer<T> {
4835        fn clone(&self) -> Self {
4836            let inner = self.inner.clone();
4837            Self {
4838                inner,
4839                accept_compression_encodings: self.accept_compression_encodings,
4840                send_compression_encodings: self.send_compression_encodings,
4841                max_decoding_message_size: self.max_decoding_message_size,
4842                max_encoding_message_size: self.max_encoding_message_size,
4843            }
4844        }
4845    }
4846    /// Generated gRPC service name
4847    pub const SERVICE_NAME: &str = "angzarr.EventQueryService";
4848    impl<T> tonic::server::NamedService for EventQueryServiceServer<T> {
4849        const NAME: &'static str = SERVICE_NAME;
4850    }
4851}
4852/// Generated client implementations.
4853pub mod event_stream_service_client {
4854    #![allow(
4855        unused_variables,
4856        dead_code,
4857        missing_docs,
4858        clippy::wildcard_imports,
4859        clippy::let_unit_value
4860    )]
4861    use tonic::codegen::http::Uri;
4862    use tonic::codegen::*;
4863    /// docs:start:event_stream_service
4864    /// EventStreamService: streams events to registered subscribers
4865    #[derive(Debug, Clone)]
4866    pub struct EventStreamServiceClient<T> {
4867        inner: tonic::client::Grpc<T>,
4868    }
4869    impl EventStreamServiceClient<tonic::transport::Channel> {
4870        /// Attempt to create a new client by connecting to a given endpoint.
4871        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
4872        where
4873            D: TryInto<tonic::transport::Endpoint>,
4874            D::Error: Into<StdError>,
4875        {
4876            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
4877            Ok(Self::new(conn))
4878        }
4879    }
4880    impl<T> EventStreamServiceClient<T>
4881    where
4882        T: tonic::client::GrpcService<tonic::body::BoxBody>,
4883        T::Error: Into<StdError>,
4884        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
4885        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
4886    {
4887        pub fn new(inner: T) -> Self {
4888            let inner = tonic::client::Grpc::new(inner);
4889            Self { inner }
4890        }
4891        pub fn with_origin(inner: T, origin: Uri) -> Self {
4892            let inner = tonic::client::Grpc::with_origin(inner, origin);
4893            Self { inner }
4894        }
4895        pub fn with_interceptor<F>(
4896            inner: T,
4897            interceptor: F,
4898        ) -> EventStreamServiceClient<InterceptedService<T, F>>
4899        where
4900            F: tonic::service::Interceptor,
4901            T::ResponseBody: Default,
4902            T: tonic::codegen::Service<
4903                http::Request<tonic::body::BoxBody>,
4904                Response = http::Response<
4905                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
4906                >,
4907            >,
4908            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
4909                Into<StdError> + std::marker::Send + std::marker::Sync,
4910        {
4911            EventStreamServiceClient::new(InterceptedService::new(inner, interceptor))
4912        }
4913        /// Compress requests with the given encoding.
4914        ///
4915        /// This requires the server to support it otherwise it might respond with an
4916        /// error.
4917        #[must_use]
4918        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
4919            self.inner = self.inner.send_compressed(encoding);
4920            self
4921        }
4922        /// Enable decompressing responses.
4923        #[must_use]
4924        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
4925            self.inner = self.inner.accept_compressed(encoding);
4926            self
4927        }
4928        /// Limits the maximum size of a decoded message.
4929        ///
4930        /// Default: `4MB`
4931        #[must_use]
4932        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4933            self.inner = self.inner.max_decoding_message_size(limit);
4934            self
4935        }
4936        /// Limits the maximum size of an encoded message.
4937        ///
4938        /// Default: `usize::MAX`
4939        #[must_use]
4940        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4941            self.inner = self.inner.max_encoding_message_size(limit);
4942            self
4943        }
4944        /// Subscribe to events matching correlation ID (required)
4945        /// Returns INVALID_ARGUMENT if correlation_id is empty
4946        /// REST: Server-Sent Events (SSE) stream
4947        pub async fn subscribe(
4948            &mut self,
4949            request: impl tonic::IntoRequest<super::EventStreamFilter>,
4950        ) -> std::result::Result<
4951            tonic::Response<tonic::codec::Streaming<super::EventBook>>,
4952            tonic::Status,
4953        > {
4954            self.inner.ready().await.map_err(|e| {
4955                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4956            })?;
4957            let codec = tonic::codec::ProstCodec::default();
4958            let path =
4959                http::uri::PathAndQuery::from_static("/angzarr.EventStreamService/Subscribe");
4960            let mut req = request.into_request();
4961            req.extensions_mut()
4962                .insert(GrpcMethod::new("angzarr.EventStreamService", "Subscribe"));
4963            self.inner.server_streaming(req, path, codec).await
4964        }
4965    }
4966}
4967/// Generated server implementations.
4968pub mod event_stream_service_server {
4969    #![allow(
4970        unused_variables,
4971        dead_code,
4972        missing_docs,
4973        clippy::wildcard_imports,
4974        clippy::let_unit_value
4975    )]
4976    use tonic::codegen::*;
4977    /// Generated trait containing gRPC methods that should be implemented for use with EventStreamServiceServer.
4978    #[async_trait]
4979    pub trait EventStreamService: std::marker::Send + std::marker::Sync + 'static {
4980        /// Server streaming response type for the Subscribe method.
4981        type SubscribeStream: tonic::codegen::tokio_stream::Stream<
4982                Item = std::result::Result<super::EventBook, tonic::Status>,
4983            > + std::marker::Send
4984            + 'static;
4985        /// Subscribe to events matching correlation ID (required)
4986        /// Returns INVALID_ARGUMENT if correlation_id is empty
4987        /// REST: Server-Sent Events (SSE) stream
4988        async fn subscribe(
4989            &self,
4990            request: tonic::Request<super::EventStreamFilter>,
4991        ) -> std::result::Result<tonic::Response<Self::SubscribeStream>, tonic::Status>;
4992    }
4993    /// docs:start:event_stream_service
4994    /// EventStreamService: streams events to registered subscribers
4995    #[derive(Debug)]
4996    pub struct EventStreamServiceServer<T> {
4997        inner: Arc<T>,
4998        accept_compression_encodings: EnabledCompressionEncodings,
4999        send_compression_encodings: EnabledCompressionEncodings,
5000        max_decoding_message_size: Option<usize>,
5001        max_encoding_message_size: Option<usize>,
5002    }
5003    impl<T> EventStreamServiceServer<T> {
5004        pub fn new(inner: T) -> Self {
5005            Self::from_arc(Arc::new(inner))
5006        }
5007        pub fn from_arc(inner: Arc<T>) -> Self {
5008            Self {
5009                inner,
5010                accept_compression_encodings: Default::default(),
5011                send_compression_encodings: Default::default(),
5012                max_decoding_message_size: None,
5013                max_encoding_message_size: None,
5014            }
5015        }
5016        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
5017        where
5018            F: tonic::service::Interceptor,
5019        {
5020            InterceptedService::new(Self::new(inner), interceptor)
5021        }
5022        /// Enable decompressing requests with the given encoding.
5023        #[must_use]
5024        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
5025            self.accept_compression_encodings.enable(encoding);
5026            self
5027        }
5028        /// Compress responses with the given encoding, if the client supports it.
5029        #[must_use]
5030        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
5031            self.send_compression_encodings.enable(encoding);
5032            self
5033        }
5034        /// Limits the maximum size of a decoded message.
5035        ///
5036        /// Default: `4MB`
5037        #[must_use]
5038        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
5039            self.max_decoding_message_size = Some(limit);
5040            self
5041        }
5042        /// Limits the maximum size of an encoded message.
5043        ///
5044        /// Default: `usize::MAX`
5045        #[must_use]
5046        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
5047            self.max_encoding_message_size = Some(limit);
5048            self
5049        }
5050    }
5051    impl<T, B> tonic::codegen::Service<http::Request<B>> for EventStreamServiceServer<T>
5052    where
5053        T: EventStreamService,
5054        B: Body + std::marker::Send + 'static,
5055        B::Error: Into<StdError> + std::marker::Send + 'static,
5056    {
5057        type Response = http::Response<tonic::body::BoxBody>;
5058        type Error = std::convert::Infallible;
5059        type Future = BoxFuture<Self::Response, Self::Error>;
5060        fn poll_ready(
5061            &mut self,
5062            _cx: &mut Context<'_>,
5063        ) -> Poll<std::result::Result<(), Self::Error>> {
5064            Poll::Ready(Ok(()))
5065        }
5066        fn call(&mut self, req: http::Request<B>) -> Self::Future {
5067            match req.uri().path() {
5068                "/angzarr.EventStreamService/Subscribe" => {
5069                    #[allow(non_camel_case_types)]
5070                    struct SubscribeSvc<T: EventStreamService>(pub Arc<T>);
5071                    impl<T: EventStreamService>
5072                        tonic::server::ServerStreamingService<super::EventStreamFilter>
5073                        for SubscribeSvc<T>
5074                    {
5075                        type Response = super::EventBook;
5076                        type ResponseStream = T::SubscribeStream;
5077                        type Future =
5078                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
5079                        fn call(
5080                            &mut self,
5081                            request: tonic::Request<super::EventStreamFilter>,
5082                        ) -> Self::Future {
5083                            let inner = Arc::clone(&self.0);
5084                            let fut = async move {
5085                                <T as EventStreamService>::subscribe(&inner, request).await
5086                            };
5087                            Box::pin(fut)
5088                        }
5089                    }
5090                    let accept_compression_encodings = self.accept_compression_encodings;
5091                    let send_compression_encodings = self.send_compression_encodings;
5092                    let max_decoding_message_size = self.max_decoding_message_size;
5093                    let max_encoding_message_size = self.max_encoding_message_size;
5094                    let inner = self.inner.clone();
5095                    let fut = async move {
5096                        let method = SubscribeSvc(inner);
5097                        let codec = tonic::codec::ProstCodec::default();
5098                        let mut grpc = tonic::server::Grpc::new(codec)
5099                            .apply_compression_config(
5100                                accept_compression_encodings,
5101                                send_compression_encodings,
5102                            )
5103                            .apply_max_message_size_config(
5104                                max_decoding_message_size,
5105                                max_encoding_message_size,
5106                            );
5107                        let res = grpc.server_streaming(method, req).await;
5108                        Ok(res)
5109                    };
5110                    Box::pin(fut)
5111                }
5112                _ => Box::pin(async move {
5113                    let mut response = http::Response::new(empty_body());
5114                    let headers = response.headers_mut();
5115                    headers.insert(
5116                        tonic::Status::GRPC_STATUS,
5117                        (tonic::Code::Unimplemented as i32).into(),
5118                    );
5119                    headers.insert(
5120                        http::header::CONTENT_TYPE,
5121                        tonic::metadata::GRPC_CONTENT_TYPE,
5122                    );
5123                    Ok(response)
5124                }),
5125            }
5126        }
5127    }
5128    impl<T> Clone for EventStreamServiceServer<T> {
5129        fn clone(&self) -> Self {
5130            let inner = self.inner.clone();
5131            Self {
5132                inner,
5133                accept_compression_encodings: self.accept_compression_encodings,
5134                send_compression_encodings: self.send_compression_encodings,
5135                max_decoding_message_size: self.max_decoding_message_size,
5136                max_encoding_message_size: self.max_encoding_message_size,
5137            }
5138        }
5139    }
5140    /// Generated gRPC service name
5141    pub const SERVICE_NAME: &str = "angzarr.EventStreamService";
5142    impl<T> tonic::server::NamedService for EventStreamServiceServer<T> {
5143        const NAME: &'static str = SERVICE_NAME;
5144    }
5145}
5146#[derive(Clone, PartialEq, ::prost::Message)]
5147pub struct UpcastRequest {
5148    #[prost(string, tag = "1")]
5149    pub domain: ::prost::alloc::string::String,
5150    #[prost(message, repeated, tag = "2")]
5151    pub events: ::prost::alloc::vec::Vec<EventPage>,
5152}
5153impl ::prost::Name for UpcastRequest {
5154    const NAME: &'static str = "UpcastRequest";
5155    const PACKAGE: &'static str = "angzarr";
5156    fn full_name() -> ::prost::alloc::string::String {
5157        "angzarr.UpcastRequest".into()
5158    }
5159    fn type_url() -> ::prost::alloc::string::String {
5160        "/angzarr.UpcastRequest".into()
5161    }
5162}
5163#[derive(Clone, PartialEq, ::prost::Message)]
5164pub struct UpcastResponse {
5165    #[prost(message, repeated, tag = "1")]
5166    pub events: ::prost::alloc::vec::Vec<EventPage>,
5167}
5168impl ::prost::Name for UpcastResponse {
5169    const NAME: &'static str = "UpcastResponse";
5170    const PACKAGE: &'static str = "angzarr";
5171    fn full_name() -> ::prost::alloc::string::String {
5172        "angzarr.UpcastResponse".into()
5173    }
5174    fn type_url() -> ::prost::alloc::string::String {
5175        "/angzarr.UpcastResponse".into()
5176    }
5177}
5178/// Generated client implementations.
5179pub mod upcaster_service_client {
5180    #![allow(
5181        unused_variables,
5182        dead_code,
5183        missing_docs,
5184        clippy::wildcard_imports,
5185        clippy::let_unit_value
5186    )]
5187    use tonic::codegen::http::Uri;
5188    use tonic::codegen::*;
5189    /// UpcasterService: transforms old event versions to current versions
5190    /// Implemented by the client alongside AggregateService on the same gRPC server.
5191    /// Optionally can be deployed as a separate binary for testing or complex migrations.
5192    #[derive(Debug, Clone)]
5193    pub struct UpcasterServiceClient<T> {
5194        inner: tonic::client::Grpc<T>,
5195    }
5196    impl UpcasterServiceClient<tonic::transport::Channel> {
5197        /// Attempt to create a new client by connecting to a given endpoint.
5198        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
5199        where
5200            D: TryInto<tonic::transport::Endpoint>,
5201            D::Error: Into<StdError>,
5202        {
5203            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
5204            Ok(Self::new(conn))
5205        }
5206    }
5207    impl<T> UpcasterServiceClient<T>
5208    where
5209        T: tonic::client::GrpcService<tonic::body::BoxBody>,
5210        T::Error: Into<StdError>,
5211        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
5212        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
5213    {
5214        pub fn new(inner: T) -> Self {
5215            let inner = tonic::client::Grpc::new(inner);
5216            Self { inner }
5217        }
5218        pub fn with_origin(inner: T, origin: Uri) -> Self {
5219            let inner = tonic::client::Grpc::with_origin(inner, origin);
5220            Self { inner }
5221        }
5222        pub fn with_interceptor<F>(
5223            inner: T,
5224            interceptor: F,
5225        ) -> UpcasterServiceClient<InterceptedService<T, F>>
5226        where
5227            F: tonic::service::Interceptor,
5228            T::ResponseBody: Default,
5229            T: tonic::codegen::Service<
5230                http::Request<tonic::body::BoxBody>,
5231                Response = http::Response<
5232                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
5233                >,
5234            >,
5235            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
5236                Into<StdError> + std::marker::Send + std::marker::Sync,
5237        {
5238            UpcasterServiceClient::new(InterceptedService::new(inner, interceptor))
5239        }
5240        /// Compress requests with the given encoding.
5241        ///
5242        /// This requires the server to support it otherwise it might respond with an
5243        /// error.
5244        #[must_use]
5245        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
5246            self.inner = self.inner.send_compressed(encoding);
5247            self
5248        }
5249        /// Enable decompressing responses.
5250        #[must_use]
5251        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
5252            self.inner = self.inner.accept_compressed(encoding);
5253            self
5254        }
5255        /// Limits the maximum size of a decoded message.
5256        ///
5257        /// Default: `4MB`
5258        #[must_use]
5259        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
5260            self.inner = self.inner.max_decoding_message_size(limit);
5261            self
5262        }
5263        /// Limits the maximum size of an encoded message.
5264        ///
5265        /// Default: `usize::MAX`
5266        #[must_use]
5267        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
5268            self.inner = self.inner.max_encoding_message_size(limit);
5269            self
5270        }
5271        /// Transform events to current version
5272        /// Returns events in same order, transformed where applicable
5273        pub async fn upcast(
5274            &mut self,
5275            request: impl tonic::IntoRequest<super::UpcastRequest>,
5276        ) -> std::result::Result<tonic::Response<super::UpcastResponse>, tonic::Status> {
5277            self.inner.ready().await.map_err(|e| {
5278                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
5279            })?;
5280            let codec = tonic::codec::ProstCodec::default();
5281            let path = http::uri::PathAndQuery::from_static("/angzarr.UpcasterService/Upcast");
5282            let mut req = request.into_request();
5283            req.extensions_mut()
5284                .insert(GrpcMethod::new("angzarr.UpcasterService", "Upcast"));
5285            self.inner.unary(req, path, codec).await
5286        }
5287    }
5288}
5289/// Generated server implementations.
5290pub mod upcaster_service_server {
5291    #![allow(
5292        unused_variables,
5293        dead_code,
5294        missing_docs,
5295        clippy::wildcard_imports,
5296        clippy::let_unit_value
5297    )]
5298    use tonic::codegen::*;
5299    /// Generated trait containing gRPC methods that should be implemented for use with UpcasterServiceServer.
5300    #[async_trait]
5301    pub trait UpcasterService: std::marker::Send + std::marker::Sync + 'static {
5302        /// Transform events to current version
5303        /// Returns events in same order, transformed where applicable
5304        async fn upcast(
5305            &self,
5306            request: tonic::Request<super::UpcastRequest>,
5307        ) -> std::result::Result<tonic::Response<super::UpcastResponse>, tonic::Status>;
5308    }
5309    /// UpcasterService: transforms old event versions to current versions
5310    /// Implemented by the client alongside AggregateService on the same gRPC server.
5311    /// Optionally can be deployed as a separate binary for testing or complex migrations.
5312    #[derive(Debug)]
5313    pub struct UpcasterServiceServer<T> {
5314        inner: Arc<T>,
5315        accept_compression_encodings: EnabledCompressionEncodings,
5316        send_compression_encodings: EnabledCompressionEncodings,
5317        max_decoding_message_size: Option<usize>,
5318        max_encoding_message_size: Option<usize>,
5319    }
5320    impl<T> UpcasterServiceServer<T> {
5321        pub fn new(inner: T) -> Self {
5322            Self::from_arc(Arc::new(inner))
5323        }
5324        pub fn from_arc(inner: Arc<T>) -> Self {
5325            Self {
5326                inner,
5327                accept_compression_encodings: Default::default(),
5328                send_compression_encodings: Default::default(),
5329                max_decoding_message_size: None,
5330                max_encoding_message_size: None,
5331            }
5332        }
5333        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
5334        where
5335            F: tonic::service::Interceptor,
5336        {
5337            InterceptedService::new(Self::new(inner), interceptor)
5338        }
5339        /// Enable decompressing requests with the given encoding.
5340        #[must_use]
5341        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
5342            self.accept_compression_encodings.enable(encoding);
5343            self
5344        }
5345        /// Compress responses with the given encoding, if the client supports it.
5346        #[must_use]
5347        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
5348            self.send_compression_encodings.enable(encoding);
5349            self
5350        }
5351        /// Limits the maximum size of a decoded message.
5352        ///
5353        /// Default: `4MB`
5354        #[must_use]
5355        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
5356            self.max_decoding_message_size = Some(limit);
5357            self
5358        }
5359        /// Limits the maximum size of an encoded message.
5360        ///
5361        /// Default: `usize::MAX`
5362        #[must_use]
5363        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
5364            self.max_encoding_message_size = Some(limit);
5365            self
5366        }
5367    }
5368    impl<T, B> tonic::codegen::Service<http::Request<B>> for UpcasterServiceServer<T>
5369    where
5370        T: UpcasterService,
5371        B: Body + std::marker::Send + 'static,
5372        B::Error: Into<StdError> + std::marker::Send + 'static,
5373    {
5374        type Response = http::Response<tonic::body::BoxBody>;
5375        type Error = std::convert::Infallible;
5376        type Future = BoxFuture<Self::Response, Self::Error>;
5377        fn poll_ready(
5378            &mut self,
5379            _cx: &mut Context<'_>,
5380        ) -> Poll<std::result::Result<(), Self::Error>> {
5381            Poll::Ready(Ok(()))
5382        }
5383        fn call(&mut self, req: http::Request<B>) -> Self::Future {
5384            match req.uri().path() {
5385                "/angzarr.UpcasterService/Upcast" => {
5386                    #[allow(non_camel_case_types)]
5387                    struct UpcastSvc<T: UpcasterService>(pub Arc<T>);
5388                    impl<T: UpcasterService> tonic::server::UnaryService<super::UpcastRequest> for UpcastSvc<T> {
5389                        type Response = super::UpcastResponse;
5390                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
5391                        fn call(
5392                            &mut self,
5393                            request: tonic::Request<super::UpcastRequest>,
5394                        ) -> Self::Future {
5395                            let inner = Arc::clone(&self.0);
5396                            let fut = async move {
5397                                <T as UpcasterService>::upcast(&inner, request).await
5398                            };
5399                            Box::pin(fut)
5400                        }
5401                    }
5402                    let accept_compression_encodings = self.accept_compression_encodings;
5403                    let send_compression_encodings = self.send_compression_encodings;
5404                    let max_decoding_message_size = self.max_decoding_message_size;
5405                    let max_encoding_message_size = self.max_encoding_message_size;
5406                    let inner = self.inner.clone();
5407                    let fut = async move {
5408                        let method = UpcastSvc(inner);
5409                        let codec = tonic::codec::ProstCodec::default();
5410                        let mut grpc = tonic::server::Grpc::new(codec)
5411                            .apply_compression_config(
5412                                accept_compression_encodings,
5413                                send_compression_encodings,
5414                            )
5415                            .apply_max_message_size_config(
5416                                max_decoding_message_size,
5417                                max_encoding_message_size,
5418                            );
5419                        let res = grpc.unary(method, req).await;
5420                        Ok(res)
5421                    };
5422                    Box::pin(fut)
5423                }
5424                _ => Box::pin(async move {
5425                    let mut response = http::Response::new(empty_body());
5426                    let headers = response.headers_mut();
5427                    headers.insert(
5428                        tonic::Status::GRPC_STATUS,
5429                        (tonic::Code::Unimplemented as i32).into(),
5430                    );
5431                    headers.insert(
5432                        http::header::CONTENT_TYPE,
5433                        tonic::metadata::GRPC_CONTENT_TYPE,
5434                    );
5435                    Ok(response)
5436                }),
5437            }
5438        }
5439    }
5440    impl<T> Clone for UpcasterServiceServer<T> {
5441        fn clone(&self) -> Self {
5442            let inner = self.inner.clone();
5443            Self {
5444                inner,
5445                accept_compression_encodings: self.accept_compression_encodings,
5446                send_compression_encodings: self.send_compression_encodings,
5447                max_decoding_message_size: self.max_decoding_message_size,
5448                max_encoding_message_size: self.max_encoding_message_size,
5449            }
5450        }
5451    }
5452    /// Generated gRPC service name
5453    pub const SERVICE_NAME: &str = "angzarr.UpcasterService";
5454    impl<T> tonic::server::NamedService for UpcasterServiceServer<T> {
5455        const NAME: &'static str = SERVICE_NAME;
5456    }
5457}
5458/// Delete all events for an edition+domain combination.
5459/// Main timeline ('angzarr' or empty edition name) cannot be deleted.
5460#[derive(Clone, PartialEq, ::prost::Message)]
5461pub struct DeleteEditionEvents {
5462    /// Edition name to delete from
5463    #[prost(string, tag = "1")]
5464    pub edition: ::prost::alloc::string::String,
5465    /// Domain to delete from
5466    #[prost(string, tag = "2")]
5467    pub domain: ::prost::alloc::string::String,
5468}
5469impl ::prost::Name for DeleteEditionEvents {
5470    const NAME: &'static str = "DeleteEditionEvents";
5471    const PACKAGE: &'static str = "angzarr";
5472    fn full_name() -> ::prost::alloc::string::String {
5473        "angzarr.DeleteEditionEvents".into()
5474    }
5475    fn type_url() -> ::prost::alloc::string::String {
5476        "/angzarr.DeleteEditionEvents".into()
5477    }
5478}
5479/// Response from edition event deletion.
5480#[derive(Clone, PartialEq, ::prost::Message)]
5481pub struct EditionEventsDeleted {
5482    #[prost(string, tag = "1")]
5483    pub edition: ::prost::alloc::string::String,
5484    #[prost(string, tag = "2")]
5485    pub domain: ::prost::alloc::string::String,
5486    #[prost(uint32, tag = "3")]
5487    pub deleted_count: u32,
5488    #[prost(string, tag = "4")]
5489    pub deleted_at: ::prost::alloc::string::String,
5490}
5491impl ::prost::Name for EditionEventsDeleted {
5492    const NAME: &'static str = "EditionEventsDeleted";
5493    const PACKAGE: &'static str = "angzarr";
5494    fn full_name() -> ::prost::alloc::string::String {
5495        "angzarr.EditionEventsDeleted".into()
5496    }
5497    fn type_url() -> ::prost::alloc::string::String {
5498        "/angzarr.EditionEventsDeleted".into()
5499    }
5500}
5501/// docs:start:cloud_event
5502/// CloudEvent represents a single event for external consumption.
5503///
5504/// Client projectors create these by filtering/transforming internal events.
5505/// Framework fills envelope fields (id, source, time) from Cover/EventPage
5506/// if not explicitly set by the client.
5507///
5508/// The `data` field is a protobuf Any that framework converts to JSON via
5509/// prost-reflect using the descriptor pool. Clients should pack a "public"
5510/// proto message that omits sensitive fields.
5511#[derive(Clone, PartialEq, ::prost::Message)]
5512pub struct CloudEvent {
5513    /// Event type (e.g., "com.example.order.created").
5514    /// Default: proto type_url suffix from original event.
5515    #[prost(string, tag = "1")]
5516    pub r#type: ::prost::alloc::string::String,
5517    /// Event payload as proto Any.
5518    /// Framework converts to JSON for CloudEvents output.
5519    /// Client should filter sensitive fields before packing.
5520    #[prost(message, optional, tag = "2")]
5521    pub data: ::core::option::Option<::prost_types::Any>,
5522    /// Custom extension attributes.
5523    /// Keys should follow CloudEvents naming (lowercase, no dots).
5524    /// Framework adds correlationid automatically if present in Cover.
5525    #[prost(map = "string, string", tag = "3")]
5526    pub extensions:
5527        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
5528    /// Optional overrides. Framework uses Cover/EventPage values if not set.
5529    ///
5530    /// Default: {domain}:{root_id}:{sequence}
5531    #[prost(string, optional, tag = "4")]
5532    pub id: ::core::option::Option<::prost::alloc::string::String>,
5533    /// Default: angzarr/{domain}
5534    #[prost(string, optional, tag = "5")]
5535    pub source: ::core::option::Option<::prost::alloc::string::String>,
5536    /// Default: aggregate root ID
5537    #[prost(string, optional, tag = "6")]
5538    pub subject: ::core::option::Option<::prost::alloc::string::String>,
5539}
5540impl ::prost::Name for CloudEvent {
5541    const NAME: &'static str = "CloudEvent";
5542    const PACKAGE: &'static str = "angzarr";
5543    fn full_name() -> ::prost::alloc::string::String {
5544        "angzarr.CloudEvent".into()
5545    }
5546    fn type_url() -> ::prost::alloc::string::String {
5547        "/angzarr.CloudEvent".into()
5548    }
5549}
5550/// CloudEventsResponse is returned by client projectors in Projection.projection.
5551///
5552/// Framework detects this type by checking projection.type_url and routes
5553/// the events to configured sinks (HTTP webhook, Kafka).
5554///
5555/// Client may return 0 events (skip), 1 event (typical), or N events
5556/// (fan-out scenarios like multi-tenant notifications).
5557#[derive(Clone, PartialEq, ::prost::Message)]
5558pub struct CloudEventsResponse {
5559    #[prost(message, repeated, tag = "1")]
5560    pub events: ::prost::alloc::vec::Vec<CloudEvent>,
5561}
5562impl ::prost::Name for CloudEventsResponse {
5563    const NAME: &'static str = "CloudEventsResponse";
5564    const PACKAGE: &'static str = "angzarr";
5565    fn full_name() -> ::prost::alloc::string::String {
5566        "angzarr.CloudEventsResponse".into()
5567    }
5568    fn type_url() -> ::prost::alloc::string::String {
5569        "/angzarr.CloudEventsResponse".into()
5570    }
5571}