{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tune.toys/schemas/platform/notification-event.schema.json",
  "title": "NotificationEvent",
  "description": "Input of the single notify helper. params holds ICU arguments (ids, counts, handles), never rendered strings or private content.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "eventType": {
      "$ref": "enums.schema.json#/$defs/NotificationEventType"
    },
    "subject": {
      "$ref": "#/$defs/NotificationSubject"
    },
    "params": {
      "type": "object",
      "maxProperties": 32,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9_]{0,31}$"
      },
      "additionalProperties": {
        "$ref": "#/$defs/NotificationParam"
      }
    },
    "actorAccountId": {
      "anyOf": [
        {
          "$ref": "common.schema.json#/$defs/EntityId"
        },
        {
          "type": "null"
        }
      ]
    },
    "dedupeKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "Deterministic from the source event; unique per account."
    },
    "groupKey": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        {
          "type": "null"
        }
      ],
      "description": "Collapses unread notifications within 24 hours."
    }
  },
  "required": [
    "eventType",
    "subject",
    "params",
    "actorAccountId",
    "dedupeKey",
    "groupKey"
  ],
  "$defs": {
    "NotificationSubject": {
      "title": "NotificationSubject",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "minLength": 1,
          "maxLength": 32,
          "pattern": "^[a-z][a-z_]{0,31}$"
        },
        "id": {
          "$ref": "common.schema.json#/$defs/EntityId"
        }
      },
      "required": ["type", "id"]
    },
    "NotificationParam": {
      "title": "NotificationParam",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 256
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 256
          },
          "maxItems": 3
        }
      ]
    }
  }
}
