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.clip2;
15 import java.util.List;
16 import java.util.Objects;
17 import java.util.stream.Collectors;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.openhab.binding.hue.internal.api.dto.clip2.enums.ActionType;
23 import com.google.gson.annotations.SerializedName;
26 * DTO for 'alert' of a light.
28 * @author Andrew Fiddian-Green - Initial contribution
32 private @Nullable @SerializedName("action_values") List<String> actionValues;
33 private @Nullable String action;
35 public @Nullable ActionType getAction() {
36 String action = this.action;
37 return Objects.nonNull(action) ? ActionType.of(action) : null;
40 public List<ActionType> getActionValues() {
41 List<String> actionValues = this.actionValues;
42 if (Objects.nonNull(actionValues)) {
43 return actionValues.stream().map(ActionType::of).collect(Collectors.toList());
48 public Alerts setAction(ActionType actionType) {
49 this.action = actionType.name().toLowerCase();