{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/romm/json-schema/romm-notification-create-payload-schema.json",
  "title": "NotificationCreatePayload",
  "description": "A notification sent through the API, shown with its own title and body.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/romm-notifications-api-openapi.yml#/components/schemas/NotificationCreatePayload",
  "properties": {
    "title": {
      "type": "string",
      "maxLength": 255,
      "minLength": 1,
      "title": "Title"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1000
        },
        {
          "type": "null"
        }
      ],
      "title": "Body"
    },
    "level": {
      "$ref": "#/$defs/NotificationLevel",
      "default": "info"
    },
    "kind": {
      "type": "string",
      "maxLength": 64,
      "pattern": "^[a-z0-9][a-z0-9_.:-]*$",
      "title": "Kind",
      "default": "custom"
    },
    "link": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1000
        },
        {
          "type": "null"
        }
      ],
      "title": "Link",
      "description": "A path inside RomM, such as `/rom/12`."
    },
    "icon": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64,
          "pattern": "^mdi-[a-z0-9-]+$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Icon",
      "description": "A Material Design Icons name, such as `mdi-sync`."
    },
    "data": {
      "additionalProperties": true,
      "type": "object",
      "title": "Data"
    },
    "recipients": {
      "anyOf": [
        {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        {
          "type": "string",
          "enum": [
            "admins",
            "all"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Recipients",
      "description": "User ids, `admins` or `all`; only an admin may notify anyone but themselves. Null notifies the caller."
    }
  },
  "type": "object",
  "required": [
    "title"
  ],
  "$defs": {
    "NotificationLevel": {
      "type": "string",
      "enum": [
        "info",
        "success",
        "warning",
        "error"
      ],
      "title": "NotificationLevel"
    }
  }
}