{
  "title": "Device",
  "description": "Payload to update a provisioned device",
  "additionalProperties": false,
  "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"
    },
    "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"
    },
    "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"
          },
          "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"
    },
    "timestamp": {
      "description": "Timestamp",
      "type": "boolean"
    },
    "explicitAttrs": {
      "description": "Flag to decide update of active attributes only"
    },
    "ngsiVersion": {
        "description": "NGSI Interface for this device",
        "type": "string"
    },
    "payloadType": {
        "description": "Payload type allowed for measures for this device",
        "type": "string"
    },
    "useCBflowControl": {
        "description": "use CB flowControl option",
        "type": "boolean"
    },
    "storeLastMeasure": {
      "description": "Store last measure",
      "type": "boolean"
    },
    "lastMeasure": {
      "description": "last measure",
      "type": "object"
    },
    "cmdMode": {
        "description": "CB commands mode",
        "type": "string"
    }
  }
}
