use std::collections::HashMap; use crate::{CraftContext, LicenseInfo, error::LicenseError}; #[derive(Debug)] pub struct LicenseStatus { pub licensed: bool, pub not_after: Option, pub features: HashMap, pub device_count: u32, pub max_devices: u32, pub heartbeat_due: Option, } pub struct ActivateResponse { pub success: bool, pub device_id: String, pub license_payload: Vec, } pub struct HeartbeatResponse { pub valid: bool, pub lease_until: Option, pub update_available: bool, pub new_license_payload: Option>, } pub trait Provider: Send + Sync { fn initialize(&mut self, ctx: &CraftContext, config_json: &str) -> Result<(), LicenseError>; fn activate(&self, ctx: &CraftContext, license_key: &str) -> Result; fn check_license(&self, ctx: &CraftContext) -> Result; fn heartbeat(&self, ctx: &CraftContext) -> Result; fn has_feature(&self, ctx: &CraftContext, name: &str) -> bool; fn release(&mut self) -> Result<(), LicenseError>; fn get_license_info(&self, ctx: &CraftContext) -> LicenseInfo; fn close(&mut self); }