// Path: src/main/java/be/error/rpi/config/RunConfig.java
// public static RunConfig getInstance() {
// 	if (runConfig == null) {
// 		throw new IllegalStateException("Initialize first");
// 	}
// 	return runConfig;
// }
// 
// Path: src/main/java/be/error/rpi/knx/Support.java
// public static GroupAddress createGroupAddress(String groupAddress) {
// 	try {
// 		return new GroupAddress(groupAddress);
// 	} catch (KNXException knxException) {
// 		logger.error("Could not create group address from " + groupAddress, knxException);
// 		throw new RuntimeException(knxException);
// 	}
// }
// 
// Path: src/main/java/be/error/types/LocationId.java
// public enum LocationId {
// 
// 	GELIJKVLOERS("Gelijkvloers"),
// 	NACHTHAL("Nachthal"),
// 	BADKAMER("Badkamer"),
// 	DRESSING("Dressing"),
// 	SK1("Slaapkamer1"),
// 	SK2("Slaapkamer2"),
// 	SK3("Slaapkamer3"),
// 	KEUKEN("Keuken"),
// 	EETHOEK("Eethoek"),
// 	INKOMHAL("Inkomhal"),
// 	BERGING("Berging"),
// 	VOORDEUR("Inkom buiten"),
// 	GANG("Gang"),
// 	WC("WC"),
// 	ZITHOEK("Zithoek"),
// 	GARAGE("Garage"),
// 	LZG("LZG"),
// 	AG("AG"),
// 	RZG("RZG"),
// 	VG("VG");
// 
// 	private String dimmerDescription;
// 
// 	LocationId(final String dimmerDescription) {
// 		this.dimmerDescription = dimmerDescription;
// 	}
// }


import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tuwien.auto.calimero.GroupAddress;
import be.error.types.LocationId;
import static be.error.rpi.config.RunConfig.getInstance;
import static be.error.rpi.dac.dimmer.builder.DimmerBackend.I2C;
import static be.error.rpi.dac.dimmer.builder.DimmerBackend.LUCID_CONTROL;
import static be.error.rpi.knx.Support.createGroupAddress;
import static java.util.Arrays.asList;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import java.util.ArrayList;
/*-
 * #%L
 * Home Automation
 * %%
 * Copyright (C) 2016 - 2017 Koen Serneels
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package be.error.rpi.dac.dimmer.builder;






/**
 * @author Koen Serneels
 */
public class DimmerBuilder {

	private static final Logger logger = LoggerFactory.getLogger(DimmerBuilder.class);

	private LocationId name;
	private DimmerBackend dimmerBackend = I2C;
	private int boardAddress;
	private int channel;

	private Optional<Long> turnOffDelay = empty();
	private Optional<Long> delayBeforeIncreasingDimValue = empty();
	private Optional<Integer> minDimVal = empty();
	private Optional<Integer> stepDelay = empty();

	//GA's that are read from the bus (~input)
	private Optional<GroupAddress> onOff = empty();
	private Optional<GroupAddress> precenseDetectorLock = empty();
	private Optional<GroupAddress> onOffOverride = empty();
	private Optional<GroupAddress> dim = empty();
	private Optional<GroupAddress> dimAbsolute = empty();
	private Optional<GroupAddress> dimAbsoluteOverride = empty();
	private Optional<GroupAddress> deactivateOnOtherUse = empty();

	//GA's that are written to (~output)
	private List<GroupAddress> switchGroupAddresses = new ArrayList();
	private List<GroupAddress> switchLedControlGroupAddresses = new ArrayList();
	private List<GroupAddress> switchUpdateGroupAddresses = new ArrayList();
	private List<GroupAddress> feedbackGroupAddresses = new ArrayList();

	/**
	 * The logical name of this dimmers instance. This is just an identifier for naming thread groups and debugging purposes
	 */
// Path: src/main/java/be/error/rpi/config/RunConfig.java
// public static RunConfig getInstance() {
// 	if (runConfig == null) {
// 		throw new IllegalStateException("Initialize first");
// 	}
// 	return runConfig;
// }
// 
// Path: src/main/java/be/error/rpi/knx/Support.java
// public static GroupAddress createGroupAddress(String groupAddress) {
// 	try {
// 		return new GroupAddress(groupAddress);
// 	} catch (KNXException knxException) {
// 		logger.error("Could not create group address from " + groupAddress, knxException);
// 		throw new RuntimeException(knxException);
// 	}
// }
// 
// Path: src/main/java/be/error/types/LocationId.java
// public enum LocationId {
// 
// 	GELIJKVLOERS("Gelijkvloers"),
// 	NACHTHAL("Nachthal"),
// 	BADKAMER("Badkamer"),
// 	DRESSING("Dressing"),
// 	SK1("Slaapkamer1"),
// 	SK2("Slaapkamer2"),
// 	SK3("Slaapkamer3"),
// 	KEUKEN("Keuken"),
// 	EETHOEK("Eethoek"),
// 	INKOMHAL("Inkomhal"),
// 	BERGING("Berging"),
// 	VOORDEUR("Inkom buiten"),
// 	GANG("Gang"),
// 	WC("WC"),
// 	ZITHOEK("Zithoek"),
// 	GARAGE("Garage"),
// 	LZG("LZG"),
// 	AG("AG"),
// 	RZG("RZG"),
// 	VG("VG");
// 
// 	private String dimmerDescription;
// 
// 	LocationId(final String dimmerDescription) {
// 		this.dimmerDescription = dimmerDescription;
// 	}
// }


// Path: src/main/java/be/error/rpi/dac/dimmer/builder/DimmerBuilder.java
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tuwien.auto.calimero.GroupAddress;
import be.error.types.LocationId;
import static be.error.rpi.config.RunConfig.getInstance;
import static be.error.rpi.dac.dimmer.builder.DimmerBackend.I2C;
import static be.error.rpi.dac.dimmer.builder.DimmerBackend.LUCID_CONTROL;
import static be.error.rpi.knx.Support.createGroupAddress;
import static java.util.Arrays.asList;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import java.util.ArrayList;

/*-
 * #%L
 * Home Automation
 * %%
 * Copyright (C) 2016 - 2017 Koen Serneels
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package be.error.rpi.dac.dimmer.builder;






/**
 * @author Koen Serneels
 */
public class DimmerBuilder {

	private static final Logger logger = LoggerFactory.getLogger(DimmerBuilder.class);

	private LocationId name;
	private DimmerBackend dimmerBackend = I2C;
	private int boardAddress;
	private int channel;

	private Optional<Long> turnOffDelay = empty();
	private Optional<Long> delayBeforeIncreasingDimValue = empty();
	private Optional<Integer> minDimVal = empty();
	private Optional<Integer> stepDelay = empty();

	//GA's that are read from the bus (~input)
	private Optional<GroupAddress> onOff = empty();
	private Optional<GroupAddress> precenseDetectorLock = empty();
	private Optional<GroupAddress> onOffOverride = empty();
	private Optional<GroupAddress> dim = empty();
	private Optional<GroupAddress> dimAbsolute = empty();
	private Optional<GroupAddress> dimAbsoluteOverride = empty();
	private Optional<GroupAddress> deactivateOnOtherUse = empty();

	//GA's that are written to (~output)
	private List<GroupAddress> switchGroupAddresses = new ArrayList();
	private List<GroupAddress> switchLedControlGroupAddresses = new ArrayList();
	private List<GroupAddress> switchUpdateGroupAddresses = new ArrayList();
	private List<GroupAddress> feedbackGroupAddresses = new ArrayList();

	/**
	 * The logical name of this dimmers instance. This is just an identifier for naming thread groups and debugging purposes
	 */
	public DimmerBuilder name(LocationId name) {