{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.bike4mind.com/schemas/export-v2/manifest.schema.json",
  "title": "Bike4Mind export bundle manifest v2",
  "type": "object",
  "required": ["exportVersion", "exportedAt", "platform", "collections", "files"],
  "properties": {
    "exportVersion": {
      "const": "2.0.0"
    },
    "exportedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "[Tt][0-9]{2}:[0-9]{2}:[0-5][0-9](?:\\.[0-9]+)?(?:[Zz]|[+-][0-9]{2}:[0-9]{2})$"
    },
    "platform": {
      "type": "string",
      "minLength": 1
    },
    "exportedBy": {
      "type": "string"
    },
    "collections": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9-]*$"
      },
      "additionalProperties": {
        "$ref": "#/$defs/collection"
      }
    },
    "files": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/entry"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "entry": {
      "type": "object",
      "required": ["path", "bytes", "sha256"],
      "properties": {
        "path": {
          "type": "string",
          "pattern": "^files/(?!\\.{1,2}(?:/|$))[^/\\\\]+(?:/(?!\\.{1,2}(?:/|$))[^/\\\\]+)*$"
        },
        "bytes": {
          "type": "integer",
          "minimum": 0
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": false
    },
    "collection": {
      "type": "object",
      "required": ["path", "count", "bytes", "sha256"],
      "properties": {
        "path": {
          "type": "string",
          "pattern": "^collections/[a-z][a-z0-9-]*\\.jsonl$"
        },
        "count": {
          "type": "integer",
          "minimum": 0
        },
        "bytes": {
          "type": "integer",
          "minimum": 0
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": false
    }
  }
}
