use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct AnalogInput {
    // Allowed Values: ai
    pub dev: String,
    pub circuit: String,
    // minimum: 0 maximum: 1
    pub value: u8,
    // Allowed Values: V, mA, Ohm
    pub unit: Option<String>,
    // minimum: 0
    pub glob_dev_id: u32,
    // Allowed Values: Voltage, Current, Resistance, Simple
    // Simple is valid only for the UniPi 1.1
    pub mode: Option<String>,
    // Allowed Values: Voltage, Current, Resistance, Simple
    // Simple is valid only for the UniPi 1.1
    pub modes: Option<Vec<String>>,
    // Allowed Values: 0.0, 2.5, 10.0, 20.0, 100.0, 1960.0
    pub range: Option<String>,
    // Allowed Values: 0.0, 2.5, 10.0, 20.0, 100.0, 1960.0
    pub range_modes: Option<Vec<String>>,
    pub alias: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct AnalogInputInput {
    // Allowed Values: Voltage, Current, Resistance, Simple
    // Simple is valid only for the UniPi 1.1
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mode: Option<String>,
    // Allowed Values: 0.0, 2.5, 10.0, 20.0, 100.0, 1960.0
    #[serde(skip_serializing_if = "Option::is_none")]
    pub range: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alias: Option<String>,
}
