Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_health_status.rs

1//! `mountain_get_health_status` Tauri command - returns the
2//! current `HealthMonitor::Struct` (score + active issues).
3
4use tauri::Manager;
5
6use crate::{
7	IPC::StatusReporter::{HealthMonitor::Struct as HealthMonitor, Reporter::Struct as Reporter},
8	dev_log,
9};
10
11#[tauri::command]
12pub async fn mountain_get_health_status(app_handle:tauri::AppHandle) -> Result<HealthMonitor, String> {
13	dev_log!("lifecycle", "Tauri command: get_health_status");
14
15	if let Some(reporter) = app_handle.try_state::<Reporter>() {
16		reporter.get_health_status()
17	} else {
18		Err("StatusReporter not found in application state".to_string())
19	}
20}