//! 自定义世界领域事件。 //! //! 用于表达草稿变化、profile 发布、画廊投影刷新和 Agent 操作进度变化。 use crate::domain::{ RpgAgentDraftCardKind, RpgAgentOperationStatus, RpgAgentOperationType, RpgAgentStage, }; use serde::{Deserialize, Serialize}; #[cfg(feature = "spacetime-types")] use spacetimedb::SpacetimeType; #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum CustomWorldDomainEvent { ProfileUpserted(CustomWorldProfileUpsertedEvent), ProfilePublished(CustomWorldProfilePublishedEvent), GalleryProjectionRefreshed(CustomWorldGalleryProjectionRefreshedEvent), AgentSessionAdvanced(CustomWorldAgentSessionAdvancedEvent), AgentOperationProgressed(CustomWorldAgentOperationProgressedEvent), DraftCardUpdated(CustomWorldDraftCardUpdatedEvent), } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CustomWorldProfileUpsertedEvent { pub profile_id: String, pub owner_user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CustomWorldProfilePublishedEvent { pub profile_id: String, pub public_work_code: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CustomWorldGalleryProjectionRefreshedEvent { pub profile_id: String, pub public_work_code: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CustomWorldAgentSessionAdvancedEvent { pub session_id: String, pub stage: RpgAgentStage, pub progress_percent: u32, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CustomWorldAgentOperationProgressedEvent { pub session_id: String, pub operation_id: String, pub operation_type: RpgAgentOperationType, pub status: RpgAgentOperationStatus, pub progress: u32, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CustomWorldDraftCardUpdatedEvent { pub session_id: String, pub card_id: String, pub kind: RpgAgentDraftCardKind, }