{
  "$id": "sevone_device",
  "type": "object",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "ph_request_type": {
      "type": "string",
      "description": "type of request (internal to adapter)",
      "default": "getMaps",
      "enum": [
        "getMaps",
        "createMap",
        "updateMap",
        "deleteMap",
        "partiallyUpdateStatusMapById"
      ],
      "external_name": "ph_request_type"
    },
    "id": {
      "type": "integer",
      "description": "id of the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "minimum": 0,
      "external_name": "id"
    },
    "name": {
      "type": "string",
      "description": "name of the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "external_name": "name"
    },
    "imageId": {
      "type": "integer",
      "description": "id of the image used for the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "minimum": 0,
      "external_name": "imageId"
    },
    "imageName": {
      "type": "string",
      "description": "name of the image used for the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "external_name": "imageName"
    },
    "imageMimeType": {
      "type": "string",
      "description": "type for the image used for the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "external_name": "imageMimeType"
    },
    "imageSize": {
      "type": "integer",
      "description": "size of the image used for the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "minimum": 0,
      "external_name": "imageSize"
    },
    "connections": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "id of the map connection",
            "minimum": 0,
            "external_name": "id"
          },
          "nodeASide": {
            "type": "integer",
            "description": "id of the node on the A side of the connection",
            "minimum": 0,
            "external_name": "nodeAId"
          },
          "nodeBSide": {
            "type": "integer",
            "description": "id of the node on the B side of the connection",
            "minimum": 0,
            "external_name": "nodeBId"
          },
          "type": {
            "type": "string",
            "description": "type of the connection",
            "examples": [
              "device"
            ],
            "external_name": "type"
          },
          "elements": {
            "type": "array",
            "description": "array containing the elements of the connection",
            "items": {
              "type": "object",
              "properties": {
                "deviceId": {
                  "type": "integer",
                  "description": "the id of the device",
                  "minimum": 0,
                  "external_name": "deviceId"
                },
                "elementId": {
                  "type": "integer",
                  "description": "the id of the element",
                  "minimum": 0,
                  "external_name": "elementId"
                },
                "pluginId": {
                  "type": "integer",
                  "description": "the id of the plugin",
                  "minimum": 0,
                  "external_name": "pluginId"
                },
                "reportId": {
                  "type": "integer",
                  "description": "the id of the report",
                  "minimum": 0,
                  "external_name": "reportId"
                }
              }
            },
            "external_name": "data"
          }
        }
      },
      "description": "array containing the connections for the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "external_name": "connections"
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "id of the map node",
            "minimum": 0,
            "external_name": "id"
          },
          "name": {
            "type": "string",
            "description": "name of the node",
            "examples": [
              "device"
            ],
            "external_name": "name"
          },
          "type": {
            "type": "string",
            "description": "type of the node",
            "examples": [
              "device"
            ],
            "external_name": "type"
          },
          "x": {
            "type": "integer",
            "description": "x position of node on the map",
            "minimum": 0,
            "external_name": "x"
          },
          "y": {
            "type": "integer",
            "description": "y position of node on the map",
            "minimum": 0,
            "external_name": "y"
          },
          "elements": {
            "type": "array",
            "description": "array containing the elements of the connection",
            "items": {
              "type": "object",
              "properties": {
                "deviceId": {
                  "type": "integer",
                  "description": "the id of the device",
                  "minimum": 0,
                  "external_name": "deviceId"
                },
                "elementId": {
                  "type": "integer",
                  "description": "the id of the element",
                  "minimum": 0,
                  "external_name": "elementId"
                },
                "pluginId": {
                  "type": "integer",
                  "description": "the id of the plugin",
                  "minimum": 0,
                  "external_name": "pluginId"
                },
                "reportId": {
                  "type": "integer",
                  "description": "the id of the report",
                  "minimum": 0,
                  "external_name": "reportId"
                }
              }
            },
            "external_name": "data"
          }
        }
      },
      "description": "array containing the nodes for the map",
      "parse": false,
      "encode": false,
      "encrypt": {
        "type": "AES",
        "key": ""
      },
      "external_name": "nodes"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "ph_request_type": {
            "enum": [
              "createMap"
            ]
          }
        }
      },
      "then": {
        "required": [
          "name",
          "imageId"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "ph_request_type": {
            "enum": [
              "updateMap"
            ]
          }
        }
      },
      "then": {
        "required": [
          "name",
          "imageId"
        ]
      }
    }
  ],
  "definitions": {}
}