{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "oneOf": [
        {
            "title": "Device State",
            "description": "Schema for a single Device state",
            "type": "object",
            "properties": {
                "time": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "number"
                        },
                        {
                            "type": "object",
                            "properties": {
                                "$date": {
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "$date"
                            ]
                        }
                    ]
                },
                "meta": {},
                "data": {
                    "type": "object",
                    "patternProperties": {
                        "^[0-9a-zA-Z_-]{1,255}$": {
                            "type": [
                                "number",
                                "string",
                                "boolean"
                            ]
                        }
                    },
                    "additionalProperties": false
                },
                "flowVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                }
            },
            "required": [
                "data"
            ],
            "additionalProperties": false
        },
        {
            "title": "Device States",
            "description": "Schema for an array of Device states",
            "type": "array",
            "items": {
                "title": "Device State",
                "description": "Schema for a single Device state",
                "type": "object",
                "properties": {
                    "time": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "number"
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "$date": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "$date"
                                ]
                            }
                        ]
                    },
                    "meta": {},
                    "data": {
                        "type": "object",
                        "patternProperties": {
                            "^[0-9a-zA-Z_-]{1,255}$": {
                                "type": [
                                    "number",
                                    "string",
                                    "boolean"
                                ]
                            }
                        },
                        "additionalProperties": false
                    },
                    "flowVersion": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                    }
                },
                "required": [
                    "data"
                ],
                "additionalProperties": false
            }
        }
    ]
}