use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Register {
    // Allowed Values: register
    pub dev: String,
    pub circuit: String,
    // minimum: 0 maximum: 65535
    pub value: u16,
    // minimum: 0
    pub glob_dev_id: u32,
    pub alias: Option<String>,
    // for 'unit_register' dev
    pub name: Option<String>,
    pub unit: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RegisterInput {
    // minimum: 0 maximum: 65535
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alias: Option<String>,
}
