//! 运行时领域模型。 //! //! 这里只保留运行时设置、快照、个人页状态、钱包流水、存档和浏览历史等 //! 纯领域事实与值对象;SpacetimeDB client 与 HTTP response 不进入本文件。 use serde::{Deserialize, Serialize}; use serde_json::Value; #[cfg(feature = "spacetime-types")] use spacetimedb::SpacetimeType; pub const DEFAULT_MUSIC_VOLUME: f32 = 0.42; pub const DEFAULT_PLATFORM_THEME: RuntimePlatformTheme = RuntimePlatformTheme::Light; pub const DEFAULT_BROWSE_HISTORY_AUTHOR_DISPLAY_NAME: &str = "玩家"; pub const MAX_BROWSE_HISTORY_BATCH_SIZE: usize = 100; pub const PROFILE_WALLET_LEDGER_LIST_LIMIT: usize = 50; pub const PROFILE_NEW_USER_INITIAL_WALLET_POINTS: u64 = 10; pub const PROFILE_REFERRAL_REWARD_POINTS: u64 = 30; pub const PROFILE_REFERRAL_DAILY_INVITER_REWARD_LIMIT: u32 = 10; pub const PROFILE_INVITE_CODE_METADATA_DEFAULT_JSON: &str = "{}"; pub const PROFILE_INVITE_CODE_METADATA_MAX_BYTES: usize = 4096; pub const PROFILE_RUNTIME_DAY_MICROS: i64 = 86_400_000_000; pub const PROFILE_TASK_BEIJING_OFFSET_MICROS: i64 = 28_800_000_000; pub const ANALYTICS_DATE_DIMENSION_MAX_SEED_DAYS: i64 = 3_660; // 中文注释:日期维表当前只预置运营统计可接受的业务日期范围,避免裸 date_key 极值进入日历算法。 pub const ANALYTICS_DATE_DIMENSION_MIN_DATE: &str = "2000-01-01"; pub const ANALYTICS_DATE_DIMENSION_MAX_DATE: &str = "2100-12-31"; pub const PROFILE_TASK_ID_DAILY_LOGIN: &str = "daily_login"; pub const PROFILE_TASK_EVENT_KEY_DAILY_LOGIN: &str = "daily_login"; pub const PROFILE_TASK_DEFAULT_TITLE_DAILY_LOGIN: &str = "每日登录"; pub const PROFILE_TASK_DEFAULT_REWARD_POINTS: u64 = 10; pub const PROFILE_TASK_DEFAULT_THRESHOLD: u32 = 1; pub const SAVE_SNAPSHOT_VERSION: u32 = 2; pub const DEFAULT_SAVE_ARCHIVE_SUMMARY_TEXT: &str = "继续推进上一次保存的故事。"; pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_MOCK: &str = "mock"; pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_MINI_PROGRAM: &str = "wechat_mp"; pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_H5: &str = "wechat_h5"; pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_NATIVE: &str = "wechat_native"; pub const PROFILE_FEEDBACK_DESCRIPTION_MIN_CHARS: usize = 10; pub const PROFILE_FEEDBACK_DESCRIPTION_MAX_CHARS: usize = 200; pub const PROFILE_FEEDBACK_CONTACT_PHONE_MAX_CHARS: usize = 40; pub const PROFILE_FEEDBACK_EVIDENCE_MAX_COUNT: usize = 4; pub const PROFILE_FEEDBACK_EVIDENCE_MAX_BYTES: u64 = 1_048_576; pub const PROFILE_FEEDBACK_EVIDENCE_TOTAL_MAX_BYTES: u64 = 4_194_304; pub const CREATION_ENTRY_CONFIG_GLOBAL_ID: &str = "platform_creation_center"; pub const DEFAULT_CREATION_ENTRY_START_TITLE: &str = "新建作品"; pub const DEFAULT_CREATION_ENTRY_START_DESCRIPTION: &str = "选择模板后进入对应的创作表单。"; pub const DEFAULT_CREATION_ENTRY_START_IDLE_BADGE: &str = "模板 Tab"; pub const DEFAULT_CREATION_ENTRY_START_BUSY_BADGE: &str = "正在开启"; pub const DEFAULT_CREATION_ENTRY_MODAL_TITLE: &str = "选择创作类型"; pub const DEFAULT_CREATION_ENTRY_MODAL_DESCRIPTION: &str = "先选玩法类型,再进入对应创作工作台。"; pub const DEFAULT_CREATION_ENTRY_CATEGORY_ID: &str = "recent"; pub const DEFAULT_CREATION_ENTRY_CATEGORY_LABEL: &str = "最近创作"; pub const DEFAULT_CREATION_ENTRY_EVENT_TITLE: &str = "主题创作赛"; pub const DEFAULT_CREATION_ENTRY_EVENT_DESCRIPTION: &str = "用温暖的色彩,捏出秋天的故事。"; pub const DEFAULT_CREATION_ENTRY_EVENT_COVER_IMAGE_SRC: &str = "/branding/taonier-logo-spiral-reference-concepts/taonier-spiral-bouncy-clay.png"; pub const DEFAULT_CREATION_ENTRY_EVENT_PRIZE_POOL_MUD_POINTS: u64 = 58_000; pub const DEFAULT_CREATION_ENTRY_EVENT_STARTS_AT_TEXT: &str = "2024.10.20 10:00"; pub const DEFAULT_CREATION_ENTRY_EVENT_ENDS_AT_TEXT: &str = "2024.11.20 23:59"; #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryStartCardSnapshot { pub title: String, pub description: String, pub idle_badge: String, pub busy_badge: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryTypeModalSnapshot { pub title: String, pub description: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryEventBannerSnapshot { pub title: String, pub description: String, pub cover_image_src: String, pub prize_pool_mud_points: u64, pub starts_at_text: String, pub ends_at_text: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryTypeSnapshot { pub id: String, pub title: String, pub subtitle: String, pub badge: String, pub image_src: String, pub visible: bool, pub open: bool, pub sort_order: i32, pub category_id: String, pub category_label: String, pub category_sort_order: i32, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryConfigSnapshot { pub config_id: String, pub start_card: CreationEntryStartCardSnapshot, pub type_modal: CreationEntryTypeModalSnapshot, pub event_banner: CreationEntryEventBannerSnapshot, pub creation_types: Vec, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryTypeAdminUpsertInput { pub id: String, pub title: String, pub subtitle: String, pub badge: String, pub image_src: String, pub visible: bool, pub open: bool, pub sort_order: i32, pub category_id: String, pub category_label: String, pub category_sort_order: i32, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CreationEntryConfigProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } /// 分析日期维表的纯领域快照。 /// /// date_key 沿用现有北京时间自然日桶:floor((occurred_at_micros + 8h) / 1d)。 /// calendar_date 使用该业务日对应的公历日期,格式固定为 YYYY-MM-DD。 #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct AnalyticsDateDimensionSnapshot { pub date_key: i64, pub calendar_date: String, pub weekday: u8, pub iso_week_key: i32, pub week_start_date_key: i64, pub week_end_date_key: i64, pub month_key: i32, pub month_start_date_key: i64, pub month_end_date_key: i64, pub quarter_key: i32, pub quarter_start_date_key: i64, pub quarter_end_date_key: i64, pub year_key: i32, pub year_start_date_key: i64, pub year_end_date_key: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum AnalyticsGranularity { Day, Week, Month, Quarter, Year, } impl AnalyticsGranularity { pub fn as_str(&self) -> &'static str { match self { Self::Day => "day", Self::Week => "week", Self::Month => "month", Self::Quarter => "quarter", Self::Year => "year", } } pub fn from_client_str(value: &str) -> Option { match value.trim().to_ascii_lowercase().as_str() { "day" => Some(Self::Day), "week" => Some(Self::Week), "month" => Some(Self::Month), "quarter" => Some(Self::Quarter), "year" => Some(Self::Year), _ => None, } } } #[derive(Clone, Debug, PartialEq, Eq)] pub struct RuntimeAnalyticsDailyStatSnapshot { pub event_key: String, pub scope_kind: RuntimeTrackingScopeKind, pub scope_id: String, pub day_key: i64, pub count: u32, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct AnalyticsBucketMetric { pub bucket_key: String, pub bucket_start_date_key: i64, pub bucket_end_date_key: i64, pub value: u64, } #[derive(Clone, Debug, PartialEq, Eq)] pub struct AnalyticsMetricQueryRequest { pub event_key: String, pub scope_kind: RuntimeTrackingScopeKind, pub scope_id: String, pub granularity: AnalyticsGranularity, } #[derive(Clone, Debug, PartialEq, Eq)] pub struct AnalyticsMetricQueryResponse { pub buckets: Vec, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct AnalyticsMetricQueryProcedureResult { pub ok: bool, pub buckets: Vec, pub error_message: Option, } /// 运行时平台主题。 /// /// 当前只冻结 light/dark 两种主题,避免各层散落字符串字面量。 #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimePlatformTheme { Light, Dark, } impl RuntimePlatformTheme { pub fn as_str(&self) -> &'static str { match self { Self::Light => "light", Self::Dark => "dark", } } pub fn from_client_str(value: &str) -> Self { if value.trim().eq_ignore_ascii_case("dark") { Self::Dark } else { Self::Light } } } /// 运行时设置聚合。 #[derive(Clone, Debug, PartialEq)] pub struct RuntimeSettings { pub music_volume: f32, pub platform_theme: RuntimePlatformTheme, } impl RuntimeSettings { pub fn defaults() -> Self { Self { music_volume: DEFAULT_MUSIC_VOLUME, platform_theme: DEFAULT_PLATFORM_THEME, } } /// 与旧 Node 仓储保持一致:音量 clamp 到 0~1,主题除 dark 外统一回退到 light。 pub fn normalized(music_volume: f32, platform_theme: RuntimePlatformTheme) -> Self { Self { music_volume: music_volume.clamp(0.0, 1.0), platform_theme, } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSnapshot { pub user_id: String, pub version: u32, pub saved_at_micros: i64, pub bottom_tab: String, pub game_state_json: String, pub current_story_json: Option, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSnapshotProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSnapshotGetInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSnapshotUpsertInput { pub user_id: String, pub saved_at_micros: i64, pub bottom_tab: String, pub game_state_json: String, pub current_story_json: Option, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSnapshotDeleteInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileSaveArchiveSnapshot { pub archive_id: String, pub user_id: String, pub world_key: String, pub owner_user_id: Option, pub profile_id: Option, pub world_type: Option, pub world_name: String, pub subtitle: String, pub summary_text: String, pub cover_image_src: Option, pub saved_at_micros: i64, pub bottom_tab: String, pub game_state_json: String, pub current_story_json: Option, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileSaveArchiveProcedureResult { pub ok: bool, pub entries: Vec, pub record: Option, pub current_snapshot: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileSaveArchiveListInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileSaveArchiveResumeInput { pub user_id: String, pub world_key: String, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeSaveCheckpointInput { pub session_id: String, pub bottom_tab: String, pub saved_at_micros: i64, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeSaveCheckpointSnapshotUpdate { pub saved_at_micros: i64, pub bottom_tab: String, pub game_state: Value, pub current_story: Option, pub updated_at_micros: i64, } /// 浏览历史沿用平台已有的六种世界主题,但独立冻结在 runtime 领域内,避免反向耦合创作域 crate。 #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeBrowseHistoryThemeMode { Martial, Arcane, Machina, Tide, Rift, Mythic, } impl RuntimeBrowseHistoryThemeMode { pub fn as_str(&self) -> &'static str { match self { Self::Martial => "martial", Self::Arcane => "arcane", Self::Machina => "machina", Self::Tide => "tide", Self::Rift => "rift", Self::Mythic => "mythic", } } /// 浏览历史主题沿用旧 Node 逻辑:不做严格校验,未知值统一回退到 mythic。 pub fn from_client_str(value: &str) -> Self { match value.trim().to_ascii_lowercase().as_str() { "martial" => Self::Martial, "arcane" => Self::Arcane, "machina" => Self::Machina, "tide" => Self::Tide, "rift" => Self::Rift, _ => Self::Mythic, } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSettingSnapshot { pub user_id: String, pub music_volume: f32, pub platform_theme: RuntimePlatformTheme, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSettingProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSettingGetInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeSettingUpsertInput { pub user_id: String, pub music_volume: f32, pub platform_theme: RuntimePlatformTheme, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeBrowseHistorySnapshot { pub browse_history_id: String, pub user_id: String, pub owner_user_id: String, pub profile_id: String, pub world_name: String, pub subtitle: String, pub summary_text: String, pub cover_image_src: Option, pub theme_mode: RuntimeBrowseHistoryThemeMode, pub author_display_name: String, pub visited_at_micros: i64, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeBrowseHistoryProcedureResult { pub ok: bool, pub entries: Vec, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeBrowseHistoryListInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeBrowseHistoryClearInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeBrowseHistoryWriteInput { pub owner_user_id: String, pub profile_id: String, pub world_name: String, pub subtitle: Option, pub summary_text: Option, pub cover_image_src: Option, pub theme_mode: Option, pub author_display_name: Option, pub visited_at: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeBrowseHistorySyncInput { pub user_id: String, pub entries: Vec, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileDashboardSnapshot { pub user_id: String, pub wallet_balance: u64, pub total_play_time_ms: u64, pub played_world_count: u32, pub updated_at_micros: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileDashboardProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileDashboardGetInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileFeedbackStatus { Open, } impl RuntimeProfileFeedbackStatus { pub fn as_str(&self) -> &'static str { match self { Self::Open => "open", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RuntimeProfileFeedbackEvidenceSnapshot { pub evidence_id: String, pub file_name: String, pub content_type: String, pub size_bytes: u64, pub data_url: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RuntimeProfileFeedbackSubmissionInput { pub user_id: String, pub description: String, pub contact_phone: Option, pub evidence_items: Vec, pub created_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RuntimeProfileFeedbackSubmissionSnapshot { pub feedback_id: String, pub user_id: String, pub description: String, pub contact_phone: Option, pub evidence_json: String, pub status: RuntimeProfileFeedbackStatus, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RuntimeProfileFeedbackSubmissionProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[derive(Clone, Debug, PartialEq, Eq)] pub struct RuntimeProfileFeedbackEvidenceRecord { pub evidence_id: String, pub file_name: String, pub content_type: String, pub size_bytes: u64, } #[derive(Clone, Debug, PartialEq, Eq)] pub struct RuntimeProfileFeedbackSubmissionRecord { pub feedback_id: String, pub user_id: String, pub description: String, pub contact_phone: Option, pub evidence_items: Vec, pub status: RuntimeProfileFeedbackStatus, pub created_at: String, pub created_at_micros: i64, pub updated_at: String, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeTrackingScopeKind { Site, Work, Module, User, } impl RuntimeTrackingScopeKind { pub fn as_str(&self) -> &'static str { match self { Self::Site => "site", Self::Work => "work", Self::Module => "module", Self::User => "user", } } pub fn from_client_str(value: &str) -> Option { match value.trim().to_ascii_lowercase().as_str() { "site" => Some(Self::Site), "work" => Some(Self::Work), "module" => Some(Self::Module), "user" => Some(Self::User), _ => None, } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileTaskCycle { Daily, } impl RuntimeProfileTaskCycle { pub fn as_str(&self) -> &'static str { match self { Self::Daily => "daily", } } pub fn from_client_str(value: &str) -> Option { match value.trim().to_ascii_lowercase().as_str() { "daily" => Some(Self::Daily), _ => None, } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileTaskStatus { Incomplete, Claimable, Claimed, Disabled, } impl RuntimeProfileTaskStatus { pub fn as_str(&self) -> &'static str { match self { Self::Incomplete => "incomplete", Self::Claimable => "claimable", Self::Claimed => "claimed", Self::Disabled => "disabled", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileInviteCodeStatus { Pending, Active, Expired, } impl RuntimeProfileInviteCodeStatus { pub fn as_str(&self) -> &'static str { match self { Self::Pending => "pending", Self::Active => "active", Self::Expired => "expired", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeTrackingEventInput { pub event_id: String, pub event_key: String, pub scope_kind: RuntimeTrackingScopeKind, pub scope_id: String, pub user_id: Option, pub owner_user_id: Option, pub profile_id: Option, pub module_key: Option, pub metadata_json: String, pub occurred_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeTrackingEventProcedureResult { pub ok: bool, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeTrackingEventBatchProcedureResult { pub ok: bool, pub accepted_count: u32, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskConfigSnapshot { pub task_id: String, pub title: String, pub description: String, pub event_key: String, pub cycle: RuntimeProfileTaskCycle, pub scope_kind: RuntimeTrackingScopeKind, pub threshold: u32, pub reward_points: u64, pub enabled: bool, pub sort_order: i32, pub created_by: String, pub created_at_micros: i64, pub updated_by: String, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskItemSnapshot { pub task_id: String, pub title: String, pub description: String, pub event_key: String, pub cycle: RuntimeProfileTaskCycle, pub threshold: u32, pub progress_count: u32, pub reward_points: u64, pub status: RuntimeProfileTaskStatus, pub day_key: i64, pub claimed_at_micros: Option, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskCenterSnapshot { pub user_id: String, pub day_key: i64, pub wallet_balance: u64, pub tasks: Vec, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskCenterProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskClaimSnapshot { pub user_id: String, pub task_id: String, pub day_key: i64, pub reward_points: u64, pub wallet_balance: u64, pub ledger_entry: RuntimeProfileWalletLedgerEntrySnapshot, pub center: RuntimeProfileTaskCenterSnapshot, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskClaimProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskCenterGetInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AnalyticsMetricQueryInput { pub event_key: String, pub scope_kind: RuntimeTrackingScopeKind, pub scope_id: String, pub granularity: AnalyticsGranularity, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskClaimInput { pub user_id: String, pub task_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskConfigAdminListInput { pub admin_user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskConfigAdminUpsertInput { pub admin_user_id: String, pub task_id: String, pub title: String, pub description: String, pub event_key: String, pub cycle: RuntimeProfileTaskCycle, pub scope_kind: RuntimeTrackingScopeKind, pub threshold: u32, pub reward_points: u64, pub enabled: bool, pub sort_order: i32, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskConfigAdminDisableInput { pub admin_user_id: String, pub task_id: String, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskConfigAdminListProcedureResult { pub ok: bool, pub entries: Vec, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileTaskConfigAdminProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileWalletLedgerSourceType { SnapshotSync, NewUserRegistrationReward, InviteInviterReward, InviteInviteeReward, PointsRecharge, AssetOperationConsume, AssetOperationRefund, RedeemCodeReward, PuzzleAuthorIncentiveClaim, DailyTaskReward, } impl RuntimeProfileWalletLedgerSourceType { pub fn as_str(&self) -> &'static str { match self { Self::SnapshotSync => "snapshot_sync", Self::NewUserRegistrationReward => "new_user_registration_reward", Self::InviteInviterReward => "invite_inviter_reward", Self::InviteInviteeReward => "invite_invitee_reward", Self::PointsRecharge => "points_recharge", Self::AssetOperationConsume => "asset_operation_consume", Self::AssetOperationRefund => "asset_operation_refund", Self::RedeemCodeReward => "redeem_code_reward", Self::PuzzleAuthorIncentiveClaim => "puzzle_author_incentive_claim", Self::DailyTaskReward => "daily_task_reward", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileRedeemCodeMode { Public, Unique, Private, } impl RuntimeProfileRedeemCodeMode { pub fn as_str(&self) -> &'static str { match self { Self::Public => "public", Self::Unique => "unique", Self::Private => "private", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileRechargeProductKind { Points, Membership, } impl RuntimeProfileRechargeProductKind { pub fn as_str(&self) -> &'static str { match self { Self::Points => "points", Self::Membership => "membership", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileMembershipStatus { Normal, Active, } impl RuntimeProfileMembershipStatus { pub fn as_str(&self) -> &'static str { match self { Self::Normal => "normal", Self::Active => "active", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileMembershipTier { Normal, Month, Season, Year, } impl RuntimeProfileMembershipTier { pub fn as_str(&self) -> &'static str { match self { Self::Normal => "normal", Self::Month => "month", Self::Season => "season", Self::Year => "year", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum RuntimeProfileRechargeOrderStatus { Pending, Paid, Failed, Closed, Refunded, } impl RuntimeProfileRechargeOrderStatus { pub fn as_str(&self) -> &'static str { match self { Self::Pending => "pending", Self::Paid => "paid", Self::Failed => "failed", Self::Closed => "closed", Self::Refunded => "refunded", } } } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeProductSnapshot { pub product_id: String, pub title: String, pub price_cents: u64, pub kind: RuntimeProfileRechargeProductKind, pub points_amount: u64, pub bonus_points: u64, pub duration_days: u32, pub badge_label: String, pub description: String, pub tier: RuntimeProfileMembershipTier, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeProductConfigSnapshot { pub product_id: String, pub title: String, pub price_cents: u64, pub kind: RuntimeProfileRechargeProductKind, pub points_amount: u64, pub bonus_points: u64, pub duration_days: u32, pub badge_label: String, pub description: String, pub tier: RuntimeProfileMembershipTier, pub enabled: bool, pub sort_order: i32, pub created_by: String, pub created_at_micros: i64, pub updated_by: String, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileMembershipBenefitSnapshot { pub benefit_name: String, pub normal_value: String, pub month_value: String, pub season_value: String, pub year_value: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileMembershipSnapshot { pub user_id: String, pub status: RuntimeProfileMembershipStatus, pub tier: RuntimeProfileMembershipTier, pub started_at_micros: Option, pub expires_at_micros: Option, pub updated_at_micros: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeOrderSnapshot { pub order_id: String, pub user_id: String, pub product_id: String, pub product_title: String, pub kind: RuntimeProfileRechargeProductKind, pub amount_cents: u64, pub status: RuntimeProfileRechargeOrderStatus, pub payment_channel: String, pub paid_at_micros: Option, pub provider_transaction_id: Option, pub created_at_micros: i64, pub points_delta: i64, pub membership_expires_at_micros: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeCenterSnapshot { pub user_id: String, pub wallet_balance: u64, pub membership: RuntimeProfileMembershipSnapshot, pub point_products: Vec, pub membership_products: Vec, pub benefits: Vec, pub latest_order: Option, pub has_points_recharged: bool, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RuntimeProfileMembershipPurchaseUpdate { pub started_at_micros: i64, pub expires_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeCenterProcedureResult { pub ok: bool, pub record: Option, pub order: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeProductAdminListInput { pub admin_user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeProductAdminUpsertInput { pub admin_user_id: String, pub product_id: String, pub title: String, pub price_cents: u64, pub kind: RuntimeProfileRechargeProductKind, pub points_amount: u64, pub bonus_points: u64, pub duration_days: u32, pub badge_label: String, pub description: String, pub tier: RuntimeProfileMembershipTier, pub enabled: bool, pub sort_order: i32, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeProductAdminListProcedureResult { pub ok: bool, pub entries: Vec, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeProductAdminProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeCenterGetInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeOrderGetInput { pub order_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeOrderCreateInput { pub user_id: String, pub product_id: String, pub payment_channel: String, pub created_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRechargeOrderPaidInput { pub order_id: String, pub paid_at_micros: i64, pub provider_transaction_id: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileWalletLedgerEntrySnapshot { pub wallet_ledger_id: String, pub user_id: String, pub amount_delta: i64, pub balance_after: u64, pub source_type: RuntimeProfileWalletLedgerSourceType, pub created_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileWalletLedgerProcedureResult { pub ok: bool, pub entries: Vec, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileWalletAdjustmentProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileWalletLedgerListInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileWalletAdjustmentInput { pub user_id: String, pub amount: u64, pub ledger_id: String, pub created_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRewardCodeRedeemInput { pub user_id: String, pub code: String, pub redeemed_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRewardCodeRedeemSnapshot { pub wallet_balance: u64, pub amount_granted: u64, pub ledger_entry: RuntimeProfileWalletLedgerEntrySnapshot, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRewardCodeRedeemProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRedeemCodeAdminUpsertInput { pub admin_user_id: String, pub code: String, pub mode: RuntimeProfileRedeemCodeMode, pub reward_points: u64, pub max_uses: u32, pub enabled: bool, pub allowed_user_ids: Vec, pub allowed_public_user_codes: Vec, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRedeemCodeAdminDisableInput { pub admin_user_id: String, pub code: String, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRedeemCodeAdminListInput { pub admin_user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRedeemCodeSnapshot { pub code: String, pub mode: RuntimeProfileRedeemCodeMode, pub reward_points: u64, pub max_uses: u32, pub global_used_count: u32, pub enabled: bool, pub allowed_user_ids: Vec, pub created_by: String, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRedeemCodeAdminProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileRedeemCodeAdminListProcedureResult { pub ok: bool, pub entries: Vec, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileInviteCodeAdminUpsertInput { pub admin_user_id: String, pub invite_code: String, pub metadata_json: String, pub starts_at_micros: Option, pub expires_at_micros: Option, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileInviteCodeAdminListInput { pub admin_user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileInviteCodeSnapshot { pub user_id: String, pub invite_code: String, pub metadata_json: String, pub starts_at_micros: Option, pub expires_at_micros: Option, pub created_at_micros: i64, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileInviteCodeAdminProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfileInviteCodeAdminListProcedureResult { pub ok: bool, pub entries: Vec, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralInvitedUserSnapshot { pub user_id: String, pub display_name: String, pub avatar_url: Option, pub bound_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralInviteCenterSnapshot { pub user_id: String, pub invite_code: String, pub invite_link_path: String, pub invited_count: u32, pub rewarded_invite_count: u32, pub today_inviter_reward_count: u32, pub today_inviter_reward_remaining: u32, pub reward_points: u64, pub invited_users: Vec, pub has_redeemed_code: bool, pub bound_inviter_user_id: Option, pub bound_at_micros: Option, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralInviteCenterProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralInviteCenterGetInput { pub user_id: String, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralRedeemInput { pub user_id: String, pub invite_code: String, pub updated_at_micros: i64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralRedeemSnapshot { pub center: RuntimeReferralInviteCenterSnapshot, pub invitee_reward_granted: bool, pub inviter_reward_granted: bool, pub invitee_balance_after: u64, pub inviter_balance_after: u64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeReferralRedeemProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfilePlayedWorldSnapshot { pub played_world_id: String, pub user_id: String, pub world_key: String, pub owner_user_id: Option, pub profile_id: Option, pub world_type: Option, pub world_title: String, pub world_subtitle: String, pub first_played_at_micros: i64, pub last_played_at_micros: i64, pub last_observed_play_time_ms: u64, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfilePlayStatsSnapshot { pub user_id: String, pub total_play_time_ms: u64, pub played_works: Vec, pub updated_at_micros: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfilePlayStatsProcedureResult { pub ok: bool, pub record: Option, pub error_message: Option, } #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RuntimeProfilePlayStatsGetInput { pub user_id: String, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeBrowseHistoryPreparedEntry { pub browse_history_id: String, pub user_id: String, pub owner_user_id: String, pub profile_id: String, pub world_name: String, pub subtitle: String, pub summary_text: String, pub cover_image_src: Option, pub theme_mode: RuntimeBrowseHistoryThemeMode, pub author_display_name: String, pub visited_at_micros: i64, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeBrowseHistoryRecord { pub browse_history_id: String, pub user_id: String, pub owner_user_id: String, pub profile_id: String, pub world_name: String, pub subtitle: String, pub summary_text: String, pub cover_image_src: Option, pub theme_mode: RuntimeBrowseHistoryThemeMode, pub author_display_name: String, pub visited_at: String, pub visited_at_micros: i64, pub created_at_micros: i64, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeSettingsRecord { pub user_id: String, pub music_volume: f32, pub platform_theme: RuntimePlatformTheme, pub created_at_micros: i64, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileDashboardRecord { pub user_id: String, pub wallet_balance: u64, pub total_play_time_ms: u64, pub played_world_count: u32, pub updated_at: Option, pub updated_at_micros: Option, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileWalletLedgerEntryRecord { pub wallet_ledger_id: String, pub user_id: String, pub amount_delta: i64, pub balance_after: u64, pub source_type: RuntimeProfileWalletLedgerSourceType, pub created_at: String, pub created_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfilePlayedWorldRecord { pub played_world_id: String, pub user_id: String, pub world_key: String, pub owner_user_id: Option, pub profile_id: Option, pub world_type: Option, pub world_title: String, pub world_subtitle: String, pub first_played_at: String, pub first_played_at_micros: i64, pub last_played_at: String, pub last_played_at_micros: i64, pub last_observed_play_time_ms: u64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfilePlayStatsRecord { pub user_id: String, pub total_play_time_ms: u64, pub played_works: Vec, pub updated_at: Option, pub updated_at_micros: Option, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileRechargeProductRecord { pub product_id: String, pub title: String, pub price_cents: u64, pub kind: RuntimeProfileRechargeProductKind, pub points_amount: u64, pub bonus_points: u64, pub duration_days: u32, pub badge_label: String, pub description: String, pub tier: RuntimeProfileMembershipTier, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileRechargeProductConfigRecord { pub product_id: String, pub title: String, pub price_cents: u64, pub kind: RuntimeProfileRechargeProductKind, pub points_amount: u64, pub bonus_points: u64, pub duration_days: u32, pub badge_label: String, pub description: String, pub tier: RuntimeProfileMembershipTier, pub enabled: bool, pub sort_order: i32, pub created_by: String, pub created_at: String, pub created_at_micros: i64, pub updated_by: String, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileMembershipBenefitRecord { pub benefit_name: String, pub normal_value: String, pub month_value: String, pub season_value: String, pub year_value: String, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileMembershipRecord { pub user_id: String, pub status: RuntimeProfileMembershipStatus, pub tier: RuntimeProfileMembershipTier, pub started_at: Option, pub started_at_micros: Option, pub expires_at: Option, pub expires_at_micros: Option, pub updated_at: Option, pub updated_at_micros: Option, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileRechargeOrderRecord { pub order_id: String, pub user_id: String, pub product_id: String, pub product_title: String, pub kind: RuntimeProfileRechargeProductKind, pub amount_cents: u64, pub status: RuntimeProfileRechargeOrderStatus, pub payment_channel: String, pub paid_at: Option, pub paid_at_micros: Option, pub provider_transaction_id: Option, pub created_at: String, pub created_at_micros: i64, pub points_delta: i64, pub membership_expires_at: Option, pub membership_expires_at_micros: Option, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileRechargeCenterRecord { pub user_id: String, pub wallet_balance: u64, pub membership: RuntimeProfileMembershipRecord, pub point_products: Vec, pub membership_products: Vec, pub benefits: Vec, pub latest_order: Option, pub has_points_recharged: bool, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileRewardCodeRedeemRecord { pub wallet_balance: u64, pub amount_granted: u64, pub ledger_entry: RuntimeProfileWalletLedgerEntryRecord, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileTaskConfigRecord { pub task_id: String, pub title: String, pub description: String, pub event_key: String, pub cycle: RuntimeProfileTaskCycle, pub scope_kind: RuntimeTrackingScopeKind, pub threshold: u32, pub reward_points: u64, pub enabled: bool, pub sort_order: i32, pub created_by: String, pub created_at: String, pub created_at_micros: i64, pub updated_by: String, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileTaskItemRecord { pub task_id: String, pub title: String, pub description: String, pub event_key: String, pub cycle: RuntimeProfileTaskCycle, pub threshold: u32, pub progress_count: u32, pub reward_points: u64, pub status: RuntimeProfileTaskStatus, pub day_key: i64, pub claimed_at: Option, pub claimed_at_micros: Option, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileTaskCenterRecord { pub user_id: String, pub day_key: i64, pub wallet_balance: u64, pub tasks: Vec, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileTaskClaimRecord { pub user_id: String, pub task_id: String, pub day_key: i64, pub reward_points: u64, pub wallet_balance: u64, pub ledger_entry: RuntimeProfileWalletLedgerEntryRecord, pub center: RuntimeProfileTaskCenterRecord, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileRedeemCodeRecord { pub code: String, pub mode: RuntimeProfileRedeemCodeMode, pub reward_points: u64, pub max_uses: u32, pub global_used_count: u32, pub enabled: bool, pub allowed_user_ids: Vec, pub created_by: String, pub created_at: String, pub created_at_micros: i64, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileInviteCodeRecord { pub user_id: String, pub invite_code: String, pub metadata_json: String, pub starts_at: Option, pub starts_at_micros: Option, pub expires_at: Option, pub expires_at_micros: Option, pub status: RuntimeProfileInviteCodeStatus, pub created_at: String, pub created_at_micros: i64, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeReferralInvitedUserRecord { pub user_id: String, pub display_name: String, pub avatar_url: Option, pub bound_at: String, pub bound_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeReferralInviteCenterRecord { pub user_id: String, pub invite_code: String, pub invite_link_path: String, pub invited_count: u32, pub rewarded_invite_count: u32, pub today_inviter_reward_count: u32, pub today_inviter_reward_remaining: u32, pub reward_points: u64, pub invited_users: Vec, pub has_redeemed_code: bool, pub bound_inviter_user_id: Option, pub bound_at: Option, pub bound_at_micros: Option, pub updated_at: String, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeReferralRedeemRecord { pub center: RuntimeReferralInviteCenterRecord, pub invitee_reward_granted: bool, pub inviter_reward_granted: bool, pub invitee_balance_after: u64, pub inviter_balance_after: u64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeSnapshotRecord { pub user_id: String, pub version: u32, pub saved_at: String, pub saved_at_micros: i64, pub bottom_tab: String, pub game_state: Value, pub current_story: Option, pub game_state_json: String, pub current_story_json: Option, pub created_at_micros: i64, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileSaveArchiveRecord { pub archive_id: String, pub user_id: String, pub world_key: String, pub owner_user_id: Option, pub profile_id: Option, pub world_type: Option, pub world_name: String, pub subtitle: String, pub summary_text: String, pub cover_image_src: Option, pub saved_at: String, pub saved_at_micros: i64, pub bottom_tab: String, pub game_state: Value, pub current_story: Option, pub game_state_json: String, pub current_story_json: Option, pub created_at_micros: i64, pub updated_at_micros: i64, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileWorldSnapshotMeta { pub world_key: String, pub owner_user_id: Option, pub profile_id: Option, pub world_type: Option, pub world_title: String, pub world_subtitle: String, } #[derive(Clone, Debug, PartialEq)] pub struct RuntimeProfileSaveArchiveMeta { pub world_key: String, pub owner_user_id: Option, pub profile_id: Option, pub world_type: Option, pub world_name: String, pub subtitle: String, pub summary_text: String, pub cover_image_src: Option, }