{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "type": "object",
  "title": "TopologyNodeResponse",
  "description": "TopologyNodes PI_JSON",
  "required": [
    "topologyNodes"
  ],
  "additionalProperties": false,
  "properties": {
    "topologyNodes": {
      "type": "array",
      "description": "TopologyNodes",
      "items": {
        "$ref": "#/definitions/TopologyNode"
      }
    }
  },
  "definitions": {
    "BoundingBox": {
      "description": "Bounding box according to CRS EPSG:3857 Web Mercator format",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "crs",
        "minx",
        "maxy",
        "maxx",
        "miny"
      ],
      "properties": {
        "crs": {
          "type": "string",
          "enum": ["EPSG:3857"]
        },
        "minx": {
          "type": "string"
        },
        "maxy": {
          "type": "string"
        },
        "maxx": {
          "type": "string"
        },
        "miny": {
          "type": "string"
        }
      }
    },
    "TopologyNode": {
      "type": "object",
      "required": [
        "id", "name"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "workflowId": {
          "type": "string"
        },
        "localRun": {
          "type": "boolean"
        },
        "componentSettingsId": {
          "type": "string"
        },
        "icon": {
          "type": "string"
        },
        "iconId": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "embedUrl": {
          "type": "string"
        },
        "plotId": {
          "type": "string"
        },
        "displayId": {
          "type": "string"
        },
        "boundingBox": {
          "$ref": "#/definitions/BoundingBox"
        },
        "locationIds" : {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "mainPanel": {
          "type": "string"
        },
        "filterIds" : {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "disableMap" : {
          "type": "boolean"
        },
        "documentFile": {
          "type": "string"
        },
        "gridDisplaySelection" : {
          "type": "object",
          "description": "Selectesd grid display",
          "$ref": "#/definitions/GridDisplaySelection"

        },

        "displayGroups": {
          "type": "array",
          "description": "Display group item",
          "items": {
            "$ref": "#/definitions/TopologyDisplayGroupItem"
          }
        },
        "topologyNodes": {
          "type": "array",
          "description": "TopologyNodes",
          "items": {
            "$ref": "#/definitions/TopologyNode"
          }
        },
        "secondaryWorkflows": {
          "type": "array",
          "description": "Secondary workflows",
          "items": {
            "$ref": "#/definitions/SecondaryWorkflowGroupItem"
          }
        },
        "dataDownloadDisplay": {
          "type": "object",
          "description": "Data download display",
          "$ref": "#/definitions/DataDownloadDisplayItem"
        },
        "logDisplay": {
          "type": "object",
          "description": "Log display",
          "$ref": "#/definitions/LogDisplayItem"
        },
        "dynamicReportDisplay": {
          "type": "object",
          "description": "Dynamic report display",
          "$ref": "#/definitions/DynamicReportDisplayItem"
        },
        "dashboardPanels": {
          "type": "array",
          "description": "Dashboard panels",
          "items": {
            "$ref": "#/definitions/DashboardPanelItem"
          }
        },
        "microFrontEnds": {
          "type": "array",
          "description": "Micro front ends",
          "items": {
            "$ref": "#/definitions/MicroFrontEndItem"
          }
        },

        "reportDisplay": {
          "type": "object",
          "description": "Report display",
          "$ref": "#/definitions/ReportDisplayItem"
        },
        "documentDisplayId": {
          "type": "string",
          "description": "id of the document which is coupled to this topology node"
        },
        "dataAnalysisDisplayId": {
          "type": "string",
          "description": "id of the data analysis display which is coupled to this topology node"
        },
        "scadaPanelId": {
          "type": "string",
          "description": "id of the scada panel which is coupled to this topology node"
        }
      }
    },
    "ReportDisplayItem": {
      "type": "object",
      "required": [
        "reports"
      ],
      "additionalProperties": false,
      "properties": {
        "reports": {
          "type": "array",
          "description": "ReportDisplayItemDetails",
          "items": {
            "$ref": "#/definitions/ReportDisplayItemDetails"
          }
        }
      }
    },
    "ReportDisplayItemDetails": {
      "type": "object",
      "required": [
        "moduleInstanceId"
      ],
      "additionalProperties": false,
      "properties": {
        "moduleInstanceId": {
          "type": "string"
        }
      }
    },
    "DashboardPanelItem": {
      "type": "object",
      "required": [
        "id"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "MicroFrontEndItem": {
      "type": "object",
      "required": [
        "id"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "LogDisplayItem": {
      "type": "object",
      "required": [
        "id"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "DynamicReportDisplayItem": {
      "type": "object",
      "required": [
        "id"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "DataDownloadDisplayItem": {
      "type": "object",
      "required": [
        "showLocationName",
        "showParameterName",
        "attributes"
      ],
      "additionalProperties": false,
      "properties": {
        "showLocationName": {
          "type": "string",
          "enum": ["id", "short name", "name"]
        },
        "showParameterName": {
          "type": "string",
          "enum": ["id", "short name", "name"]
        },
        "attributes": {
          "type": "array",
          "description": "DataDownloadDisplayItemAttributes",
          "items": {
            "$ref": "#/definitions/DataDownloadDisplayAttributeItem"
          }
        }
      }
    },
    "DataDownloadDisplayAttributeItem": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "SecondaryWorkflowGroupItem": {
      "type": "object",
      "required": [
        "secondaryWorkflowId",
        "description"
      ],
      "additionalProperties": false,
      "properties": {
        "secondaryWorkflowId": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "properties": {
          "type": "array",
          "description": "SecondaryWorkflowProperties",
          "items": {
            "$ref": "#/definitions/SecondaryWorkflowProperties"
          }
        }
      }
    },
    "SecondaryWorkflowProperties": {
      "type": "object",
      "title": "SecondaryWorkflowProperties",
      "additionalProperties": false,
      "required": [
        "type",
        "key"
      ],
      "properties": {
        "type": {
          "enum": [
            "string",
            "float",
            "bool",
            "double",
            "int",
            "dateTime"
          ],
          "type": "string"
        },
        "key": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "editable": {
          "type": "boolean"
        },
        "value": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "time": {
          "type": "string"
        }
      }
    },
    "TopologyDisplayGroupItem": {
      "type": "object",
      "required": [
        "displayGroupId"
      ],
      "additionalProperties": false,
      "properties": {
        "displayGroupId": {
          "type": "string"
        },
        "displayGroupName": {
          "type": "string"
        },
        "plotNodes": {
          "type": "array",
          "description": "TopologyDisplayGroupPlotNode",
          "items": {
            "$ref": "#/definitions/TopologyDisplayGroupPlotNode"
          }
        }
      }
    },
    "TopologyDisplayGroupPlotNode": {
      "type": "object",
      "required": [
        "displayId"
      ],
      "additionalProperties": false,
      "properties": {
        "displayId": {
          "type": "string"
        },
        "displayName": {
          "type": "string"
        }
      }
    },
    "GridDisplaySelection": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "plotId": {
          "type": "string"
        },
        "groupId": {
          "type": "string"
        }
      }
    }

  }
}
