component Lock() state -> {
  is_pressed        : flow.Bool()
  check_lock_status : flow.Deselect()
  lock              : io.Print()

  .state                 > is_pressed.token
  is_pressed.bool        > check_lock_status.select
  "Door is locked"       > check_lock_status.case_false
  "Door is open"         > check_lock_status.case_true
  check_lock_status.data > lock.token
}

button : io.Button()
lock   : Lock()

button.state > lock.state


# Deployment

rule outside : node_attr_match(index=["address", {"locality": "outside"}])
rule server  : runtime_name(name="server")

apply button : outside
apply lock   : server

