{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "allOf": [ { "type": "object", "properties": { "eventId": { "type": "string", "format": "uuid" }, "deviceId": { "type": [ "string", "null" ], "format": "uuid" }, "time": { "type": "string", "format": "date-time" }, "version": { "type": "string" } }, "required": [ "eventId", "time", "version" ] }, { "oneOf": [ { "$ref": "#/$defs/deviceUpdate" }, { "$ref": "#/$defs/accessCodeUpdate" }, { "$ref": "#/$defs/commandUpdate" }, { "$ref": "#/$defs/userDevicesUpdate" }, { "$ref": "#/$defs/clientUpdate" } ] } ], "$defs": { "deviceUpdate": { "allOf": [ { "type": "object", "properties": { "eventType": { "const": "DeviceUpdate" } } }, { "oneOf": [ { "$ref": "#/$defs/deviceLockStateChanged" }, { "$ref": "#/$defs/deviceBatteryStateChanged" }, { "$ref": "#/$defs/deviceConnectivityStateChanged" }, { "$ref": "#/$defs/deviceAlarmStateChanged" }, { "$ref": "#/$defs/deviceKeypadLockoutStateChanged" } ] } ] }, "deviceLockStateChanged": { "type": "object", "properties": { "trigger": { "const": "DeviceLockStateChanged" }, "data": { "type": "object", "properties": { "lockState": { "type": "string", "enum": [ "Unlocked", "Locked", "Jammmed", "Unknown" ] }, "accessor": { "type": [ "object", "null" ], "properties": { "id": { "type": [ "string", "null" ], "format": "uuid" }, "friendlyName": { "type": [ "string", "null" ] }, "accessType": { "type": "string", "enum": [ "AccessCode", "VirtualKey", "AutoRelock", "Thumbturn", "1TouchLocking" ] } }, "required": [ "accessType" ] } }, "required": [ "lockState" ] } }, "required": [ "trigger", "data" ] }, "deviceBatteryStateChanged": { "type": "object", "properties": { "trigger": { "const": "DeviceBatteryStateChanged" }, "data": { "type": "object", "properties": { "batteryState": { "type": "string", "enum": [ "Normal", "Low", "CriticallyLow", "Unknown" ] }, "percentageBatteryLevel": { "type": "integer", "minimum": 0, "maximum": 100 } }, "required": [ "batteryState", "percentageBatteryLevel" ] } }, "required": [ "trigger", "data" ] }, "deviceConnectivityStateChanged": { "type": "object", "properties": { "trigger": { "const": "DeviceConnectivityStateChanged" }, "data": { "type": "object", "properties": { "connected": { "type": "boolean" } }, "required": [ "connected" ] } }, "required": [ "trigger", "data" ] }, "deviceAlarmStateChanged": { "type": "object", "properties": { "trigger": { "const": "DeviceAlarmStateChanged" }, "data": { "type": "object", "properties": { "inAlarm": { "type": "boolean" } }, "required": [ "inAlarm" ] } }, "required": [ "trigger", "data" ] }, "deviceKeypadLockoutStateChanged": { "type": "object", "properties": { "trigger": { "const": "DeviceKeypadLockoutStateChanged" }, "data": { "type": "object", "properties": { "lockedOut": { "type": "boolean" } }, "required": [ "lockedOut" ] } }, "required": [ "trigger", "data" ] }, "accessCodeUpdate": { "type": "object", "properties": { "eventType": { "const": "AccessCodeUpdate" }, "trigger": { "type": "string", "enum": [ "AccessCodeAdded", "AccessCodeUpdated", "AccessCodeDeleted" ] }, "data": { "type": "object", "properties": { "accessCodeId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "code": { "type": "string" }, "accessCodeLength": { "type": "integer" }, "readOnly": { "type": "boolean" }, "scheduleType": { "type": "string", "enum": [ "Always", "Recurring", "Temporary" ] }, "scheduleDetails": { "type": "object", "properties": { "schedules": { "type": "array", "items": { "type": "object", "properties": { "startTime": { "type": "string" }, "endTime": { "type": "string" }, "activeWeekDays": { "type": "array", "items": { "type": "string", "enum": [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ] } } }, "required": [ "startTime", "endTime", "activeWeekDays" ] } } } } }, "required": [ "accessCodeId", "name", "code", "accessCodeLength", "readOnly", "scheduleDetails", "scheduleType" ] } }, "required": [ "eventType", "trigger", "data" ] }, "commandUpdate": { "allOf": [ { "type": "object", "properties": { "eventType": { "const": "CommandUpdate" } }, "required": [ "eventType" ] }, { "oneOf": [ { "$ref": "#/$defs/commandSucceeded" }, { "$ref": "#/$defs/commandFailed" }, { "$ref": "#/$defs/commandTimedOut" } ] } ] }, "commandSucceeded": { "type": "object", "properties": { "trigger": { "const": "CommandSucceeded" }, "data": { "$ref": "#/$defs/commandData" } } }, "commandFailed": { "type": "object", "properties": { "trigger": { "const": "CommandFailed" }, "data": { "allOf": [ { "type": "object", "properties": { "statusCode": { "type": "integer" }, "errorCode": { "type": "integer" }, "errorMessage": { "type": "string" } } }, { "$ref": "#/$defs/commandData" } ] } } }, "commandTimedOut": { "type": "object", "properties": { "trigger": { "const": "CommandTimedOut" }, "data": { "$ref": "#/$defs/commandData" } } }, "commandData": { "type": "object", "properties": { "commandId": { "type": "string", "format": "uuid" }, "commandType": { "type": "string", "enum": [ "SetLockState", "AddAccessCode", "UpdateAccessCode", "DeleteAccessCode", "DeleteAllAccessCodes" ] }, "accessCodeId": { "type": [ "string", "null" ], "format": "uuid" }, "requestedLockState": { "type": [ "string", "null" ] } }, "required": [ "commandId", "commandType" ] }, "userDevicesUpdate": { "type": "object", "properties": { "eventType": { "const": "UserDevicesUpdate" }, "trigger": { "type": "string", "enum": [ "DeviceAdded", "DeviceNameChanged", "DeviceRemoved" ] }, "data": { "type": "object", "properties": { "name": { "type": [ "string", "null" ] } }, "required": [ "name" ] } }, "required": [ "eventType", "trigger", "data" ] }, "clientUpdate": { "type": "object", "properties": { "eventType": { "const": "ClientEvent" }, "trigger": { "type": "string", "enum": [ "GlobalSignOut", "IntegrationSignOut" ] }, "userId": { "type": [ "string", "null" ], "format": "uuid" }, "clientId": { "type": [ "string", "null" ], "format": "uuid" } }, "required": [ "eventType", "trigger" ] } } }