{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kiwe.dev/contracts/kiwe.appsite-package.v1.schema.json",
  "title": "Kiwe AppSite package v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "packageId", "sourceHash", "compiler", "contracts", "artifacts", "compatibility", "integrity"],
  "properties": {
    "schema": { "const": "kiwe.appsite-package.v1" },
    "packageId": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]+$" },
    "sourceHash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "compiler": {
      "type": "object", "additionalProperties": false, "required": ["name", "version", "deterministic", "aiDirectJson"],
      "properties": {
        "name": { "const": "SEAM Compiler" }, "version": { "type": "string", "minLength": 1 },
        "deterministic": { "const": true }, "aiDirectJson": { "const": false }
      }
    },
    "contracts": { "type": "array", "minItems": 6, "items": { "type": "string" } },
    "artifacts": {
      "type": "object", "additionalProperties": false,
      "required": ["capture", "pageIr", "behaviorIr", "assets", "assetImportPlan", "siteGraph", "frameworkProfile", "geometry", "bindings", "deploymentPlan", "bricksPlan", "bricksTemplates", "proof"],
      "properties": {
        "capture": { "type": "string" }, "pageIr": { "type": "string" }, "behaviorIr": { "type": "string" },
        "assets": { "type": "string" }, "assetImportPlan": { "type": "string" }, "siteGraph": { "type": ["string", "null"] }, "frameworkProfile": { "type": "string" }, "geometry": { "type": "string" },
        "bindings": { "type": ["string", "null"] }, "deploymentPlan": { "type": ["string", "null"] }, "bricksPlan": { "type": "string" },
        "bricksTemplates": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "proof": { "type": ["string", "null"] }
      }
    },
    "compatibility": {
      "type": "object", "additionalProperties": false, "required": ["kiwe", "bricks", "wordpress", "php"],
      "properties": { "kiwe": { "type": "string" }, "bricks": { "type": "string" }, "wordpress": { "type": "string" }, "php": { "type": "string" } }
    },
    "integrity": {
      "type": "object", "additionalProperties": false, "required": ["algorithm", "files"],
      "properties": { "algorithm": { "const": "sha256" }, "files": { "type": "object", "additionalProperties": { "type": "string", "pattern": "^[a-f0-9]{64}$" } } }
    }
  }
}
