8
8
9
9
package application.presenter.api.model
10
10
11
- import kotlinx.serialization.SerialName
12
11
import kotlinx.serialization.Serializable
13
12
14
13
/* *
15
14
* Presenter class to be able to deserialize data that comes from API.
16
- * It deserializes [id], [name], [zoneId] and the [type] of the room.
15
+ * It deserializes [id], [name], [zoneId], the [type] of the room and [environmentalData] .
17
16
*/
18
17
@Serializable
19
18
data class RoomApiDto (
20
19
val id : String ,
21
20
val name : String ,
22
- @SerialName(" zone-id" ) val zoneId : String ,
23
- val type : RoomApiDtoType
21
+ val zoneId : String ,
22
+ val type : RoomApiDtoType ,
23
+ val environmentalData : EnvironmentalDataApiDto = EnvironmentalDataApiDto ()
24
24
)
25
25
26
26
/* *
@@ -33,3 +33,27 @@ enum class RoomApiDtoType {
33
33
/* * Pre-operating room type. */
34
34
PRE_OPERATING_ROOM
35
35
}
36
+
37
+ /* *
38
+ * Describes a [value] with a [unit] of measurement.
39
+ */
40
+ @Serializable
41
+ data class ValueWithUnit <T >(val value : T , val unit : String )
42
+
43
+ /* *
44
+ * Wraps all the environmental data associated to a Room.
45
+ * It corresponds to the model used with the API.
46
+ * So it describe:
47
+ * - the [temperature] inside the room
48
+ * - the [humidity] inside the room
49
+ * - the [luminosity] inside the room
50
+ * - the [presence] of someone in the room
51
+ * All the data may be not present.
52
+ */
53
+ @Serializable
54
+ data class EnvironmentalDataApiDto (
55
+ val temperature : ValueWithUnit <Double >? = null ,
56
+ val humidity : Double? = null ,
57
+ val luminosity : ValueWithUnit <Double >? = null ,
58
+ val presence : Boolean? = null
59
+ )
0 commit comments