use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Uart {
    // Allowed Values: uart
    pub dev: String,
    pub circuit: String,
    // minimum: 0, maximum: 65535
    pub conf_value: Option<u16>,
    // Allowed Values: Odd, Even, None
    pub parity_modes: Vec<String>,
    pub parity_mode: String,
    // Allowed Values: 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, 57600bps, 115200bps
    pub speed_modes: Vec<String>,
    pub speed_mode: String,
    // Allowed Values: One, Two
    pub stopb_modes: Vec<String>,
    pub stopb_mode: String,
    // minimum: 0
    pub glob_dev_id: u32,
    pub alias: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UartInput {
    // minimum: 0, maximum: 65535
    #[serde(skip_serializing_if = "Option::is_none")]
    pub conf_value: Option<u16>,
    // Allowed Values: Odd, Even, None
    #[serde(skip_serializing_if = "Option::is_none")]
    pub parity_mode: Option<String>,
    // Allowed Values: 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, 57600bps, 115200bps
    #[serde(skip_serializing_if = "Option::is_none")]
    pub speed_mode: Option<String>,
    // Allowed Values: One, Two
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stopb_mode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alias: Option<String>,
}
