1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! `DeviceCommandUpdate` module
//! `DeviceCommandUpdate` module
use serde::{Deserialize, Serialize};

use super::CommandStatus;

/// `DeviceCommandUpdate`
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeviceCommandUpdate {
    /// Command's status
    status: CommandStatus,
    /// Status change description
    message: String,
}

impl DeviceCommandUpdate {
    /// Create a new `DeviceCommandUpdate`
    ///
    /// # Params
    ///
    /// * `status`: The command's status
    /// * `message`: The command's status description message
    pub fn new<S: Into<String>>(status: CommandStatus, message: S) -> Self {
        Self {
            status,
            message: message.into(),
        }
    }
}