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
30
31
32
33
34
35
36
37
//! Devices API structures

use super::general::MqttField;
use serde::{Deserialize, Serialize};

/// Get Device Response Scheme
#[derive(Deserialize, Serialize, Debug)]
pub struct GetDeviceRes {
    device_type_id: u32,
    configuration: serde_json::Value,
    undeploy_configuration: serde_json::Value,
    meta_data: serde_json::Value,
    mqtt: MqttField,
}

/// Store Device Request Scheme
#[derive(Deserialize, Serialize, Debug)]
pub struct StoreDeviceReq {
    /// Serial number
    pub serial_number: String,
    /// Optional name for the device (default = serial number)
    pub name: String,
    /// Device's type on the Hub
    pub device_type_id: u32,
}

/// Store Device Response Scheme
pub type StoreDeviceRes = GetDeviceRes;

/// Authorization Configuration Scheme
#[derive(Deserialize, Serialize, Debug)]
pub struct AuthorizationConfigReq {
    /// Type of authorization by the end device
    pub authorization_type: String,
    /// The key that will be used to validate the JWT token made by the device
    pub public_key: String,
}