2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.sleepiq.internal.api.dto;
15 import java.util.List;
17 import com.google.gson.annotations.SerializedName;
20 * The {@link SleepDataResponse} holds the response to a request for sleep data.
22 * @author Mark Hilbush - Initial contribution
24 public class SleepDataResponse {
25 @SerializedName("sleeperId")
26 private String sleeperId;
28 @SerializedName("avgSleepIQ")
29 private Integer averageSleepIQ;
31 @SerializedName("avgHeartRate")
32 private Integer averageHeartRate;
34 @SerializedName("avgRespirationRate")
35 private Integer averageResperationRate;
37 @SerializedName("inBed")
38 private Integer totalInBedSeconds;
40 @SerializedName("outOfBed")
41 private Integer totalOutOfBedSeconds;
43 @SerializedName("restful")
44 private Integer totalRestfulSeconds;
46 @SerializedName("restless")
47 private Integer totalRestlessSeconds;
49 @SerializedName("sleepData")
50 private List<SleepDataDay> sleepDataDays;
52 public String getSleeperId() {
56 public Integer getAverageSleepIQ() {
57 return averageSleepIQ;
60 public Integer getAverageHeartRate() {
61 return averageHeartRate;
64 public Integer getAverageRespirationRate() {
65 return averageResperationRate;
68 public Integer getTotalSleepSessionTime() {
69 return totalInBedSeconds + totalOutOfBedSeconds;
72 public Integer getTotalInBedSeconds() {
73 return totalInBedSeconds;
76 public Integer getTotalOutOfBedSeconds() {
77 return totalOutOfBedSeconds;
80 public Integer getTotalRestfulSeconds() {
81 return totalRestfulSeconds;
84 public Integer getTotalRestlessSeconds() {
85 return totalRestlessSeconds;
88 public List<SleepDataDay> getSleepDataDays() {
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());
113 return builder.toString();