use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize)]
pub struct Quota {
pub used: u64,
pub total: u64,
#[serde(default)]
pub storage_pack_total: Option<u64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct UserSettings {
#[serde(default)]
pub group_expires: Option<String>,
#[serde(default)]
pub open_id: Option<Vec<OpenIDInfo>>,
#[serde(default)]
pub version_retention_enabled: bool,
#[serde(default)]
pub version_retention_ext: Option<Vec<String>>,
#[serde(default)]
pub version_retention_max: Option<i64>,
#[serde(default)]
pub passwordless: bool,
#[serde(default)]
pub two_fa_enabled: bool,
#[serde(default)]
pub passkeys: Option<Vec<Passkey>>,
#[serde(default)]
pub login_activity: Option<Vec<LoginActivity>>,
#[serde(default)]
pub storage_packs: Vec<StoragePack>,
#[serde(default)]
pub credit: i64,
#[serde(default)]
pub disable_view_sync: bool,
#[serde(default)]
pub share_links_in_profile: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct OpenIDInfo {
#[serde(default)]
pub provider: i32,
#[serde(default)]
pub linked_at: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct Passkey {
#[serde(default)]
pub id: String,
#[serde(default)]
pub name: String,
#[serde(default)]
pub used_at: Option<String>,
#[serde(default)]
pub created_at: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct LoginActivity {
#[serde(default)]
pub created_at: String,
#[serde(default)]
pub ip: String,
#[serde(default)]
pub browser: String,
#[serde(default)]
pub device: String,
#[serde(default)]
pub os: String,
#[serde(default)]
pub login_with: String,
#[serde(default)]
pub open_id_provider: i32,
#[serde(default)]
pub success: bool,
#[serde(default)]
pub webdav: bool,
}
#[derive(Debug, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct StoragePack {
#[serde(default)]
pub name: String,
#[serde(default)]
pub active_since: String,
#[serde(default)]
pub expire_at: String,
#[serde(default)]
pub size: i64,
}
#[derive(Debug, Serialize)]
pub struct UpdateProfileRequest<'a> {
pub nickname: Option<&'a str>,
pub email: Option<&'a str>,
pub avatar: Option<&'a str>,
}
#[derive(Debug, Serialize)]
pub struct ChangePasswordRequest<'a> {
pub current_password: &'a str,
pub new_password: &'a str,
}
#[derive(Debug, Serialize)]
pub struct SearchUserRequest<'a> {
pub query: &'a str,
pub page: Option<u32>,
pub page_size: Option<u32>,
}
#[derive(Debug, Serialize)]
pub struct UpdateUserSettingRequest<'a> {
pub key: &'a str,
pub value: &'a str,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CreditChangeRecord {
pub id: String,
pub amount: i64,
pub reason: String,
pub created_at: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PaymentRecord {
pub id: String,
pub amount: f64,
pub method: String,
pub status: String,
pub created_at: String,
pub transaction_id: Option<String>,
}