{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ntfyx.me/developers/plugin.schema.json",
  "title": "Ntfyx public plugin submission inputs",
  "description": "Anonymous plugin and content submissions; each requires an in-app review before publication. A manifest sample is only review/preview material, not a subscriber delivery. String limits use UTF-16 code units in the API/CLI; maxLength adds a Unicode-codepoint upper bound. The service validates its complete canonical manifest within 1600 UTF-8 bytes after fixed official fields and English fallbacks. Publications also require the complete Message with Session metadata to fit 16384 UTF-8 bytes; the Python client checks a conservative service-compatible Session budget.",
  "oneOf": [
    {
      "$ref": "#/$defs/manifest"
    },
    {
      "$ref": "#/$defs/sample"
    },
    {
      "$ref": "#/$defs/publication"
    },
    {
      "$ref": "#/$defs/submission"
    }
  ],
  "$defs": {
    "url": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500,
      "pattern": "^https://[^/]+"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "body": {
      "type": "string",
      "minLength": 1,
      "maxLength": 8000
    },
    "manifest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "summary",
        "version",
        "language",
        "frequency",
        "source_urls",
        "privacy_url",
        "support_url"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "name_en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "summary": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "summary_en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 40
        },
        "language": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20
        },
        "frequency": {
          "const": "event"
        },
        "source_urls": {
          "type": "array",
          "minItems": 1,
          "maxItems": 5,
          "items": {
            "$ref": "#/$defs/url"
          }
        },
        "privacy_url": {
          "$ref": "#/$defs/url"
        },
        "support_url": {
          "$ref": "#/$defs/url"
        }
      }
    },
    "sample": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "title",
        "body"
      ],
      "properties": {
        "title": {
          "$ref": "#/$defs/title"
        },
        "body": {
          "$ref": "#/$defs/body"
        }
      }
    },
    "publication": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "event_id",
        "title",
        "body"
      ],
      "properties": {
        "event_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.:-]{1,80}$"
        },
        "title": {
          "$ref": "#/$defs/title"
        },
        "body": {
          "$ref": "#/$defs/body"
        }
      }
    },
    "submission": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation_id",
        "slug",
        "manifest",
        "sample"
      ],
      "properties": {
        "operation_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{32}$"
        },
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
        },
        "manifest": {
          "$ref": "#/$defs/manifest"
        },
        "plugin_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,128}$",
          "description": "Explicit approved dynamic plugin ID for a metadata update. Omit for a new plugin; it is public identity, not authority."
        },
        "sample": {
          "$ref": "#/$defs/sample"
        }
      }
    }
  }
}
