use crate::mfa::MFAMethod;
use serde::Deserialize;
#[derive(Deserialize, Debug, Clone)]
#[cfg_attr(feature = "schemas", derive(JsonSchema))]
pub struct WebPushSubscription {
pub endpoint: String,
pub p256dh: String,
pub auth: String,
}
#[derive(Deserialize, Debug, Clone)]
pub struct Session {
#[serde(rename = "_id")]
pub id: String,
pub user_id: String,
pub token: String,
pub name: String,
pub subscription: Option<WebPushSubscription>,
}
#[derive(Deserialize, Debug, Clone)]
pub struct SessionInfo {
#[serde(rename = "_id")]
pub id: String,
pub name: String,
}
#[derive(Deserialize, Debug, Clone)]
#[serde(tag = "result")]
pub enum LoginResponse {
Success(Session),
MFA {
ticket: String,
allowed_methods: Vec<MFAMethod>,
},
Disabled {
user_id: String,
},
}