use tauri::{command, AppHandle, Runtime};
use crate::models::{BrightnessPayload, Diagnostics, MonitorInfo};
use crate::BrightnessExt;
use crate::Result;
#[command]
pub(crate) async fn list_monitors<R: Runtime>(app: AppHandle<R>) -> Result<Vec<MonitorInfo>> {
Ok(app.brightness().list_monitors())
}
#[command]
pub(crate) async fn get_brightness<R: Runtime>(
app: AppHandle<R>,
id: String,
) -> Result<BrightnessPayload> {
app.brightness().get_brightness(&id)
}
#[command]
pub(crate) async fn set_brightness<R: Runtime>(
app: AppHandle<R>,
id: String,
value: u8,
) -> Result<()> {
app.brightness().set_brightness(&id, value)
}
#[command]
pub(crate) async fn diagnose<R: Runtime>(app: AppHandle<R>) -> Result<Diagnostics> {
Ok(app.brightness().diagnose())
}