1394 lines
44 KiB
Rust
1394 lines
44 KiB
Rust
//! 运行时领域模型。
|
||
//!
|
||
//! 这里只保留运行时设置、快照、个人页状态、钱包流水、存档和浏览历史等
|
||
//! 纯领域事实与值对象;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 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";
|
||
|
||
/// 运行时平台主题。
|
||
///
|
||
/// 当前只冻结 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<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 RuntimeSnapshotProcedureResult {
|
||
pub ok: bool,
|
||
pub record: Option<RuntimeSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
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<String>,
|
||
pub profile_id: Option<String>,
|
||
pub world_type: Option<String>,
|
||
pub world_name: String,
|
||
pub subtitle: String,
|
||
pub summary_text: String,
|
||
pub cover_image_src: Option<String>,
|
||
pub saved_at_micros: i64,
|
||
pub bottom_tab: String,
|
||
pub game_state_json: String,
|
||
pub current_story_json: Option<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 RuntimeProfileSaveArchiveProcedureResult {
|
||
pub ok: bool,
|
||
pub entries: Vec<RuntimeProfileSaveArchiveSnapshot>,
|
||
pub record: Option<RuntimeProfileSaveArchiveSnapshot>,
|
||
pub current_snapshot: Option<RuntimeSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<Value>,
|
||
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<RuntimeSettingSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
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<RuntimeBrowseHistorySnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
pub summary_text: Option<String>,
|
||
pub cover_image_src: Option<String>,
|
||
pub theme_mode: Option<String>,
|
||
pub author_display_name: Option<String>,
|
||
pub visited_at: Option<String>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeBrowseHistorySyncInput {
|
||
pub user_id: String,
|
||
pub entries: Vec<RuntimeBrowseHistoryWriteInput>,
|
||
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<i64>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeProfileDashboardProcedureResult {
|
||
pub ok: bool,
|
||
pub record: Option<RuntimeProfileDashboardSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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 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<Self> {
|
||
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<Self> {
|
||
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, 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<String>,
|
||
pub owner_user_id: Option<String>,
|
||
pub profile_id: Option<String>,
|
||
pub module_key: Option<String>,
|
||
pub metadata_json: String,
|
||
pub occurred_at_micros: i64,
|
||
}
|
||
|
||
#[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<i64>,
|
||
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<RuntimeProfileTaskItemSnapshot>,
|
||
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<RuntimeProfileTaskCenterSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<RuntimeProfileTaskClaimSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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 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<RuntimeProfileTaskConfigSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeProfileTaskConfigAdminProcedureResult {
|
||
pub ok: bool,
|
||
pub record: Option<RuntimeProfileTaskConfigSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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 {
|
||
Paid,
|
||
}
|
||
|
||
impl RuntimeProfileRechargeOrderStatus {
|
||
pub fn as_str(&self) -> &'static str {
|
||
match self {
|
||
Self::Paid => "paid",
|
||
}
|
||
}
|
||
}
|
||
|
||
#[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 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<i64>,
|
||
pub expires_at_micros: Option<i64>,
|
||
pub updated_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[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: i64,
|
||
pub created_at_micros: i64,
|
||
pub points_delta: i64,
|
||
pub membership_expires_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[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<RuntimeProfileRechargeProductSnapshot>,
|
||
pub membership_products: Vec<RuntimeProfileRechargeProductSnapshot>,
|
||
pub benefits: Vec<RuntimeProfileMembershipBenefitSnapshot>,
|
||
pub latest_order: Option<RuntimeProfileRechargeOrderSnapshot>,
|
||
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<RuntimeProfileRechargeCenterSnapshot>,
|
||
pub order: Option<RuntimeProfileRechargeOrderSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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 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 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<RuntimeProfileWalletLedgerEntrySnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeProfileWalletAdjustmentProcedureResult {
|
||
pub ok: bool,
|
||
pub record: Option<RuntimeProfileDashboardSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<RuntimeProfileRewardCodeRedeemSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
pub allowed_public_user_codes: Vec<String>,
|
||
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<String>,
|
||
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<RuntimeProfileRedeemCodeSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeProfileRedeemCodeAdminListProcedureResult {
|
||
pub ok: bool,
|
||
pub entries: Vec<RuntimeProfileRedeemCodeSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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 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 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<RuntimeProfileInviteCodeSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeProfileInviteCodeAdminListProcedureResult {
|
||
pub ok: bool,
|
||
pub entries: Vec<RuntimeProfileInviteCodeSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
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<RuntimeReferralInvitedUserSnapshot>,
|
||
pub has_redeemed_code: bool,
|
||
pub bound_inviter_user_id: Option<String>,
|
||
pub bound_at_micros: Option<i64>,
|
||
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<RuntimeReferralInviteCenterSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<RuntimeReferralRedeemSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
pub profile_id: Option<String>,
|
||
pub world_type: Option<String>,
|
||
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<RuntimeProfilePlayedWorldSnapshot>,
|
||
pub updated_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||
pub struct RuntimeProfilePlayStatsProcedureResult {
|
||
pub ok: bool,
|
||
pub record: Option<RuntimeProfilePlayStatsSnapshot>,
|
||
pub error_message: Option<String>,
|
||
}
|
||
|
||
#[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<String>,
|
||
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<String>,
|
||
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<String>,
|
||
pub updated_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[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<String>,
|
||
pub profile_id: Option<String>,
|
||
pub world_type: Option<String>,
|
||
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<RuntimeProfilePlayedWorldRecord>,
|
||
pub updated_at: Option<String>,
|
||
pub updated_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[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 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<String>,
|
||
pub started_at_micros: Option<i64>,
|
||
pub expires_at: Option<String>,
|
||
pub expires_at_micros: Option<i64>,
|
||
pub updated_at: Option<String>,
|
||
pub updated_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[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: String,
|
||
pub paid_at_micros: i64,
|
||
pub created_at: String,
|
||
pub created_at_micros: i64,
|
||
pub points_delta: i64,
|
||
pub membership_expires_at: Option<String>,
|
||
pub membership_expires_at_micros: Option<i64>,
|
||
}
|
||
|
||
#[derive(Clone, Debug, PartialEq)]
|
||
pub struct RuntimeProfileRechargeCenterRecord {
|
||
pub user_id: String,
|
||
pub wallet_balance: u64,
|
||
pub membership: RuntimeProfileMembershipRecord,
|
||
pub point_products: Vec<RuntimeProfileRechargeProductRecord>,
|
||
pub membership_products: Vec<RuntimeProfileRechargeProductRecord>,
|
||
pub benefits: Vec<RuntimeProfileMembershipBenefitRecord>,
|
||
pub latest_order: Option<RuntimeProfileRechargeOrderRecord>,
|
||
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<String>,
|
||
pub claimed_at_micros: Option<i64>,
|
||
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<RuntimeProfileTaskItemRecord>,
|
||
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<String>,
|
||
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 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<String>,
|
||
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<RuntimeReferralInvitedUserRecord>,
|
||
pub has_redeemed_code: bool,
|
||
pub bound_inviter_user_id: Option<String>,
|
||
pub bound_at: Option<String>,
|
||
pub bound_at_micros: Option<i64>,
|
||
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<Value>,
|
||
pub game_state_json: String,
|
||
pub current_story_json: Option<String>,
|
||
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<String>,
|
||
pub profile_id: Option<String>,
|
||
pub world_type: Option<String>,
|
||
pub world_name: String,
|
||
pub subtitle: String,
|
||
pub summary_text: String,
|
||
pub cover_image_src: Option<String>,
|
||
pub saved_at: String,
|
||
pub saved_at_micros: i64,
|
||
pub bottom_tab: String,
|
||
pub game_state: Value,
|
||
pub current_story: Option<Value>,
|
||
pub game_state_json: String,
|
||
pub current_story_json: Option<String>,
|
||
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<String>,
|
||
pub profile_id: Option<String>,
|
||
pub world_type: Option<String>,
|
||
pub world_title: String,
|
||
pub world_subtitle: String,
|
||
}
|
||
|
||
#[derive(Clone, Debug, PartialEq)]
|
||
pub struct RuntimeProfileSaveArchiveMeta {
|
||
pub world_key: String,
|
||
pub owner_user_id: Option<String>,
|
||
pub profile_id: Option<String>,
|
||
pub world_type: Option<String>,
|
||
pub world_name: String,
|
||
pub subtitle: String,
|
||
pub summary_text: String,
|
||
pub cover_image_src: Option<String>,
|
||
}
|