{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://zuilib.com/r/schema.json",
  "title": "ZUI registry",
  "description": "Index (r/latest/index.json, r/v/<version>/index.json) and item (r/latest/<name>.json) documents of the ZUI component registry.",
  "oneOf": [
    {
      "type": "object",
      "required": [
        "name",
        "package",
        "version",
        "items"
      ],
      "properties": {
        "$schema": {
          "type": "string"
        },
        "name": {
          "const": "zui"
        },
        "package": {
          "const": "@zuilib/components"
        },
        "version": {
          "type": "string"
        },
        "homepage": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "type",
              "version",
              "title",
              "description",
              "dependencies",
              "registryDependencies",
              "files"
            ],
            "properties": {
              "$schema": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9-]+$"
              },
              "type": {
                "enum": [
                  "component",
                  "lib",
                  "theme"
                ]
              },
              "version": {
                "type": "string",
                "description": "The @zuilib/components version the item was generated from"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "dependencies": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "npm packages with version ranges, e.g. clsx@^2.1.1"
              },
              "registryDependencies": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Names of other items this item needs"
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "path",
                    "target"
                  ],
                  "properties": {
                    "path": {
                      "type": "string",
                      "description": "Source path in the zui repo, relative to packages/components"
                    },
                    "target": {
                      "type": "string",
                      "description": "Install path; components/zui/… or styles/zui/…"
                    },
                    "content": {
                      "type": "string",
                      "description": "The file, present in item files and absent from the index"
                    },
                    "sha256": {
                      "type": "string",
                      "description": "sha256 of content, hex"
                    }
                  }
                }
              },
              "docs": {
                "type": "string"
              },
              "meta": {
                "type": "object"
              }
            }
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "name",
        "type",
        "version",
        "title",
        "description",
        "dependencies",
        "registryDependencies",
        "files"
      ],
      "properties": {
        "$schema": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "type": {
          "enum": [
            "component",
            "lib",
            "theme"
          ]
        },
        "version": {
          "type": "string",
          "description": "The @zuilib/components version the item was generated from"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "dependencies": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "npm packages with version ranges, e.g. clsx@^2.1.1"
        },
        "registryDependencies": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Names of other items this item needs"
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "path",
              "target"
            ],
            "properties": {
              "path": {
                "type": "string",
                "description": "Source path in the zui repo, relative to packages/components"
              },
              "target": {
                "type": "string",
                "description": "Install path; components/zui/… or styles/zui/…"
              },
              "content": {
                "type": "string",
                "description": "The file, present in item files and absent from the index"
              },
              "sha256": {
                "type": "string",
                "description": "sha256 of content, hex"
              }
            }
          }
        },
        "docs": {
          "type": "string"
        },
        "meta": {
          "type": "object"
        }
      }
    }
  ]
}
