{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://enterlocus.com/schemas/locusplace-v1.schema.json",
  "title": "Locus Place archive envelope v1",
  "description": "The root locusplace.json manifest inside a .locusplace ZIP archive.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "formatVersion",
    "packageID",
    "contentVersion",
    "minimumAppVersion",
    "contents",
    "files",
    "contentHash"
  ],
  "properties": {
    "formatVersion": {
      "const": 1
    },
    "packageID": {
      "$ref": "#/$defs/identifier"
    },
    "contentVersion": {
      "$ref": "#/$defs/version"
    },
    "minimumAppVersion": {
      "$ref": "#/$defs/version"
    },
    "contents": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "destinationIDs",
        "spaceIDs",
        "experienceIDs"
      ],
      "properties": {
        "destinationIDs": {
          "$ref": "#/$defs/identifiers"
        },
        "spaceIDs": {
          "$ref": "#/$defs/identifiers"
        },
        "experienceIDs": {
          "$ref": "#/$defs/identifiers"
        }
      }
    },
    "files": {
      "type": "array",
      "maxItems": 4095,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "byteCount",
          "sha256"
        ],
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^catalog/",
            "maxLength": 512
          },
          "byteCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 805306368
          },
          "sha256": {
            "$ref": "#/$defs/sha256"
          }
        }
      }
    },
    "contentHash": {
      "$ref": "#/$defs/sha256"
    }
  },
  "$defs": {
    "identifier": {
      "type": "string",
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
    },
    "identifiers": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "#/$defs/identifier"
      }
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    }
  }
}
