]> git.basschouten.com Git - openhab-addons.git/blob
c8a36e72d5d80afc88385167f39bdeb23bbce583
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.sleepiq.internal.api.dto;
14
15 import java.util.List;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * The {@link SleepDataResponse} holds the response to a request for sleep data.
21  *
22  * @author Mark Hilbush - Initial contribution
23  */
24 public class SleepDataResponse {
25     @SerializedName("sleeperId")
26     private String sleeperId;
27
28     @SerializedName("avgSleepIQ")
29     private Integer averageSleepIQ;
30
31     @SerializedName("avgHeartRate")
32     private Integer averageHeartRate;
33
34     @SerializedName("avgRespirationRate")
35     private Integer averageResperationRate;
36
37     @SerializedName("inBed")
38     private Integer totalInBedSeconds;
39
40     @SerializedName("outOfBed")
41     private Integer totalOutOfBedSeconds;
42
43     @SerializedName("restful")
44     private Integer totalRestfulSeconds;
45
46     @SerializedName("restless")
47     private Integer totalRestlessSeconds;
48
49     @SerializedName("sleepData")
50     private List<SleepDataDay> sleepDataDays;
51
52     public String getSleeperId() {
53         return sleeperId;
54     }
55
56     public Integer getAverageSleepIQ() {
57         return averageSleepIQ;
58     }
59
60     public Integer getAverageHeartRate() {
61         return averageHeartRate;
62     }
63
64     public Integer getAverageRespirationRate() {
65         return averageResperationRate;
66     }
67
68     public Integer getTotalSleepSessionTime() {
69         return totalInBedSeconds + totalOutOfBedSeconds;
70     }
71
72     public Integer getTotalInBedSeconds() {
73         return totalInBedSeconds;
74     }
75
76     public Integer getTotalOutOfBedSeconds() {
77         return totalOutOfBedSeconds;
78     }
79
80     public Integer getTotalRestfulSeconds() {
81         return totalRestfulSeconds;
82     }
83
84     public Integer getTotalRestlessSeconds() {
85         return totalRestlessSeconds;
86     }
87
88     public List<SleepDataDay> getSleepDataDays() {
89         return sleepDataDays;
90     }
91
92     @Override
93     public String toString() {
94         StringBuilder builder = new StringBuilder();
95         builder.append("SleepDataResponse [sleepData=");
96         builder.append("averageSleepIQ=");
97         builder.append(averageSleepIQ);
98         builder.append(", averageHeartRate=");
99         builder.append(averageHeartRate);
100         builder.append(", averageResperationRate=");
101         builder.append(averageResperationRate);
102         builder.append(", totalInBedSeconds=");
103         builder.append(totalInBedSeconds);
104         builder.append(", totalOutOfBedSeconds=");
105         builder.append(totalOutOfBedSeconds);
106         builder.append(", totalRestfulSeconds=");
107         builder.append(totalRestfulSeconds);
108         builder.append(", totalRestlessSeconds=");
109         builder.append(totalRestlessSeconds);
110         builder.append(", totalSleepSessionTime=");
111         builder.append(getTotalSleepSessionTime());
112         builder.append("]");
113         return builder.toString();
114     }
115 }