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.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
22 * @author Q42 - Initial contribution
23 * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding
25 @SuppressWarnings("unused")
27 public class SetAttributesRequest {
28 private final @Nullable String name;
29 private final @Nullable List<String> lights;
31 public SetAttributesRequest(String name) {
35 public SetAttributesRequest(List<HueObject> lights) {
39 public SetAttributesRequest(@Nullable String name, @Nullable List<HueObject> lights) {
40 if (name != null && Util.stringSize(name) > 32) {
41 throw new IllegalArgumentException("Name can be at most 32 characters long");
42 } else if (lights != null && (lights.isEmpty() || lights.size() > 16)) {
43 throw new IllegalArgumentException("Group cannot be empty and cannot have more than 16 lights");
47 this.lights = lights == null ? null : lights.stream().map(l -> l.getId()).toList();