rointe_core/models/installation.rs
1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5/// A Rointe installation (home, building, or other location) as returned by
6/// the `installations2` Firebase endpoint.
7///
8/// The `id` field is populated by the client from the Firebase map key — it
9/// is not present in the JSON value itself and is skipped during deserialization.
10#[derive(Debug, Clone, Serialize, Deserialize, Default)]
11pub struct Installation {
12 /// Firebase map key for this installation; populated by the client after parsing.
13 #[serde(skip)]
14 pub id: String,
15
16 /// Human-readable installation name as set in the Rointe app.
17 pub name: Option<String>,
18
19 /// Firebase user ID of the installation owner.
20 pub userid: Option<String>,
21
22 /// Top-level zones within this installation, keyed by zone ID.
23 ///
24 /// Zones can be nested — use [`crate::RointeClient::discover_devices`]
25 /// to recursively collect all device IDs.
26 pub zones: Option<HashMap<String, Zone>>,
27}
28
29/// A zone within an installation.
30///
31/// Zones can contain devices and/or nested sub-zones, allowing arbitrary
32/// grouping hierarchies (e.g. floors, rooms).
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct Zone {
35 /// Human-readable zone name.
36 pub name: Option<String>,
37
38 /// Map of device ID → device metadata for devices in this zone.
39 ///
40 /// Only the map keys (device IDs) are used for discovery; the metadata
41 /// values are not parsed.
42 pub devices: Option<HashMap<String, serde_json::Value>>,
43
44 /// Nested sub-zones within this zone, keyed by zone ID.
45 pub zones: Option<HashMap<String, Zone>>,
46}