use serde_json::Value;
use crate::error::Result;
use crate::model::{DeviceSnapshot, PowerAction, Relay};
use crate::target::{DeviceTarget, Vendor};
#[async_trait::async_trait]
pub trait SmartDevice: Send + Sync {
fn vendor(&self) -> Vendor;
async fn probe(&self, target: &DeviceTarget) -> Result<Option<DeviceSnapshot>>;
async fn status(&self, target: &DeviceTarget) -> Result<DeviceSnapshot>;
async fn set_power(
&self,
target: &DeviceTarget,
channel: Option<u8>,
action: PowerAction,
) -> Result<Relay>;
async fn firmware_version(&self, target: &DeviceTarget) -> Result<Option<String>>;
async fn firmware_update(&self, target: &DeviceTarget, ota_url: Option<&str>) -> Result<()>;
async fn config_get(&self, target: &DeviceTarget, setting: &str) -> Result<Value>;
async fn config_set(&self, target: &DeviceTarget, setting: &str, value: &str) -> Result<Value>;
async fn backup(&self, target: &DeviceTarget) -> Result<Vec<u8>>;
async fn console(&self, target: &DeviceTarget, command: &str) -> Result<Value>;
}
#[derive(Debug, Clone)]
pub struct Discovered {
pub vendor: Vendor,
pub snapshot: DeviceSnapshot,
}