use crate::domain::entities::{CircuitBreaker, CommandLock, HealthScore};
use crate::domain::events::ShmEvent;
use crate::domain::value_objects::ProviderMetrics;
pub trait CommandCachePort {
fn acquire_lock(&mut self, cmd_hash: &str, pid: u32) -> Result<(), String>;
fn release_lock(&mut self, cmd_hash: &str, pid: u32) -> Result<(), String>;
fn get_lock(&self, cmd_hash: &str) -> Option<CommandLock>;
fn list_locks(&self) -> Vec<CommandLock>;
}
pub trait CircuitBreakerPort {
fn record_success(&mut self, target: &str) -> Result<(), String>;
fn record_failure(&mut self, target: &str) -> Result<(), String>;
fn get_breaker(&self, target: &str) -> Option<CircuitBreaker>;
fn list_breakers(&self) -> Vec<CircuitBreaker>;
}
pub trait HealthPort {
fn get_health(&self) -> HealthScore;
fn set_component_health(&mut self, name: &str, score: f32) -> Result<(), String>;
fn is_healthy(&self) -> bool;
}
pub trait MetricsPort {
fn record_provider_success(&mut self, provider: &str, latency_ms: u32) -> Result<(), String>;
fn record_provider_failure(&mut self, provider: &str) -> Result<(), String>;
fn get_provider_metrics(&self, provider: &str) -> Option<ProviderMetrics>;
fn list_providers(&self) -> Vec<ProviderMetrics>;
}
pub trait EventPort {
fn publish(&mut self, event: ShmEvent) -> Result<(), String>;
fn get_events_since(&self, timestamp: std::time::SystemTime) -> Vec<ShmEvent>;
}