| use serde::{Deserialize, Serialize}; | |
| /// Model quota information | |
| pub struct ModelQuota { | |
| pub name: String, | |
| pub percentage: i32, // Remaining percentage 0-100 | |
| pub reset_time: String, | |
| } | |
| /// Quota data structure | |
| pub struct QuotaData { | |
| pub models: Vec<ModelQuota>, | |
| pub last_updated: i64, | |
| pub is_forbidden: bool, | |
| /// Subscription tier (FREE/PRO/ULTRA) | |
| pub subscription_tier: Option<String>, | |
| } | |
| impl QuotaData { | |
| pub fn new() -> Self { | |
| Self { | |
| models: Vec::new(), | |
| last_updated: chrono::Utc::now().timestamp(), | |
| is_forbidden: false, | |
| subscription_tier: None, | |
| } | |
| } | |
| pub fn add_model(&mut self, name: String, percentage: i32, reset_time: String) { | |
| self.models.push(ModelQuota { | |
| name, | |
| percentage, | |
| reset_time, | |
| }); | |
| } | |
| } | |
| impl Default for QuotaData { | |
| fn default() -> Self { | |
| Self::new() | |
| } | |
| } | |