{
  "type": "object",
  "properties": {
    "refreshRate": {
      "type": "number"
    },
    "maxDelayTimeUnit": {
      "$ref": "#/definitions/DweenTimeUnitEnum"
    },
    "maxDelayTime": {
      "type": "number"
    },
    "showScadaSettings": {
      "type": "boolean"
    },
    "elements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "LABEL"
          },
          "identifier": {
            "type": "string"
          },
          "layer": {
            "type": "string"
          },
          "xCoord": {
            "type": "number"
          },
          "yCoord": {
            "type": "number"
          },
          "bgColor": {
            "type": "string"
          },
          "fontSize": {
            "type": "number"
          },
          "isRound": {
            "type": "boolean"
          },
          "roundSize": {
            "type": "number"
          },
          "highlights": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "number"
                },
                "condition": {
                  "$ref": "#/definitions/NumberConditions"
                },
                "bgColor": {
                  "type": "string"
                },
                "textColor": {
                  "type": "string"
                },
                "isBlinking": {
                  "type": "boolean"
                }
              },
              "required": ["bgColor", "condition", "textColor", "value"]
            }
          },
          "diffOptions": {
            "type": "object",
            "properties": {
              "isIndicatorVisible": {
                "type": "boolean"
              },
              "isPercentageVisible": {
                "type": "boolean"
              },
              "decimalPlaces": {
                "type": "number"
              }
            },
            "required": ["isIndicatorVisible", "isPercentageVisible"]
          }
        },
        "required": [
          "bgColor",
          "fontSize",
          "identifier",
          "layer",
          "type",
          "xCoord",
          "yCoord"
        ]
      }
    },
    "polygons": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "x": {
                  "type": "number"
                },
                "y": {
                  "type": "number"
                },
                "id": {
                  "type": "string"
                }
              },
              "required": ["id", "x", "y"]
            }
          },
          "redirectTo": {
            "type": "string"
          },
          "title": {
            "type": ["null", "string"]
          },
          "color": {
            "type": "string"
          }
        },
        "required": ["color", "id", "points", "redirectTo", "title"]
      }
    },
    "freeTexts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "text": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "layer": {
            "type": ["null", "string"]
          },
          "fontSize": {
            "type": "number"
          }
        },
        "required": ["color", "fontSize", "id", "text", "x", "y"]
      }
    },
    "freeTextTagTables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "text": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    },
                    "text": {
                      "type": "string"
                    },
                    "color": {
                      "type": "string"
                    },
                    "layer": {
                      "type": ["null", "string"]
                    },
                    "fontSize": {
                      "type": "number"
                    }
                  },
                  "required": ["color", "fontSize", "id", "text", "x", "y"]
                },
                "tag": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "LABEL"
                    },
                    "identifier": {
                      "type": "string"
                    },
                    "layer": {
                      "type": "string"
                    },
                    "xCoord": {
                      "type": "number"
                    },
                    "yCoord": {
                      "type": "number"
                    },
                    "bgColor": {
                      "type": "string"
                    },
                    "fontSize": {
                      "type": "number"
                    },
                    "isRound": {
                      "type": "boolean"
                    },
                    "roundSize": {
                      "type": "number"
                    },
                    "highlights": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "value": {
                            "type": "number"
                          },
                          "condition": {
                            "$ref": "#/definitions/NumberConditions"
                          },
                          "bgColor": {
                            "type": "string"
                          },
                          "textColor": {
                            "type": "string"
                          },
                          "isBlinking": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "bgColor",
                          "condition",
                          "textColor",
                          "value"
                        ]
                      }
                    },
                    "diffOptions": {
                      "type": "object",
                      "properties": {
                        "isIndicatorVisible": {
                          "type": "boolean"
                        },
                        "isPercentageVisible": {
                          "type": "boolean"
                        },
                        "decimalPlaces": {
                          "type": "number"
                        }
                      },
                      "required": ["isIndicatorVisible", "isPercentageVisible"]
                    }
                  },
                  "required": [
                    "bgColor",
                    "fontSize",
                    "identifier",
                    "layer",
                    "type",
                    "xCoord",
                    "yCoord"
                  ]
                }
              },
              "required": ["id", "tag", "text"]
            }
          },
          "useSeparators": {
            "type": "boolean"
          },
          "textColWidth": {
            "type": "number"
          }
        },
        "required": ["id", "rows", "x", "y"]
      }
    },
    "useDefaultTagsSize": {
      "description": "not in use",
      "type": "boolean"
    },
    "size": {
      "description": "not in use",
      "type": "number"
    },
    "scadaBackgroundId": {
      "type": "number"
    },
    "type": {
      "type": "string"
    },
    "fontSizeScale": {
      "type": ["null", "number"]
    },
    "labelLayers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "layer": {
            "type": "string"
          },
          "visible": {
            "type": "boolean"
          }
        },
        "required": ["layer", "visible"]
      }
    },
    "useNewScada": {
      "type": "boolean"
    },
    "truncateSize": {
      "type": "number"
    },
    "hideHeader": {
      "type": "boolean"
    },
    "id": {
      "type": "string"
    },
    "reportOptions": {
      "type": "null"
    },
    "reportMode": {
      "type": "boolean"
    },
    "stateCb": {
      "type": "object"
    },
    "calendarType": {
      "const": "CALENDAR_445",
      "type": "string"
    }
  },
  "required": [
    "elements",
    "freeTextTagTables",
    "freeTexts",
    "labelLayers",
    "maxDelayTime",
    "maxDelayTimeUnit",
    "polygons",
    "refreshRate",
    "showScadaSettings"
  ],
  "definitions": {
    "DweenTimeUnitEnum": {
      "type": "string",
      "enum": [
        "MILLIS",
        "SECONDS",
        "MINUTES",
        "HALFHOUR",
        "HOURS",
        "DAYS",
        "WEEKS",
        "MONTHS",
        "YEARS"
      ]
    },
    "NumberConditions": {
      "enum": ["eq", "gt", "gte", "lt", "lte", "neq"],
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}
