{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://c-app.uk/schemas/capp.local-model.v1.schema.json",
  "title": "Shared local model descriptor (data catalogue, not execution authority)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "protocol",
    "id",
    "label",
    "kind",
    "format",
    "files"
  ],
  "properties": {
    "protocol": {
      "const": "capp.local-model.v1"
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "label": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "kind": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{0,63}$",
      "description": "Open classification; llm, tts, asr, embedding and vision are conventional values."
    },
    "format": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{0,63}$"
    },
    "engine": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "files": {
      "type": "array",
      "minItems": 1,
      "maxItems": 4096,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "bytes",
          "sha256"
        ],
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Relative file beneath this descriptor; no traversal, symlinks, reparse points or Windows reserved path components."
          },
          "bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      }
    },
    "source": {
      "type": "object",
      "description": "Data provenance only; never permission to download or execute.",
      "additionalProperties": true
    },
    "extensions": {
      "type": "object",
      "additionalProperties": true,
      "description": "Optional namespaced metadata for future readers."
    }
  }
}
