{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kaldenframelabs.com/schemas/local-input-receipt-v1.schema.json",
  "title": "Local Input Receipt v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "tool",
    "version",
    "label",
    "source",
    "limits",
    "file_count",
    "total_bytes",
    "root_sha256",
    "entries",
    "boundaries"
  ],
  "properties": {
    "schema": { "const": "kaldenframe.local-input-receipt.receipt.v1" },
    "tool": { "const": "Local Input Receipt" },
    "version": { "const": "1.0.0" },
    "label": { "type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$" },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "kind"],
      "properties": {
        "name": { "type": "string" },
        "kind": { "enum": ["file", "directory"] }
      }
    },
    "limits": {
      "type": "object",
      "additionalProperties": false,
      "required": ["max_files", "max_single_file_bytes", "max_total_bytes"],
      "properties": {
        "max_files": { "type": "integer", "minimum": 1, "maximum": 100000 },
        "max_single_file_bytes": { "type": "integer", "minimum": 1, "maximum": 10000000000 },
        "max_total_bytes": { "type": "integer", "minimum": 1, "maximum": 100000000000 }
      }
    },
    "file_count": { "type": "integer", "minimum": 0 },
    "total_bytes": { "type": "integer", "minimum": 0 },
    "root_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path", "bytes", "sha256"],
        "properties": {
          "path": { "type": "string", "minLength": 1 },
          "bytes": { "type": "integer", "minimum": 0 },
          "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
        }
      }
    },
    "boundaries": {
      "type": "object",
      "additionalProperties": { "type": "boolean" }
    }
  }
}
