{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "eventId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "creationDate": {
            "type": "string",
            "format": "date-time"
        },
        "lastUpdated": {
            "type": "string",
            "format": "date-time"
        },
        "sourceType": {
            "type": "string",
            "enum": [
                "flow",
                "user",
                "device",
                "apiToken",
                "experienceUser",
                "public"
            ]
        },
        "sourceId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "sourceName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
        },
        "level": {
            "type": "string",
            "enum": [
                "info",
                "warning",
                "error",
                "critical"
            ]
        },
        "state": {
            "type": "string",
            "enum": [
                "new",
                "acknowledged",
                "resolved"
            ]
        },
        "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
        },
        "message": {
            "type": "string",
            "maxLength": 32767
        },
        "data": {},
        "deviceId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "deviceName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
        },
        "eventTags": {
            "type": "object",
            "patternProperties": {
                "^[0-9a-zA-Z_-]{1,255}$": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                }
            },
            "additionalProperties": false
        },
        "updates": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "sourceType": {
                        "type": "string",
                        "enum": [
                            "flow",
                            "user",
                            "device",
                            "apiToken",
                            "experienceUser",
                            "public"
                        ]
                    },
                    "sourceId": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "sourceName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                    },
                    "creationDate": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "comment": {
                        "type": "string",
                        "maxLength": 32767
                    },
                    "data": {},
                    "stateChange": {
                        "type": "object",
                        "properties": {
                            "old": {
                                "type": "string",
                                "enum": [
                                    "new",
                                    "acknowledged",
                                    "resolved"
                                ]
                            },
                            "new": {
                                "type": "string",
                                "enum": [
                                    "new",
                                    "acknowledged",
                                    "resolved"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}