{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://endlss.co/tools/batch-upload/endlss.schema.json",
  "title": "Endlss batch upload manifest",
  "description": "endlss.json inside a ZIP uploaded with Endlss 'ZIP batch'. Paths in items[].file are relative to the folder that contains endlss.json. Files in the ZIP that are not listed get the defaults and a title made from their file name. A bad field or item is reported and ignored; it never blocks the rest of the batch.",
  "type": "object",
  "required": ["version"],
  "properties": {
    "$schema": { "type": "string" },
    "version": { "const": 1 },
    "defaults": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "tags": { "$ref": "#/$defs/tags", "description": "Added to every file (together with any tags chosen on the upload page)." },
        "isPrivate": { "type": "boolean", "description": "Default visibility. Private items are only visible to you (and are still moderated)." },
        "collection": {
          "description": "Put every file into a NEW collection with this name. null = no collection (you can still pick one on the upload page).",
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": ["name"],
              "properties": {
                "name": { "type": "string", "minLength": 1, "maxLength": 100 },
                "isPublic": { "type": "boolean", "default": true }
              }
            },
            { "type": "null" }
          ]
        },
        "description": { "$ref": "#/$defs/text", "description": "Description for files that don't have their own." }
      }
    },
    "items": {
      "type": "array",
      "maxItems": 500,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["file"],
        "properties": {
          "file": { "type": "string", "minLength": 1, "description": "Path of the file inside the ZIP, relative to endlss.json, e.g. \"beach/sunset.jpg\"." },
          "title": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Defaults to the file name ('-' and '_' become spaces)." },
          "description": { "$ref": "#/$defs/text" },
          "tags": { "$ref": "#/$defs/tags", "description": "Added to the default tags for this file." },
          "isPrivate": { "type": "boolean", "description": "Overrides defaults.isPrivate for this file." },
          "prompt": { "$ref": "#/$defs/text", "description": "AI generation prompt, if any." }
        }
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "text": { "type": ["string", "null"], "maxLength": 2000 },
    "tags": {
      "type": "array",
      "maxItems": 20,
      "items": { "type": "string", "minLength": 1, "maxLength": 50 }
    }
  }
}
