Files
Genarrative/server-rs/crates/module-runtime/src/domain.rs
T
suzmii 736a1b6ac6
Project CI / Repository checks (pull_request) Successful in 2m36s
Project CI / Frontend tests (pull_request) Successful in 3m15s
Project CI / Backend tests (pull_request) Successful in 7m35s
Project CI / Native shell tests (pull_request) Failing after 7m43s
接入 LLM Router 累计额度结算
按 Router used_quota 累计值与首次基线结算泥点
新增原子 checkpoint 事务及 llm_router_consume 钱包流水
同步额度查询校验、前端展示、生成绑定和技术文档
2026-09-06 00:36:31 +08:00

2847 lines
93 KiB
Rust

//! 运行时领域模型。
//!
//! 这里只保留运行时设置、快照、个人页状态、钱包流水、存档和浏览历史等
//! 纯领域事实与值对象;SpacetimeDB client 与 HTTP response 不进入本文件。
use serde::{Deserialize, Serialize};
#[cfg(any())]
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;
#[cfg(any())]
pub const DEFAULT_BROWSE_HISTORY_AUTHOR_DISPLAY_NAME: &str = "玩家";
#[cfg(any())]
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 = 100;
pub const PROFILE_WALLET_CONFIG_GLOBAL_ID: &str = "profile_wallet";
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 PROFILE_DEFAULT_DAILY_FREE_POINTS_PER_DAY: u64 = 20;
#[cfg(any())]
pub const SAVE_SNAPSHOT_VERSION: u32 = 2;
#[cfg(any())]
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_MINI_PROGRAM_VIRTUAL: &str = "wechat_mp_virtual";
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_JSAPI: &str = "wechat_jsapi";
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_RECHARGE_ORDER_EXPIRATION_SECONDS: i64 = 5 * 60;
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;
#[cfg(any())]
pub const CREATION_ENTRY_CONFIG_GLOBAL_ID: &str = "platform_creation_center";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_START_TITLE: &str = "新建作品";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_START_DESCRIPTION: &str = "选择模板后进入对应的创作表单。";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_START_IDLE_BADGE: &str = "模板 Tab";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_START_BUSY_BADGE: &str = "正在开启";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_MODAL_TITLE: &str = "选择创作类型";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_MODAL_DESCRIPTION: &str = "先选玩法类型,再进入对应创作工作台。";
/// 创作模板分类缺省回退到推荐,不再把真实作品维度的“最近创作”种成模板页签。
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_CATEGORY_ID: &str = "recommended";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_CATEGORY_LABEL: &str = "热门推荐";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_EVENT_TITLE: &str = "主题创作赛";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_EVENT_DESCRIPTION: &str = "用温暖的色彩,捏出秋天的故事。";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_EVENT_COVER_IMAGE_SRC: &str =
"/creation-type-references/puzzle.webp";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_EVENT_PRIZE_POOL_MUD_POINTS: u64 = 58_000;
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_EVENT_STARTS_AT_TEXT: &str = "2024.10.20 10:00";
#[cfg(any())]
pub const DEFAULT_CREATION_ENTRY_EVENT_ENDS_AT_TEXT: &str = "2024.11.20 23:59";
/// 后台创作入口公告最多允许配置的轮播条数。
#[cfg(any())]
pub const CREATION_ENTRY_EVENT_BANNERS_MAX_COUNT: usize = 8;
/// 单条 HTML 公告的代码大小上限,避免后台误贴超大片段拖慢入口页。
#[cfg(any())]
pub const CREATION_ENTRY_EVENT_BANNER_HTML_CODE_MAX_BYTES: usize = 12_000;
/// 公开作品互动配置最多允许覆盖的 sourceType 数量。
#[cfg(any())]
pub const PUBLIC_WORK_INTERACTION_CONFIG_MAX_COUNT: usize = 32;
pub const FEATURE_GATE_KEY_MAX_CHARS: usize = 128;
pub const FEATURE_GATE_DESCRIPTION_MAX_CHARS: usize = 240;
pub const FEATURE_GATE_LIST_MAX_COUNT: usize = 500;
pub const FEATURE_GATE_LIST_ITEM_MAX_CHARS: usize = 128;
#[cfg(any())]
#[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(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryTypeModalSnapshot {
pub title: String,
pub description: String,
}
/// 创作入口公告快照,支持 HTML 公告渲染和旧结构化 banner 兼容。
#[cfg(any())]
#[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,
pub render_mode: String,
pub html_code: Option<String>,
}
/// 单类公开作品互动配置,控制作品详情页点赞 / 改造入口与后端动作熔断。
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct PublicWorkInteractionConfigSnapshot {
pub source_type: String,
pub like_enabled: bool,
pub remix_enabled: bool,
pub like_disabled_message: String,
pub remix_disabled_message: String,
}
#[cfg(any())]
#[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,
pub unified_creation_spec_json: Option<String>,
}
/// 创作入口全局配置快照,供前台入口页和后台配置页共同读取。
#[cfg(any())]
#[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,
/// 底部加号创作入口页的多公告 JSON 配置;旧库为空时由应用层兜底。
pub event_banners_json: Option<String>,
pub creation_types: Vec<CreationEntryTypeSnapshot>,
pub updated_at_micros: i64,
/// 公开作品点赞 / 改造能力 JSON 配置;旧库为空时由应用层兜底。
pub public_work_interactions_json: Option<String>,
}
#[cfg(any())]
#[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,
pub unified_creation_spec_json: Option<String>,
}
/// 后台保存创作入口多公告表单序列化结果的领域输入。
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryEventBannersAdminUpsertInput {
/// 持久化字段沿用 JSON 字符串,内容由后台表单生成。
pub event_banners_json: String,
}
/// 后台保存公开作品互动能力表单序列化结果的领域输入。
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct PublicWorkInteractionConfigAdminUpsertInput {
/// 持久化字段沿用 JSON 字符串,内容由后台表单生成。
pub public_work_interactions_json: String,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryConfigProcedureResult {
pub ok: bool,
pub record: Option<CreationEntryConfigSnapshot>,
pub error_message: Option<String>,
}
/// 通用功能灰度配置,当前首个业务接入点是创作入口 `creation-entry:<id>`。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct FeatureGateConfigSnapshot {
pub gate_key: String,
pub enabled: bool,
pub rollout_percent: u32,
pub allow_user_ids: Vec<String>,
pub allow_user_tags: Vec<String>,
pub deny_user_ids: Vec<String>,
pub description: String,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct FeatureGateConfigAdminUpsertInput {
pub gate_key: String,
pub enabled: bool,
pub rollout_percent: u32,
pub allow_user_ids: Vec<String>,
pub allow_user_tags: Vec<String>,
pub deny_user_ids: Vec<String>,
pub description: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct FeatureGateConfigProcedureResult {
pub ok: bool,
pub records: Vec<FeatureGateConfigSnapshot>,
pub error_message: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct FeatureGateUserContext {
pub user_id: Option<String>,
pub user_tags: Vec<String>,
}
/// 后台作品可见性列表项。
///
/// source_type/profile_id 是后台统一操作键;少数玩法的 profile_id 会映射到底层
/// session_id 或 work_id,避免后台了解每个源表的主键差异。
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AdminWorkVisibilitySnapshot {
pub source_type: String,
pub work_id: String,
pub profile_id: String,
pub source_session_id: Option<String>,
pub public_work_code: String,
pub owner_user_id: String,
pub author_display_name: String,
pub title: String,
pub subtitle: String,
pub cover_image_src: Option<String>,
pub visible: bool,
pub published_at_micros: Option<i64>,
pub updated_at_micros: i64,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AdminWorkVisibilityListInput {
pub admin_user_id: String,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AdminWorkVisibilityUpdateInput {
pub admin_user_id: String,
pub source_type: String,
pub profile_id: String,
pub visible: bool,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AdminWorkVisibilityListProcedureResult {
pub ok: bool,
pub entries: Vec<AdminWorkVisibilitySnapshot>,
pub error_message: Option<String>,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AdminWorkVisibilityProcedureResult {
pub ok: bool,
pub record: Option<AdminWorkVisibilitySnapshot>,
pub error_message: Option<String>,
}
/// 分析日期维表的纯领域快照。
///
/// 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<Self> {
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<AnalyticsBucketMetric>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnalyticsMetricQueryProcedureResult {
pub ok: bool,
pub buckets: Vec<AnalyticsBucketMetric>,
pub error_message: Option<String>,
}
/// 运行时平台主题。
///
/// 当前只冻结 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(any())]
#[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(any())]
#[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(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshotGetInput {
pub user_id: String,
}
#[cfg(any())]
#[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(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshotDeleteInput {
pub user_id: String,
}
#[cfg(any())]
#[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(any())]
#[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(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileSaveArchiveListInput {
pub user_id: String,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileSaveArchiveResumeInput {
pub user_id: String,
pub world_key: String,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
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(any())]
#[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(any())]
#[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(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeBrowseHistoryListInput {
pub user_id: String,
}
#[cfg(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeBrowseHistoryClearInput {
pub user_id: String,
}
#[cfg(any())]
#[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(any())]
#[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>,
pub daily_free_points: RuntimeProfileDailyFreePointsSnapshot,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileDailyFreePointsSnapshot {
pub day_key: i64,
pub granted_points: u64,
pub remaining_points: u64,
pub resets_at_micros: i64,
pub updated_at_micros: i64,
pub reset_points: u64,
}
#[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, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConfigSnapshot {
pub config_id: String,
pub initial_mud_points: u64,
pub created_by: String,
pub created_at_micros: i64,
pub updated_by: String,
pub updated_at_micros: i64,
pub daily_free_points_per_day: u64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConfigAdminGetInput {
pub admin_user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConfigAdminUpsertInput {
pub admin_user_id: String,
pub initial_mud_points: u64,
pub updated_at_micros: i64,
pub daily_free_points_per_day: u64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConfigAdminProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileWalletConfigSnapshot>,
pub error_message: Option<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<String>,
pub evidence_items: Vec<RuntimeProfileFeedbackEvidenceSnapshot>,
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<String>,
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<RuntimeProfileFeedbackSubmissionSnapshot>,
pub error_message: Option<String>,
}
#[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<String>,
pub evidence_items: Vec<RuntimeProfileFeedbackEvidenceRecord>,
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<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, 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<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 RuntimeTrackingEventProcedureResult {
pub ok: bool,
pub error_message: Option<String>,
}
#[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<String>,
}
#[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 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<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,
MembershipPeriodGrant,
MembershipPeriodReset,
DailyFreeGrant,
DailyFreeReset,
RechargeRefundRecovery,
LlmRouterConsume,
}
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::MembershipPeriodGrant => "membership_period_grant",
Self::MembershipPeriodReset => "membership_period_reset",
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",
Self::DailyFreeGrant => "daily_free_grant",
Self::DailyFreeReset => "daily_free_reset",
Self::RechargeRefundRecovery => "recharge_refund_recovery",
Self::LlmRouterConsume => "llm_router_consume",
}
}
}
#[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,
Starter,
Basic,
Pro,
Ultimate,
}
impl RuntimeProfileMembershipTier {
pub fn as_str(&self) -> &'static str {
match self {
Self::Normal => "normal",
Self::Month => "month",
Self::Season => "season",
Self::Year => "year",
Self::Starter => "starter",
Self::Basic => "basic",
Self::Pro => "pro",
Self::Ultimate => "ultimate",
}
}
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeProfileRechargeOrderStatus {
Pending,
Paid,
Failed,
Closed,
Refunded,
Expired,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeProfileRechargeRefundStatus {
Processing,
Success,
Abnormal,
Closed,
}
impl RuntimeProfileRechargeRefundStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Processing => "processing",
Self::Success => "success",
Self::Abnormal => "abnormal",
Self::Closed => "closed",
}
}
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeProfileRechargeRefundObservationSource {
ApiRequest,
Callback,
Query,
TradeBill,
}
impl RuntimeProfileRechargeRefundObservationSource {
pub fn as_str(&self) -> &'static str {
match self {
Self::ApiRequest => "api_request",
Self::Callback => "callback",
Self::Query => "query",
Self::TradeBill => "trade_bill",
}
}
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeProfileRechargeRefundRecoveryStatus {
Pending,
Applied,
Shortfall,
ManualReview,
NotApplicable,
}
impl RuntimeProfileRechargeRefundRecoveryStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Pending => "pending",
Self::Applied => "applied",
Self::Shortfall => "shortfall",
Self::ManualReview => "manual_review",
Self::NotApplicable => "not_applicable",
}
}
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeProfileRechargeRefundHoldStatus {
Active,
Settled,
Released,
}
impl RuntimeProfileRechargeRefundHoldStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Active => "active",
Self::Settled => "settled",
Self::Released => "released",
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RuntimeProfileRechargeRefundStatusTransition {
Unchanged,
Advance,
Conflict,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct RuntimeProfileRechargeRefundSettlementPlan {
pub successful_refund_count: u32,
pub cumulative_success_refund_cents: u64,
pub order_fully_refunded: bool,
pub target_recovery_points: u64,
pub incremental_target_recovery_points: u64,
}
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",
Self::Expired => "expired",
}
}
}
#[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,
pub membership_period_points: u64,
pub membership_period_days: u32,
pub membership_queue_limit: u32,
pub membership_discount_bps: u32,
}
#[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 membership_period_points: u64,
pub membership_period_days: u32,
pub membership_queue_limit: u32,
pub membership_discount_bps: u32,
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,
pub starter_value: String,
pub basic_value: String,
pub pro_value: String,
pub ultimate_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>,
pub cycle_started_at_micros: Option<i64>,
pub cycle_resets_at_micros: Option<i64>,
pub cycle_granted_points: u64,
pub cycle_remaining_points: u64,
pub cycle_period_days: u32,
}
#[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<i64>,
pub provider_transaction_id: Option<String>,
pub created_at_micros: i64,
pub points_delta: i64,
pub membership_expires_at_micros: Option<i64>,
pub expired_at_micros: Option<i64>,
pub expiration_checked_at_micros: Option<i64>,
pub expiration_provider_state: Option<String>,
pub expiration_last_error: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundSnapshot {
pub out_refund_no: String,
pub provider_refund_id: String,
pub order_id: String,
pub provider_transaction_id: String,
pub user_id: Option<String>,
pub provider_status: RuntimeProfileRechargeRefundStatus,
pub total_cents: u64,
pub refund_cents: u64,
pub payer_total_cents: u64,
pub payer_refund_cents: u64,
pub success_at_micros: Option<i64>,
pub first_observed_at_micros: i64,
pub updated_at_micros: i64,
pub last_observation_source: RuntimeProfileRechargeRefundObservationSource,
pub last_observation_id: String,
pub order_settled_at_micros: Option<i64>,
pub target_recovery_points: u64,
pub recovered_points: u64,
pub unrecovered_points: u64,
pub recovery_status: RuntimeProfileRechargeRefundRecoveryStatus,
pub last_recovery_ledger_id: Option<String>,
pub last_error_code: Option<String>,
pub manual_review_resolved_by_admin_user_id: Option<String>,
pub manual_review_resolution_reason: Option<String>,
pub manual_review_resolved_at_micros: Option<i64>,
pub manual_review_resolved_error_code: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundObservationSnapshot {
pub observation_id: String,
pub out_refund_no: String,
pub provider_refund_id: String,
pub order_id: String,
pub provider_transaction_id: String,
pub source: RuntimeProfileRechargeRefundObservationSource,
pub provider_status: RuntimeProfileRechargeRefundStatus,
pub total_cents: u64,
pub refund_cents: u64,
pub payer_total_cents: u64,
pub payer_refund_cents: u64,
pub success_at_micros: Option<i64>,
pub notification_ref: Option<String>,
pub payload_fingerprint: String,
pub resolution_code: String,
pub observed_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderRefundSettlementSnapshot {
pub order_id: String,
pub user_id: String,
pub successful_refund_count: u32,
pub cumulative_success_refund_cents: u64,
pub target_recovery_points: u64,
pub recovered_points: u64,
pub unrecovered_points: u64,
pub recovery_status: RuntimeProfileRechargeRefundRecoveryStatus,
pub wallet_frozen: bool,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldSnapshot {
pub out_refund_no: String,
pub order_id: String,
pub user_id: String,
pub refund_cents: u64,
pub held_points: u64,
pub status: RuntimeProfileRechargeRefundHoldStatus,
pub admin_user_id: String,
pub reason: String,
pub created_at_micros: i64,
pub updated_at_micros: i64,
pub settled_at_micros: Option<i64>,
pub released_at_micros: Option<i64>,
pub released_by_admin_user_id: Option<String>,
pub release_reason: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletManualRestrictionSnapshot {
pub user_id: String,
pub frozen: bool,
pub reason: String,
pub created_by_admin_user_id: String,
pub created_at_micros: i64,
pub updated_by_admin_user_id: String,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileAdminWalletSnapshot {
pub user_id: String,
pub total_balance: u64,
pub spendable_balance: u64,
pub daily_free_points: u64,
pub membership_limited_points: u64,
pub permanent_points: u64,
pub held_points: u64,
pub refund_debt_points: u64,
pub manual_frozen: bool,
pub refund_debt_frozen: bool,
pub wallet_frozen: bool,
pub manual_restriction: Option<RuntimeProfileWalletManualRestrictionSnapshot>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileAdminWalletDetailRecord {
pub wallet: RuntimeProfileAdminWalletSnapshot,
pub historical_consumed_points: u64,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileWalletConsumptionReconcileRecord {
pub user_id: String,
pub previous_historical_consumed_points: Option<u64>,
pub historical_consumed_points: u64,
pub changed: bool,
pub reconciled_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileWalletConsumptionProjectionInitializeRecord {
pub scanned_ledger_count: u64,
pub projected_user_count: u64,
pub inserted_projection_count: u64,
pub updated_projection_count: u64,
pub initialized_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderAdminEntrySnapshot {
pub order: RuntimeProfileRechargeOrderSnapshot,
pub settlement: Option<RuntimeProfileRechargeOrderRefundSettlementSnapshot>,
pub refunds: Vec<RuntimeProfileRechargeRefundSnapshot>,
pub active_hold: Option<RuntimeProfileRechargeRefundHoldSnapshot>,
pub wallet: RuntimeProfileAdminWalletSnapshot,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundBillCheckpointSnapshot {
pub checkpoint_id: String,
pub bill_date: String,
pub bill_hash: String,
pub processed_refund_count: u32,
pub completed_at_micros: i64,
pub updated_at_micros: 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,
pub daily_free_points: RuntimeProfileDailyFreePointsSnapshot,
}
#[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 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 membership_period_points: u64,
pub membership_period_days: u32,
pub membership_queue_limit: u32,
pub membership_discount_bps: u32,
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<RuntimeProfileRechargeProductConfigSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeProductAdminProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileRechargeProductConfigSnapshot>,
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 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<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundObservationInput {
pub observation_id: String,
pub source: RuntimeProfileRechargeRefundObservationSource,
pub notification_ref: Option<String>,
pub payload_fingerprint: String,
pub out_refund_no: String,
pub provider_refund_id: String,
pub order_id: String,
pub provider_transaction_id: String,
pub provider_status: RuntimeProfileRechargeRefundStatus,
pub total_cents: u64,
pub refund_cents: u64,
pub payer_total_cents: u64,
pub payer_refund_cents: u64,
pub success_at_micros: Option<i64>,
pub observed_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundGetInput {
pub out_refund_no: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundReconciliationListInput {
pub limit: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderAdminListInput {
pub order_id: Option<String>,
pub user_id: Option<String>,
pub provider_transaction_id: Option<String>,
pub payment_channel: Option<String>,
pub status: Option<RuntimeProfileRechargeOrderStatus>,
pub created_after_micros: Option<i64>,
pub created_before_micros: Option<i64>,
pub limit: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldPreviewInput {
pub order_id: String,
pub refund_cents: u64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldPrepareInput {
pub order_id: String,
pub out_refund_no: String,
pub refund_cents: u64,
pub admin_user_id: String,
pub reason: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldReleaseInput {
pub out_refund_no: String,
pub admin_user_id: String,
pub release_reason: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldListInput {
pub limit: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundManualReviewResolveInput {
pub out_refund_no: String,
pub admin_user_id: String,
pub reason: String,
pub expected_error_code: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileAdminWalletGetInput {
pub user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConsumptionReconcileInput {
pub user_id: String,
pub admin_user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConsumptionProjectionInitializeInput {
pub admin_user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletManualRestrictionUpsertInput {
pub user_id: String,
pub frozen: bool,
pub reason: String,
pub admin_user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundBillCheckpointGetInput {
pub checkpoint_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundBillCheckpointAdvanceInput {
pub checkpoint_id: String,
pub bill_date: String,
pub bill_hash: String,
pub processed_refund_count: u32,
pub completed_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderCloseInput {
pub order_id: String,
pub closed_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationClaimInput {
pub worker_id: String,
pub now_micros: i64,
pub lease_expires_at_micros: i64,
pub limit: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationCompleteInput {
pub order_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationCheckListInput {
pub limit: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationCheckInput {
pub order_id: String,
pub checked_at_micros: Option<i64>,
pub provider_state: Option<String>,
pub last_error: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationScheduleSnapshot {
pub order_id: String,
pub user_id: String,
pub scheduled_at_micros: i64,
pub lease_owner: Option<String>,
pub lease_expires_at_micros: Option<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 RuntimeProfileRechargeOrderExpirationClaimProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileRechargeOrderExpirationScheduleSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationCompleteProcedureResult {
pub ok: bool,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationCheckListProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileRechargeOrderSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderExpirationCheckProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileRechargeOrderSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileRechargeRefundSnapshot>,
pub settlement: Option<RuntimeProfileRechargeOrderRefundSettlementSnapshot>,
pub duplicate: bool,
pub resolution_code: String,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundListProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileRechargeRefundSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeOrderAdminListProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileRechargeOrderAdminEntrySnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileRechargeRefundHoldSnapshot>,
pub order: Option<RuntimeProfileRechargeOrderSnapshot>,
pub settlement: Option<RuntimeProfileRechargeOrderRefundSettlementSnapshot>,
pub wallet: Option<RuntimeProfileAdminWalletSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundHoldListProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileRechargeRefundHoldSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileAdminWalletProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileAdminWalletSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileAdminWalletDetailProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileAdminWalletSnapshot>,
pub historical_consumed_points: u64,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConsumptionReconcileSnapshot {
pub user_id: String,
pub previous_historical_consumed_points: Option<u64>,
pub historical_consumed_points: u64,
pub changed: bool,
pub reconciled_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConsumptionReconcileProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileWalletConsumptionReconcileSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConsumptionProjectionInitializeSnapshot {
pub scanned_ledger_count: u64,
pub projected_user_count: u64,
pub inserted_projection_count: u64,
pub updated_projection_count: u64,
pub initialized_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletConsumptionProjectionInitializeProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileWalletConsumptionProjectionInitializeSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeRefundBillCheckpointProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileRechargeRefundBillCheckpointSnapshot>,
pub error_message: Option<String>,
}
#[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,
pub metadata_json: String,
}
#[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 RuntimeProfileWalletRefundOutboxEnqueueInput {
pub owner_user_id: String,
pub amount: u64,
pub refund_ledger_id: String,
pub created_at_micros: i64,
pub asset_kind: String,
pub asset_id: String,
pub settlement_reason: String,
pub external_generation_job_id: Option<String>,
pub external_generation_claim_attempt: Option<u32>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletRefundOutboxProcessInput {
pub worker_id: String,
pub limit: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileWalletRefundOutboxProcedureResult {
pub ok: bool,
pub enqueued_count: u32,
pub processed_count: u32,
pub retry_count: u32,
pub failed_count: u32,
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,
pub metadata_json: String,
}
#[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 starts_at_micros: Option<i64>,
pub expires_at_micros: Option<i64>,
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,
pub starts_at_micros: Option<i64>,
pub expires_at_micros: Option<i64>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileCodeOperationSnapshot {
pub operation_id: String,
pub code_kind: String,
pub code: String,
pub action: String,
pub operator_user_id: String,
pub created_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 operations: Vec<RuntimeProfileCodeOperationSnapshot>,
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 starts_at_micros: Option<i64>,
pub expires_at_micros: Option<i64>,
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<i64>,
pub expires_at_micros: Option<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 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 operations: Vec<RuntimeProfileCodeOperationSnapshot>,
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(any())]
#[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(any())]
#[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(any())]
#[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(any())]
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfilePlayStatsGetInput {
pub user_id: String,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
#[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>,
pub daily_free_points: RuntimeProfileDailyFreePointsRecord,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileDailyFreePointsRecord {
pub day_key: i64,
pub granted_points: u64,
pub remaining_points: u64,
pub resets_at: String,
pub resets_at_micros: i64,
pub updated_at: String,
pub updated_at_micros: i64,
pub reset_points: u64,
}
#[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,
pub metadata_json: String,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
#[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,
pub membership_period_points: u64,
pub membership_period_days: u32,
pub membership_queue_limit: u32,
pub membership_discount_bps: u32,
}
#[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 membership_period_points: u64,
pub membership_period_days: u32,
pub membership_queue_limit: u32,
pub membership_discount_bps: u32,
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 RuntimeProfileWalletConfigRecord {
pub config_id: String,
pub initial_mud_points: u64,
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,
pub daily_free_points_per_day: u64,
}
#[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,
pub starter_value: String,
pub basic_value: String,
pub pro_value: String,
pub ultimate_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>,
pub cycle_started_at: Option<String>,
pub cycle_started_at_micros: Option<i64>,
pub cycle_resets_at: Option<String>,
pub cycle_resets_at_micros: Option<i64>,
pub cycle_granted_points: u64,
pub cycle_remaining_points: u64,
pub cycle_period_days: u32,
}
#[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<String>,
pub paid_at_micros: Option<i64>,
pub provider_transaction_id: Option<String>,
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>,
pub expired_at: Option<String>,
pub expired_at_micros: Option<i64>,
pub expiration_checked_at: Option<String>,
pub expiration_checked_at_micros: Option<i64>,
pub expiration_provider_state: Option<String>,
pub expiration_last_error: Option<String>,
}
#[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,
pub daily_free_points: RuntimeProfileDailyFreePointsRecord,
}
#[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,
pub starts_at: Option<String>,
pub starts_at_micros: Option<i64>,
pub expires_at: Option<String>,
pub expires_at_micros: Option<i64>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileCodeOperationRecord {
pub operation_id: String,
pub code_kind: String,
pub code: String,
pub action: String,
pub operator_user_id: String,
pub created_at: String,
pub created_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileRedeemCodeAdminListRecord {
pub entries: Vec<RuntimeProfileRedeemCodeRecord>,
pub operations: Vec<RuntimeProfileCodeOperationRecord>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileInviteCodeAdminListRecord {
pub entries: Vec<RuntimeProfileInviteCodeRecord>,
pub operations: Vec<RuntimeProfileCodeOperationRecord>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileInviteCodeRecord {
pub user_id: String,
pub invite_code: String,
pub metadata_json: String,
pub starts_at: Option<String>,
pub starts_at_micros: Option<i64>,
pub expires_at: Option<String>,
pub expires_at_micros: Option<i64>,
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<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,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
#[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,
}
#[cfg(any())]
#[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>,
}