{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "start": {
            "type": "number"
        },
        "end": {
            "type": "number"
        },
        "duration": {
            "type": "number"
        },
        "resolution": {
            "type": "number"
        },
        "aggregation": {
            "oneOf": [
                {
                    "type": "string",
                    "enum": [
                        "FIRST",
                        "LAST",
                        "COUNT",
                        "MAX",
                        "MIN",
                        "MEDIAN",
                        "MEAN",
                        "SUM",
                        "STD_DEV"
                    ]
                },
                {
                    "type": "string",
                    "enum": [
                        "NONE"
                    ]
                }
            ]
        },
        "attributes": {
            "type": "array",
            "items": {
                "type": "string",
                "pattern": "^[0-9a-zA-Z_-]{1,255}$"
            }
        },
        "deviceTags": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "value": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                    }
                },
                "additionalProperties": false
            },
            "maxItems": 100
        },
        "deviceIds": {
            "type": "array",
            "items": {
                "type": "string",
                "pattern": "^[A-Fa-f\\d]{24}$"
            },
            "maxItems": 1000
        },
        "limit": {
            "type": "number"
        },
        "order": {
            "type": "string",
            "enum": [
                "asc",
                "desc"
            ],
            "default": "asc"
        }
    },
    "additionalProperties": false
}