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.bticinosmarther.internal.api.dto;
15 import org.eclipse.jdt.annotation.Nullable;
17 import com.google.gson.annotations.SerializedName;
20 * The {@code Notification} class defines the dto for Smarther API notification object.
22 * @author Fabio Possieri - Initial contribution
24 public class Notification {
27 @SerializedName("eventType")
28 private String eventType;
29 private String subject;
30 @SerializedName("eventTime")
31 private String eventTime;
32 private ModuleStatus data;
35 * Returns the identifier of this notification.
37 * @return a string containing the notification identifier
39 public String getId() {
44 * Returns the event type of this notification.
46 * @return a string containing the notification event type
48 public String getEventType() {
53 * Returns the subject of this notification.
55 * @return a string containing the notification subject
57 public String getSubject() {
62 * Returns the event time of this notification.
64 * @return a string containing the notification event time
66 public String getEventTime() {
71 * Returns the module status data (i.e. the payload) of this notification.
73 * @return the module status data, or {@code null} in case of no data found
75 public @Nullable ModuleStatus getData() {
80 * Returns the chronothermostat details of this notification.
82 * @return the chronothermostat details, or {@code null} in case of no data found
84 public @Nullable Chronothermostat getChronothermostat() {
86 return data.toChronothermostat();
92 * Returns the sender details of this notification.
94 * @return the sender details, or {@code null} in case of no data found
96 public @Nullable Sender getSender() {
98 final Chronothermostat chronothermostat = data.toChronothermostat();
99 if (chronothermostat != null) {
100 return chronothermostat.getSender();
107 public String toString() {
108 return String.format("id=%s, eventType=%s, subject=%s, eventTime=%s, data=[%s]", id, eventType, subject,