{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://assets.tiantianspeak.com/schemas/collections.schema.json",
  "title": "Collections（题库索引）",
  "description": "在线题库的索引（如 `banks/collections.json`、`premium-collections.json`、`topics/collections.json`）：对象数组，每项指向一个 collection 或题库包。元数据由 `scripts/banks/sync-index-descriptions.py` 从被指向的文件自动同步，不用手写。索引里不能再套索引。",
  "type": "array",
  "minItems": 1,
  "items": {
    "type": "object",
    "required": [
      "path"
    ],
    "properties": {
      "path": {
        "type": "string",
        "pattern": "^(?!/)(?!.*://)(?!.*(^|/)\\.\\.(/|$)).+\\.(json|zip)$",
        "description": "相对索引网址的路径，必须以 `.json` 或 `.zip` 结尾；题库包以 `.package.json`（或打包好的 `.package.zip`）结尾。"
      },
      "name": {
        "type": "string",
        "description": "卡片标题；没写用文件名。"
      },
      "description": {
        "type": "string",
        "description": "卡片简介（最多显示 3 行）。"
      },
      "category": {
        "type": "string"
      },
      "language": {
        "enum": [
          "zh",
          "en"
        ],
        "description": "文本语言。读取时也宽容 `en-US` / `english` / `英文` 等；发布的文件请写 `zh` 或 `en`。"
      },
      "tags": {
        "description": "分级标签。字符串数组（也可写成单个字符串）；每个标签是一条层级路径。",
        "oneOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "pattern": "^[^/\\s][^/]*(/[^/]+)*$",
              "description": "分级标签：用 `/` 分隔的层级路径，如 `HSK/初级`、`名著/外国文学`。"
            },
            "uniqueItems": true
          },
          {
            "type": "string",
            "minLength": 1,
            "pattern": "^[^/\\s][^/]*(/[^/]+)*$",
            "description": "分级标签：用 `/` 分隔的层级路径，如 `HSK/初级`、`名著/外国文学`。"
          }
        ]
      }
    },
    "additionalProperties": false
  }
}
