{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://zenith-research.ca/wallpapers/v1/pack-manifest.schema.json",
  "title": "Zenith Wallpaper Pack Manifest v1",
  "type": "object",
  "required": [
    "schemaVersion",
    "id",
    "version",
    "releasedAt",
    "entry",
    "runtime",
    "requirements",
    "archive",
    "actions",
    "motion",
    "signature"
  ],
  "properties": {
    "schemaVersion": { "const": 1 },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
      "maxLength": 80
    },
    "version": { "$ref": "#/$defs/semanticVersion" },
    "releasedAt": { "type": "string", "format": "date-time" },
    "entry": { "$ref": "#/$defs/relativePath" },
    "runtime": { "$ref": "#/$defs/runtime" },
    "requirements": { "$ref": "#/$defs/requirements" },
    "archive": { "$ref": "#/$defs/archive" },
    "actions": {
      "type": "array",
      "maxItems": 12,
      "items": { "$ref": "#/$defs/action" }
    },
    "motion": { "$ref": "#/$defs/motion" },
    "signature": { "$ref": "#/$defs/signature" }
  },
  "additionalProperties": true,
  "$defs": {
    "semanticVersion": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$"
    },
    "httpsURL": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://zenith-research\\.ca/"
    },
    "relativePath": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*//)[^\\\\]+$"
    },
    "runtime": {
      "type": "object",
      "required": ["api", "minimumVersion", "maximumExclusiveVersion"],
      "properties": {
        "api": { "const": "zenith-wallpaper-host" },
        "minimumVersion": { "$ref": "#/$defs/semanticVersion" },
        "maximumExclusiveVersion": { "$ref": "#/$defs/semanticVersion" }
      },
      "additionalProperties": true
    },
    "requirements": {
      "type": "object",
      "required": ["webgl2", "wasm", "minimumMacOS"],
      "properties": {
        "webgl2": { "type": "boolean" },
        "wasm": { "type": "boolean" },
        "minimumMacOS": { "$ref": "#/$defs/semanticVersion" }
      },
      "additionalProperties": true
    },
    "archive": {
      "type": "object",
      "required": ["url", "bytes", "sha256"],
      "properties": {
        "url": { "$ref": "#/$defs/httpsURL" },
        "bytes": { "type": "integer", "minimum": 1, "maximum": 262144000 },
        "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
      },
      "additionalProperties": true
    },
    "action": {
      "type": "object",
      "required": ["id", "title", "symbol"],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "maxLength": 80
        },
        "title": { "type": "string", "minLength": 1, "maxLength": 60 },
        "symbol": { "type": "string", "minLength": 1, "maxLength": 80 }
      },
      "additionalProperties": true
    },
    "motion": {
      "type": "object",
      "required": ["supportsReducedMotion"],
      "properties": {
        "supportsReducedMotion": { "type": "boolean" }
      },
      "additionalProperties": true
    },
    "signature": {
      "type": "object",
      "required": ["algorithm", "keyID", "value"],
      "properties": {
        "algorithm": { "const": "ed25519" },
        "keyID": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "maxLength": 80
        },
        "value": { "type": "string", "minLength": 80, "maxLength": 120 }
      },
      "additionalProperties": false
    }
  }
}
