Skip to main content

lenso_contracts/
events.rs

1//! Pure-data event handler declarations for module manifests.
2//!
3//! These declarations describe event subscriptions without carrying executable
4//! handlers. Loading sources decide how to bind them to host-owned dispatch.
5
6use serde::{Deserialize, Serialize};
7use utoipa::ToSchema;
8
9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema, schemars::JsonSchema)]
10pub struct EventSurface {
11    #[serde(default)]
12    pub handlers: Vec<EventHandlerDeclaration>,
13}
14
15#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema, schemars::JsonSchema)]
16pub struct EventHandlerDeclaration {
17    /// Stable handler name used by Service Providers as the invoke path.
18    pub name: String,
19    /// Stable event name consumed from `platform.outbox`, e.g.
20    /// `identity.user_registered.v1`.
21    pub event_name: String,
22    #[serde(default, skip_serializing_if = "Option::is_none")]
23    pub operation: Option<crate::ServiceOperationMetadata>,
24}