{
  "title": "Device",
  "description": "Payload for device provisioning",
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "devices": {
      "type": "array",
      "id": "devices",
      "required": true,
      "items": {
        "type": "object",
        "properties": {
          "device_id": {
            "description": "Device ID of the physical device",
            "type": "string"
          },
          "entity_name": {
            "description": "Name of the target entity",
            "type": "string"
          },
          "entity_type": {
            "description": "Type of the target entity",
            "type": "string",
            "required": false
          },
          "timezone": {
            "description": "Time zone where the device is located",
            "type": "string"
          },
          "protocol": {
            "description": "Protocol the device is using to communicate with the platform",
            "type": "string"
          },
          "endpoint": {
              "description": "Endpoint for the commands targeting this device",
              "type": "string"
          },
          "transport": {
            "description": "Transport protocol used by the platform to communicate with the device",
            "type": "string"
          },
          "explicitAttrs": {
            "description": "Flag about only provisioned attributes will be processed to Context Broker"
          },
          "ngsiVersion": {
            "description": "NGSI Interface for this device",
            "type": "string"
          },
          "payloadType": {
            "description": "Payload type allowed for measures for this device",
            "type": "string"
          },
          "lazy": {
            "description": "list of lazy attributes of the devices",
            "type": "array",
            "id": "lazy",
            "required": false,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "object_id": {
                  "description": "ID of the attribute in the device",
                  "type": "string"
                },
                "name": {
                  "description": "Name of the attribute in the target entity",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)+$"
                },
                "type": {
                  "description": "Type of the attribute in the target entity",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)+$"
                }
              }
            }
          },
          "attributes": {
            "description": "list of active attributes of the devices",
            "type": "array",
            "id": "attributes",
            "required": false,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "object_id": {
                  "description": "ID of the attribute in the device",
                  "type": "string"
                },
                "name": {
                  "description": "Name of the attribute in the target entity",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)+$"
                },
                "type": {
                  "description": "Type of the attribute in the target entity",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)+$"
                },
                "expression": {
                  "description": "Optional expression for measurement transformation",
                  "type": "string"
                },
                "skipValue": {
                  "description": "Attribute is skipped when result of apply expression is this value",
                  "type": "any"
                },
                "entity_name": {
                  "description": "Optional entity name for multientity updates",
                  "type": "string"
                },
                "entity_type": {
                  "description": "Optional entity type for multientity updatess",
                  "type": "string",
                  "pattern": "^([^<>;'=\"]+)+$"
                }
              }
            }
          },
          "commands": {
            "description": "list of commands of the devices",
            "type": "array",
            "id": "lazy",
            "required": false,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "object_id": {
                  "description": "ID of the attribute in the device",
                  "type": "string"
                },
                "name": {
                  "description": "Name of the attribute in the target entity",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)+$"
                },
                "type": {
                  "description": "Type of the attribute in the target entity",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)+$"
                },
                "value": {
                  "description": "Value of the command (currently ignored)",
                  "type": "string",
                  "pattern": "^([^<>();'=\"]+)*$"
                }
              }
            }
          },
          "internal_attributes": {
            "description": "Free form array of internal attributes for particular IOTAgents",
            "type": "any"
          },
          "static_attributes": {
            "description": "Free form array of data to be appended to the target entity",
            "type": "array"
          }
        }
      }
    }
  }
}
