{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "CTT Sensor Status Schema",
    "type": "object",
    "properties": {
        "eui": {
            "type": "string"
        },
        "position": {
            "type": "object",
            "properties": {
                "lat": {
                    "type": "number"
                },
                "lon": {
                    "type": "number"
                }
            },
            "required": [
                "lat",
                "lon"
            ]
        },
        "status": {
            "type": "string",
            "enum": [
                "OK",
                "UNKNOWN"
            ]
        },
        "lastSeen": {
            "type": "string"
        },
        "lastObservation": {
            "type": "object",
            "properties": {
                "eui": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "properties": {
                        "gateway_eui": {
                            "type": "string"
                        },
                        "server_time": {
                            "type": "string"
                        },
                        "datarate": {
                            "type": "string"
                        },
                        "frequency": {
                            "type": "number"
                        },
                        "rssi": {
                            "type": "integer"
                        },
                        "lsnr": {
                            "type": "integer"
                        },
                        "codingrate": {
                            "type": "string"
                        },
                        "modulation": {
                            "type": "string"
                        },
                        "channel": {
                            "type": "integer"
                        },
                        "rfchain": {
                            "type": "integer"
                        },
                        "crc": {
                            "type": "integer"
                        },
                        "altitude": {
                            "type": "integer"
                        },
                        "longitude": {
                            "type": "number"
                        },
                        "latitude": {
                            "type": "number"
                        }
                    },
                    "required": [
                        "gateway_eui",
                        "server_time",
                        "datarate",
                        "frequency",
                        "rssi",
                        "lsnr",
                        "codingrate",
                        "modulation",
                        "channel",
                        "rfchain",
                        "crc",
                        "altitude",
                        "longitude",
                        "latitude"
                    ]
                },
                "data": {
                    "type": "object",
                    "properties": {
                        "co2": {
                            "type": "number"
                        },
                        "no2": {
                            "type": "integer"
                        },
                        "temperature": {
                            "type": "number"
                        },
                        "humidity": {
                            "type": "number"
                        },
                        "pressure": {
                            "type": "number"
                        },
                        "pm1": {
                            "type": "integer"
                        },
                        "pm2": {
                            "type": "integer"
                        },
                        "pm10": {
                            "type": "integer"
                        },
                        "batteryLevel": {
                            "type": "integer"
                        }
                    },
                    "required": [
                        "co2",
                        "no2",
                        "temperature",
                        "humidity",
                        "pressure",
                        "batteryLevel"
                    ]
                }
            },
            "required": [
                "eui",
                "metadata",
                "data"
            ]
        }
    },
    "required": [
        "eui",
        "position",
        "status",
        "lastSeen",
        "lastObservation"
    ]
}