]> git.basschouten.com Git - openhab-addons.git/blob
c7a18ec075cb7332dc61619fee0bfaa758391196
[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.netatmo.internal.api.dto;
14
15 import java.util.Optional;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.netatmo.internal.api.ApiResponse;
20 import org.openhab.binding.netatmo.internal.deserialization.NAObjectMap;
21
22 /**
23  * The {@link NAHomeStatus} holds data for a given home.
24  *
25  * @author GaĆ«l L'hopital - Initial contribution
26  *
27  */
28 @NonNullByDefault
29 public class NAHomeStatus {
30     public class NAHomeStatusResponse extends ApiResponse<NAHomeStatus> {
31     }
32
33     public class HomeStatus extends NAThing {
34         private @Nullable NAObjectMap<HomeStatusModule> modules;
35         private @Nullable NAObjectMap<HomeStatusPerson> persons;
36         private @Nullable NAObjectMap<Room> rooms;
37
38         public NAObjectMap<HomeStatusModule> getModules() {
39             NAObjectMap<HomeStatusModule> localModules = modules;
40             return localModules != null ? localModules : new NAObjectMap<>();
41         }
42
43         public NAObjectMap<HomeStatusPerson> getPersons() {
44             NAObjectMap<HomeStatusPerson> localPersons = persons;
45             return localPersons != null ? localPersons : new NAObjectMap<>();
46         }
47
48         public NAObjectMap<Room> getRooms() {
49             NAObjectMap<Room> localRooms = rooms;
50             return localRooms != null ? localRooms : new NAObjectMap<>();
51         }
52     }
53
54     private @Nullable HomeStatus home;
55
56     public Optional<HomeStatus> getHomeStatus() {
57         return Optional.ofNullable(home);
58     }
59 }