{
  "custom": {},
  "params": {
    "value": {
      "tagProps": [
        "",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value"
      ]
    }
  },
  "propConfig": {
    "params.value": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 50,
      "width": 300
    }
  },
  "root": {
    "children": [
      {
        "events": {
          "component": {
            "onActionPerformed": {
              "config": {
                "script": "\ttags_to_read \u003d system.tag.readBlocking([\"Configuration/FC\"])\n\twhid \u003d tags_to_read[0].value\n\tid \u003d self.view.params.value.tagProps[0]\n\tcommandTarget\u003dstr(id)+\"/0\"#PLC01/0 --\u003etarget is the plc\n\tcommandParams\u003d\"\"\n\tif whid\u003d\u003d\"MAN2\" or whid\u003d\u003d\"BRS1\" or whid\u003d\u003d\"MAD6\":\n\t\tcommandTarget\u003d\"databridge/0\"\n\t\tcommandParams\u003d\"PLC\u003d\"+str(id)#this tells the target to data bridge\n\taction \u003d 1\n\tparameters\u003d{\"commandTarget\":commandTarget,\n\t\t\t\t\"commandCode\":1,\n\t\t\t\t\"commandTimestamp\":system.date.toMillis(system.date.now()),\n\t\t\t\t\"commandParams\":commandParams}\n\tCommands.button_commands.send_request(whid, action, parameters)"
              },
              "scope": "G",
              "type": "script"
            }
          }
        },
        "meta": {
          "name": "Start",
          "tooltip": {
            "enabled": true,
            "location": "top-left"
          }
        },
        "position": {
          "basis": "80px"
        },
        "propConfig": {
          "meta.tooltip.text": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027Start \u0027 + {view.params.value.tagProps[0]},\"Re-Authentication Required - Press \u0027Enable Controls\u0027 button and re-enter password\")"
              },
              "type": "expr"
            }
          },
          "props.enabled": {
            "binding": {
              "config": {
                "expression": "{session.custom.command_auth.enabled} \u0026\u0026 {parent.custom.has_role}"
              },
              "type": "expr"
            }
          },
          "props.image.icon.color": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027#4A4A4A\u0027,\u0027#979797\u0027)"
              },
              "type": "expr"
            }
          },
          "props.style.borderStyle": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027solid\u0027,\u0027none\u0027)"
              },
              "type": "expr"
            }
          }
        },
        "props": {
          "image": {
            "height": 32,
            "icon": {
              "path": "material/not_started"
            },
            "position": "top",
            "width": 32
          },
          "style": {
            "backgroundColor": "#D4D4D4",
            "borderColor": "#4A4A4A",
            "borderWidth": 2,
            "classes": "\n",
            "marginBottom": 5,
            "marginLeft": 5,
            "marginRight": 5,
            "marginTop": 5
          },
          "text": "",
          "textStyle": {
            "fontSize": 12,
            "fontWeight": "bold",
            "textAlign": "center"
          }
        },
        "type": "ia.input.button"
      },
      {
        "events": {
          "component": {
            "onActionPerformed": {
              "config": {
                "script": "\ttags_to_read \u003d system.tag.readBlocking([\"Configuration/FC\"])\n\twhid \u003d tags_to_read[0].value\n\tid \u003d self.view.params.value.tagProps[0]\n\tcommandTarget\u003dstr(id)+\"/0\"#PLC01/0 --\u003etarget is the plc\n\tcommandParams\u003d\"\"\n\tif whid\u003d\u003d\"MAN2\" or whid\u003d\u003d\"BRS1\" or whid\u003d\u003d\"MAD6\":\n\t\tcommandTarget\u003d\"databridge/0\"\n\t\tcommandParams\u003d\"PLC\u003d\"+str(id)#this tells the target to data bridge\n\taction \u003d 3\n\tparameters\u003d{\"commandTarget\":commandTarget,\n\t\t\t\t\"commandCode\":3,\n\t\t\t\t\"commandTimestamp\":system.date.toMillis(system.date.now()),\n\t\t\t\t\"commandParams\":commandParams}\n\tCommands.button_commands.send_request(whid, action, parameters)"
              },
              "scope": "G",
              "type": "script"
            }
          }
        },
        "meta": {
          "name": "Reset",
          "tooltip": {
            "enabled": true,
            "location": "top-left"
          }
        },
        "position": {
          "basis": "80px"
        },
        "propConfig": {
          "meta.tooltip.text": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027Reset \u0027 + {view.params.value.tagProps[0]},\"Re-Authentication Required - Press \u0027Enable Controls\u0027 button and re-enter password\") "
              },
              "type": "expr"
            }
          },
          "props.enabled": {
            "binding": {
              "config": {
                "expression": "{session.custom.command_auth.enabled} \u0026\u0026 {parent.custom.has_role}"
              },
              "type": "expr"
            }
          },
          "props.image.icon.color": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027#4A4A4A\u0027,\u0027#979797\u0027)"
              },
              "type": "expr"
            }
          },
          "props.style.borderStyle": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027solid\u0027,\u0027none\u0027)"
              },
              "type": "expr"
            }
          }
        },
        "props": {
          "image": {
            "height": 32,
            "icon": {
              "path": "material/refresh"
            },
            "position": "top",
            "width": 32
          },
          "style": {
            "backgroundColor": "#D4D4D4",
            "borderColor": "#4A4A4A",
            "borderWidth": 2,
            "classes": "\n",
            "marginBottom": 5,
            "marginLeft": 5,
            "marginRight": 5,
            "marginTop": 5
          },
          "text": "",
          "textStyle": {
            "fontSize": 12,
            "fontWeight": "bold",
            "textAlign": "center"
          }
        },
        "type": "ia.input.button"
      },
      {
        "meta": {
          "name": "JAM_Reset",
          "tooltip": {
            "enabled": true,
            "location": "top-left"
          }
        },
        "position": {
          "basis": "80px"
        },
        "propConfig": {
          "meta.tooltip.text": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027Jam Reset \u0027 + {view.params.value.tagProps[0]},\"Re-Authentication Required - Press \u0027Enable Controls\u0027 button and re-enter password\")"
              },
              "type": "expr"
            }
          },
          "props.enabled": {
            "binding": {
              "config": {
                "expression": "{session.custom.command_auth.enabled} \u0026\u0026 {parent.custom.has_role}"
              },
              "type": "expr"
            }
          },
          "props.image.icon.color": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027#4A4A4A\u0027,\u0027#979797\u0027)"
              },
              "type": "expr"
            }
          },
          "props.style.borderStyle": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027solid\u0027,\u0027none\u0027)"
              },
              "type": "expr"
            }
          }
        },
        "props": {
          "image": {
            "height": 32,
            "icon": {
              "path": "material/sync_problem"
            },
            "position": "top",
            "width": 32
          },
          "style": {
            "backgroundColor": "#D4D4D4",
            "borderColor": "#4A4A4A",
            "borderWidth": 2,
            "classes": "\n",
            "marginBottom": 5,
            "marginLeft": 5,
            "marginRight": 5,
            "marginTop": 5
          },
          "text": "",
          "textStyle": {
            "fontSize": 12,
            "fontWeight": "bold",
            "textAlign": "center"
          }
        },
        "type": "ia.input.button"
      },
      {
        "events": {
          "component": {
            "onActionPerformed": {
              "config": {
                "script": "\ttags_to_read \u003d system.tag.readBlocking([\"Configuration/FC\"])\n\twhid \u003d tags_to_read[0].value\n\tid \u003d self.view.params.value.tagProps[0]\n\tcommandTarget\u003dstr(id)+\"/0\"#PLC01/0 --\u003etarget is the plc\n\tcommandParams\u003d\"\"\n\tif whid\u003d\u003d\"MAN2\" or whid\u003d\u003d\"BRS1\" or whid\u003d\u003d\"MAD6\":\n\t\tcommandTarget\u003d\"databridge/0\"\n\t\tcommandParams\u003d\"PLC\u003d\"+str(id)#this tells the target to data bridge\n\taction \u003d 2\n\tparameters\u003d{\"commandTarget\":commandTarget,\n\t\t\t\t\"commandCode\":2,\n\t\t\t\t\"commandTimestamp\":system.date.toMillis(system.date.now()),\n\t\t\t\t\"commandParams\":commandParams}\n\tCommands.button_commands.send_request(whid, action, parameters)"
              },
              "scope": "G",
              "type": "script"
            }
          }
        },
        "meta": {
          "name": "Stop",
          "tooltip": {
            "enabled": true,
            "location": "top-left"
          }
        },
        "position": {
          "basis": "80px"
        },
        "propConfig": {
          "meta.tooltip.text": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027Stop \u0027 + {view.params.value.tagProps[0]},\"Re-Authentication Required - Press \u0027Enable Controls\u0027 button and re-enter password\") "
              },
              "type": "expr"
            }
          },
          "props.enabled": {
            "binding": {
              "config": {
                "expression": "{session.custom.command_auth.enabled} \u0026\u0026 {parent.custom.has_role}"
              },
              "type": "expr"
            }
          },
          "props.image.icon.color": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027#4A4A4A\u0027,\u0027#979797\u0027)"
              },
              "type": "expr"
            }
          },
          "props.style.borderStyle": {
            "binding": {
              "config": {
                "expression": "if({this.props.enabled},\u0027solid\u0027,\u0027none\u0027)"
              },
              "type": "expr"
            }
          }
        },
        "props": {
          "image": {
            "height": 32,
            "icon": {
              "path": "material/stop_circle"
            },
            "position": "top",
            "width": 32
          },
          "style": {
            "backgroundColor": "#D4D4D4",
            "borderColor": "#4A4A4A",
            "borderWidth": 2,
            "classes": "\n",
            "marginBottom": 5,
            "marginLeft": 5,
            "marginRight": 5,
            "marginTop": 5
          },
          "text": "",
          "textStyle": {
            "fontSize": 12,
            "fontWeight": "bold",
            "textAlign": "center"
          }
        },
        "type": "ia.input.button"
      }
    ],
    "meta": {
      "name": "root"
    },
    "propConfig": {
      "custom.has_role": {
        "binding": {
          "config": {
            "expression": "{session.custom.fc}"
          },
          "transforms": [
            {
              "code": "\trme_role \u003d value +\"-rme-c2c-all\"\n\troles \u003d (self.session.props.auth.user.roles)\n\tif (rme_role.lower() in roles \n\tor rme_role.upper() in roles \n\tor \"eurme-ignition-admins\" in roles):\n\t\treturn True\n\telse:\n\t\treturn False",
              "type": "script"
            }
          ],
          "type": "expr"
        }
      },
      "custom.status": {
        "binding": {
          "config": {
            "fallbackDelay": 2.5,
            "mode": "indirect",
            "references": {
              "0": "{view.params.tagProps[0]}",
              "fc": "{session.custom.fc}"
            },
            "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/ALARMST"
          },
          "transforms": [
            {
              "expression": "if(isNull({value}), 0, {value})",
              "type": "expression"
            },
            {
              "fallback": null,
              "inputType": "scalar",
              "mappings": [
                {
                  "input": 4,
                  "output": 1
                },
                {
                  "input": 3,
                  "output": 2
                },
                {
                  "input": 2,
                  "output": 3
                },
                {
                  "input": 1,
                  "output": 4
                },
                {
                  "input": 0,
                  "output": 5
                }
              ],
              "outputType": "scalar",
              "type": "map"
            }
          ],
          "type": "tag"
        }
      }
    },
    "props": {
      "justify": "center"
    },
    "type": "ia.container.flex"
  }
}