2 * Copyright (c) 2010-2024 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.boschshc.internal.devices.bridge.dto;
15 import java.util.Arrays;
17 import org.openhab.binding.boschshc.internal.services.dto.BoschSHCServiceState;
20 * A scenario as represented by the controller.
24 * "@type": "scenarioTriggered",
25 * "name": "My scenario",
26 * "id": "509bd737-eed0-40b7-8caa-e8686a714399",
27 * "lastTimeTriggered": "1693758693032"
30 * @author Patrick Gell - Initial contribution
32 public class Scenario extends BoschSHCServiceState {
36 public String lastTimeTriggered;
39 super("scenarioTriggered");
42 public static Scenario createScenario(final String id, final String name, final String lastTimeTriggered) {
43 final Scenario scenario = new Scenario();
47 scenario.lastTimeTriggered = lastTimeTriggered;
51 public static Boolean isValid(Scenario[] scenarios) {
52 return Arrays.stream(scenarios).allMatch(scenario -> (scenario.id != null));
56 public String toString() {
57 final StringBuilder sb = new StringBuilder("Scenario{");
58 sb.append("name='").append(name).append("'");
59 sb.append(", id='").append(id).append("'");
60 sb.append(", lastTimeTriggered='").append(lastTimeTriggered).append("'");