use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Watchdog {
    // Allowed Values: wd
    pub dev: String,
    pub circuit: String,
    // minimum: 0 maximum: 1
    pub value: u8,
    // minimum: 0
    pub timeout: u32,
    // minimum: 0 maximum: 1
    pub was_wd_reset: u8,
    // minimum: 0 maximum: 1
    pub nv_save: u8,
    // minimum: 0
    pub glob_dev_id: u32,
    pub alias: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct WatchdogInput {
    // minimum: 0, maximum: 1
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<u8>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timeout: Option<u32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reset: Option<u8>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub nv_save: Option<u8>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alias: Option<String>,
}
