{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kabinethq.com/protocol/1/notifications.schema.json",
  "title": "Notifications",
  "description": "`GET /panel/notifications`; the realtime event carries one `Notification`.",
  "$defs": {
    "NotificationList": {
      "title": "NotificationList",
      "type": "object",
      "required": ["data", "meta"],
      "properties": {
        "data": { "type": "array", "items": { "$ref": "#/$defs/Notification" } },
        "meta": {
          "type": "object",
          "required": ["unread"],
          "properties": { "unread": { "type": "integer", "minimum": 0 } },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "Notification": {
      "title": "Notification",
      "type": "object",
      "required": ["id", "title", "body", "status", "read_at", "created_at"],
      "properties": {
        "id": { "$ref": "common.schema.json#/$defs/Key" },
        "title": { "type": "string" },
        "body": { "type": "string" },
        "status": { "enum": ["success", "warning", "danger"] },
        "read_at": { "oneOf": [{ "$ref": "common.schema.json#/$defs/Moment" }, { "type": "null" }] },
        "created_at": { "$ref": "common.schema.json#/$defs/Moment" }
      },
      "additionalProperties": false
    }
  }
}
