]> git.basschouten.com Git - openhab-addons.git/blob
734d621def135082f6df34c04f660d80eb3eba44
[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.amazonechocontrol.internal.jsons;
14
15 import java.util.List;
16 import java.util.stream.Collectors;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 /**
22  * The {@link JsonAnnouncementTarget} encapsulate the GSON data of the sequence command AlexaAnnouncement for
23  * announcement target
24  *
25  * @author Michael Geramb - Initial contribution
26  */
27 @NonNullByDefault
28 public class JsonAnnouncementTarget {
29
30     public @Nullable String customerId;
31     public List<TargetDevice> devices;
32
33     public JsonAnnouncementTarget(List<JsonDevices.Device> deviceList) {
34         customerId = deviceList.get(0).deviceOwnerCustomerId;
35         devices = deviceList.stream().map(TargetDevice::new).collect(Collectors.toList());
36     }
37
38     public static class TargetDevice {
39         public @Nullable String deviceSerialNumber;
40         public @Nullable String deviceTypeId;
41
42         public TargetDevice(JsonDevices.Device device) {
43             deviceSerialNumber = device.serialNumber;
44             deviceTypeId = device.deviceType;
45         }
46     }
47 }