{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "JSON Schema generated by XMLSpy v2018 sp1 (x64) (http://www.altova.com)",
    "type": "object",
    "properties": {
        "provider": {
            "$ref": "#/definitions/provider"
        },
        "results": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/timeseries"
            }
        }
    },
    "required": [
        "results"
    ],
    "definitions": {
        "timeseries": {
            "type": "object",
            "properties": {
                "_comment": {
                    "type": "string"
                },
                "node": {
                    "$ref": "#/definitions/node"
                },
                "url": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "source": {
                    "$ref": "#/definitions/source"
                },
                "location": {
                    "$ref": "#/definitions/location"
                },
                "observationType": {
                    "$ref": "#/definitions/observationType"
                },
                "startTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "endTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "analysisTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "realization": {
                    "type": "number"
                },
                "events": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/event"
                    }
                }
            },
            "required": [
                "source",
                "location",
                "observationType",
                "startTime",
                "endTime"
            ]
        },
        "provider": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "supportUrl": {
                    "type": "string"
                }
            },
            "supportUrl": [
                "name"
            ]
        },
        "node": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "baseUrl": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                }
            },
            "required": [
                "name"
            ]
        },
        "source": {
            "type": "object",
            "properties": {
                "process": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "realizationCount": {
                    "type": "number"
                },
                "institution": {
                    "$ref": "#/definitions/institution"
                }
            },
            "required": [
                "process",
                "institution"
            ]
        },
        "institution": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                }
            },
            "required": [
                "name"
            ]
        },
        "location": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string"
                },
                "geometry": {
                    "$ref": "#/definitions/geometry"
                },
                "properties": {
                    "$ref": "#/definitions/locationProperties"
                }
            },
            "required": [
                "geometry"
            ],
            "additionalProperties": false
        },
        "locationProperties": {
            "type": "object",
            "properties": {
                "node": {
                    "$ref": "#/definitions/node"
                },
                "url": {
                    "type": "string"
                },
                "locationId": {
                    "type": "string"
                },
                "locationCode": {
                    "type": "string"
                },
                "locationName": {
                    "type": "string"
                },
                "nameSpace": {
                    "type": "string"
                },
                "parentName": {
                    "type": "string"
                },
                "referenceLevel": {
                    "type": "string"
                },
                "crs": {
                    "type": "string"
                }
            }
        },
        "geometry": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string"
                },
                "coordinates": {
                    "oneOf": [
                        {
                            "type": "array",
                            "items": {
                                "type": "number"
                            }
                        },
                        {
                            "type": "array",
                            "items": {
                                "type": "array",
                                "items": {
                                    "type": "number"
                                }
                            }
                        }
                    ]
                }
            },
            "required": [
                "type",
                "coordinates"
            ]
        },
        "observationType": {
            "type": "object",
            "properties": {
                "url": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "quantity": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
                "parameterCode": {
                    "type": "string"
                },
                "compartment": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "aspectSet": {
                    "$ref": "#/definitions/aspectSet"
                }
            },
            "required": [
                "quantity"
            ]
        },
        "event": {
            "type": "object",
            "properties": {
                "timeStamp": {
                    "type": "string",
                    "format": "date-time"
                },
                "startTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "endTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "resultTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "value": {
                    "type": "number"
                },
                "quality": {
                    "type": "number"
                },
                "additionalQuality": {
                    "type": "number"
                },
                "aspects": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/aspectValue"
                    }
                },
                "points": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/pointValue"
                    }
                }
            },
            "required": [
                "timeStamp"
            ]
        },
        "aspectSet": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "aspects": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/aspect"
                    }
                }
            },
            "required": [
                "name",
                "aspects"
            ]
        },
        "aspect": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                }
            },
            "required": [
                "name",
                "unit"
            ]
        },
        "aspectValue": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "number"
                },
                "quality": {
                    "type": "number"
                },
                "additionalQuality": {
                    "type": "number"
                },
                "points": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/pointValue"
                    }
                }
            },
            "required": [
                "name"
            ]
        },
        "aspectPointValue": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "points": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/pointValue"
                    }
                }
            },
            "required": [
                "name"
            ]
        },
        "pointValue": {
            "type": "object",
            "properties": {
                "coordinates": {
                    "type": "array",
                    "items": {
                        "type": "number"
                    }
                },
                "value": {
                    "type": "number"
                },
                "quality": {
                    "type": "number"
                },
                "additionalQuality": {
                    "type": "number"
                }
            },
            "required": [
                "coordinates",
                "value"
            ]
        }
    }
}