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