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;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.hue.internal.api.dto.clip2.enums.EffectType;
22 import com.google.gson.annotations.SerializedName;
25 * DTO for 'effects' of a light.
27 * @author Andrew Fiddian-Green - Initial contribution
30 public class Effects {
31 private @Nullable @SerializedName("effect_values") List<String> effectValues;
32 private @Nullable String effect;
33 private @Nullable @SerializedName("status_values") List<String> statusValues;
34 private @Nullable String status;
36 public boolean allows(EffectType effect) {
37 List<String> statusValues = this.statusValues;
38 return Objects.nonNull(statusValues) ? statusValues.contains(effect.name().toLowerCase()) : false;
41 public EffectType getEffect() {
42 String effect = this.effect;
43 return Objects.nonNull(effect) ? EffectType.of(effect) : EffectType.NO_EFFECT;
46 public EffectType getStatus() {
47 return Objects.nonNull(status) ? EffectType.of(status) : EffectType.NO_EFFECT;
50 public List<String> getStatusValues() {
51 List<String> statusValues = this.statusValues;
52 return Objects.nonNull(statusValues) ? statusValues : List.of();
55 public Effects setEffect(EffectType effectType) {
56 effect = effectType.name().toLowerCase();
60 public Effects setStatusValues(List<String> statusValues) {
61 this.statusValues = statusValues;