{
  "custom": {
    "counts": {
      "Critical": 0,
      "Diagnostic": 0,
      "High": 0,
      "Low": 0,
      "Medium": 0,
      "Total": 0
    }
  },
  "params": {
    "value": {
      "tagProps": [
        "",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value",
        "value"
      ]
    }
  },
  "propConfig": {
    "custom.counts": {
      "binding": {
        "config": {
          "struct": {
            "PLC": "{view.params.value.tagProps[0]}",
            "device_count": "tag(\u0027[\u0027+ {session.custom.fc} +\u0027_SCADA_TAG_PROVIDER]System/device_count\u0027)"
          },
          "waitOnAll": true
        },
        "transforms": [
          {
            "code": "\tcount_dict \u003d system.util.jsonDecode(value.device_count)\n\tvalues \u003d count_dict.get(value.PLC)\n\tif values !\u003d None:\n\t\tvalues[\u0027Total\u0027] \u003d values[\u0027Critical\u0027] + values[\u0027High\u0027] + values[\u0027Medium\u0027] + values[\u0027Low\u0027] + values[\u0027Diagnostic\u0027]\n\t\treturn values\n\telse:\n\t\treturn {\"Critical\":0,\"High\":0,\"Medium\":0,\"Low\":0,\"Diagnostic\":0, \"Total\":0}",
            "type": "script"
          }
        ],
        "type": "expr-struct"
      },
      "persistent": true
    },
    "params.value": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 50,
      "width": 300
    }
  },
  "root": {
    "children": [
      {
        "children": [
          {
            "meta": {
              "name": "Label_0"
            },
            "position": {
              "basis": "32px"
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              },
              "text": "High"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_1"
            },
            "position": {
              "basis": "32px"
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              },
              "text": "Med"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_2"
            },
            "position": {
              "basis": "32px"
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              },
              "text": "Low"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_3"
            },
            "position": {
              "basis": "32px"
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              },
              "text": "Diag"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_4"
            },
            "position": {
              "basis": "32px"
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              },
              "text": "Total"
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "FlexContainer"
        },
        "position": {
          "basis": "25px"
        },
        "props": {
          "justify": "space-between"
        },
        "type": "ia.container.flex"
      },
      {
        "children": [
          {
            "meta": {
              "name": "Label_0"
            },
            "position": {
              "basis": "32px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.custom.counts.High"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_1"
            },
            "position": {
              "basis": "32px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.custom.counts.Medium"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_2"
            },
            "position": {
              "basis": "32px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.custom.counts.Low"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_3"
            },
            "position": {
              "basis": "32px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.custom.counts.Diagnostic"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Label_4"
            },
            "position": {
              "basis": "32px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.custom.counts.Total"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt",
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "FlexContainer_1"
        },
        "position": {
          "basis": "25px"
        },
        "props": {
          "justify": "space-between"
        },
        "type": "ia.container.flex"
      }
    ],
    "meta": {
      "name": "root"
    },
    "propConfig": {
      "custom.has_role": {
        "binding": {
          "config": {
            "expression": "{session.custom.fc}"
          },
          "transforms": [
            {
              "code": "\trme_role \u003d value +\"-rme-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\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": {
      "direction": "column"
    },
    "type": "ia.container.flex"
  }
}