// Howdy 👋.
//
// If you are new to writing code in Flux make sure to check out our get started docs: https://docs.flux.ai/write-code
//
// We also have a Flux Slack Community in case you need help: https://join.slack.com/t/fluxcommunity/shared_invite/zt-p48n941f-wzQ06kGmuFJ2HXnGYT1JkA
//
// To infinity and beyond 🚀
const mySwitch = flux.controls.find(control => control.name === "Switch");
if (mySwitch.value) {
flux.currentSymbol = "closed";
flux.simulationModel = {type: "switch", state: true};
} else {
flux.currentSymbol = "open";
flux.simulationModel = {type: "switch", state: false};
}
flux.on("inputChange", (e) => {
if (e.control_name === "Switch") {
if (e.value) {
flux.currentSymbol = "closed";
flux.simulationModel = {type: "switch", state: true};