{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://app.domusvox.de/schema/package-manifest-1.json",
  "title": "DomusVox package manifest",
  "description": "manifest.json at the root of every package. Unknown fields are allowed and ignored by DomusVox, so new optional fields never break older versions.",
  "type": "object",
  "required": [
    "schema",
    "id",
    "publisher",
    "kind",
    "version",
    "name",
    "description",
    "licence",
    "authors",
    "domusvox"
  ],
  "properties": {
    "schema": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{1,39}(\\.[a-z][a-z0-9_]{0,19})?$",
      "description": "Lower-case letters, digits and _, 2 to 40 characters; one dot marks an add-on (main.addition)."
    },
    "publisher": {
      "type": "string",
      "maxLength": 64,
      "pattern": "^(domusvox|[a-z0-9-]+(\\.[a-z0-9-]+)+)$",
      "description": "\"domusvox\" for official packages, otherwise a reversed domain such as org.example."
    },
    "kind": {
      "enum": ["foundation", "elements", "furniture", "materials", "look", "language"]
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-[0-9A-Za-z.-]+)?$"
    },
    "name": {
      "$ref": "#/$defs/texts"
    },
    "description": {
      "$ref": "#/$defs/texts"
    },
    "licence": {
      "enum": [
        "CC0-1.0",
        "CC-BY-4.0",
        "CC-BY-3.0",
        "MIT",
        "BSD-2-Clause",
        "BSD-3-Clause",
        "Apache-2.0"
      ]
    },
    "attribution": {
      "type": "string",
      "maxLength": 300,
      "description": "Credit line required by the licence, e.g. \"Assets made by Zsky\"."
    },
    "authors": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "url": {
            "type": "string",
            "pattern": "^https://"
          }
        }
      }
    },
    "source": {
      "type": "string",
      "pattern": "^https://",
      "description": "Where the original assets come from."
    },
    "domusvox": {
      "type": "string",
      "minLength": 1,
      "description": "Range of DomusVox versions, e.g. \">=0.6.0\"."
    },
    "dependencies": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9_]{1,39}(\\.[a-z][a-z0-9_]{0,19})?$"
      },
      "additionalProperties": {
        "type": "string",
        "minLength": 1
      }
    },
    "extends": {
      "type": ["string", "null"]
    },
    "replaces": {
      "type": "object",
      "description": "Element keys that were renamed: old key -> new key.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "content": {
      "type": "object",
      "properties": {
        "elements": {
          "type": "string",
          "pattern": "^[a-z0-9_/.-]+\\.json$"
        }
      }
    },
    "network": {
      "type": "array",
      "maxItems": 0,
      "description": "Hosts the package talks to. Content packages talk to none."
    },
    "regions": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(\\*|[A-Z]{2}(-[A-Z0-9]{1,3})?)$"
      }
    },
    "icon": {
      "type": "string",
      "pattern": "^[a-z0-9_/.-]+\\.svg$"
    }
  },
  "$defs": {
    "texts": {
      "type": "object",
      "required": ["en", "de"],
      "propertyNames": {
        "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
      },
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 300
      }
    }
  }
}
