use serde::{Deserialize, Serialize}; /// Access and refresh token pair stored in the login cache file. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)] pub struct CacheToken { pub access: String, pub refresh: String, } /// Minimal user fields stored in the cache, matching Python's `User` dataclass. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)] pub struct CacheUser { pub id: u32, pub username: String, pub laboratory_ids: Vec, pub is_reviewer: bool, } /// All four laboratory fields needed for digest computation. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)] pub struct CacheLaboratory { pub id: u32, pub name: String, #[serde(default)] pub pi_name: String, #[serde(default)] pub full_name: String, } /// Wrapper matching Python's `Laboratories` serialization: `{"items": [...]}`. #[derive(Deserialize, Serialize, Clone, Debug, Default, PartialEq, Eq)] pub struct CacheLabsWrapper { pub items: Vec, } /// Full login cache, corresponding to the `.json` file written by `login`. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)] pub struct Cache { pub user: Option, pub token: CacheToken, pub laboratories: CacheLabsWrapper, #[serde(default)] pub digest: String, }