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.hue.internal.api.dto.clip1;
15 import java.lang.reflect.Type;
16 import java.util.ArrayList;
17 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
23 import com.google.gson.reflect.TypeToken;
26 * Detailed group information.
28 * @author Q42 - Initial contribution
29 * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding
30 * @author Laurent Garnier - field state added
33 public class FullGroup extends Group {
34 public static final Type GSON_TYPE = new TypeToken<Map<String, FullGroup>>() {
37 private @Nullable State action;
38 private @Nullable List<String> lights;
39 private @Nullable State groupState; // Will not be set by hue API
48 public FullGroup(String id, String name, String type, State action, List<String> lights, State state) {
49 super(id, name, type);
52 this.groupState = state;
56 * Returns the last sent state update to the group.
57 * This does not have to reflect the current state of the group.
59 * @return last state update
61 public @Nullable State getAction() {
66 * Returns a list of the lights in the group.
68 * @return lights in the group
70 public List<String> getLightIds() {
71 List<String> lights = this.lights;
72 return lights != null ? lights : new ArrayList<>();
76 * Returns the current state of the group.
78 * @return current state
80 public State getState() {
81 State groupState = this.groupState;
82 if (groupState == null) {
83 throw new IllegalStateException("Group state not initialized when requested");
88 public void setState(State state) {
89 this.groupState = state;