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.boschshc.internal.services.bypass.dto;
15 import org.openhab.core.library.types.OnOffType;
16 import org.openhab.core.types.State;
17 import org.openhab.core.types.UnDefType;
20 * State indicating whether a device is currently bypassed.
22 * @author David Pace - Initial contribution
25 public enum BypassState {
31 * Converts this Bosch-specific bypass state to an openHAB-compliant state for a switch.
33 * @return <code>ON</code>, <code>OFF</code> or <code>UNDEF</code>
35 public State toOnOffTypeOrUndef() {
36 return switch (this) {
37 case BYPASS_ACTIVE -> OnOffType.ON;
38 case BYPASS_INACTIVE -> OnOffType.OFF;
39 default -> UnDefType.UNDEF;