{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://western-astrology.protocol.top/schema/western-chart-archive-1.0.0.json",
  "title": "Western Chart Archive",
  "description": "W\u26055 Centennial Archive - a self-describing, verifiable export of a Western natal chart and its deterministic lead diagnosis. Integrity is provable by recomputing the chart from `input` under the stamped engine + ephemeris version and comparing hashes.",
  "type": "object",
  "required": ["schema", "schemaVersion", "stamp", "input", "chart", "diagnosis", "exportedAt"],
  "additionalProperties": false,
  "properties": {
    "schema": {
      "const": "protocol.western-astrology.chart-archive",
      "description": "Stable format identifier."
    },
    "schemaVersion": {
      "type": "string",
      "description": "Semantic version of this archive format (e.g. 1.0.0)."
    },
    "stamp": {
      "type": "object",
      "description": "Reproducibility stamp. inputHash and outputHash are sha256 hex digests over canonical JSON.",
      "required": ["schemaVersion", "algorithm", "provenance", "inputHash", "outputHash"],
      "additionalProperties": false,
      "properties": {
        "schemaVersion": { "type": "string" },
        "algorithm": { "const": "sha256" },
        "provenance": {
          "type": "object",
          "required": [
            "schemaVersion",
            "algorithm",
            "engineVersion",
            "ephemeris",
            "ephemerisVersion",
            "chiron",
            "readingFormatVersion"
          ],
          "additionalProperties": false,
          "properties": {
            "schemaVersion": { "type": "string" },
            "algorithm": { "const": "sha256" },
            "engineVersion": {
              "type": "string",
              "description": "@protocol/engine-suku Western natal engine version."
            },
            "ephemeris": { "const": "astronomy-engine" },
            "ephemerisVersion": {
              "type": "string",
              "description": "Pinned astronomy-engine npm version."
            },
            "chiron": {
              "type": "object",
              "required": ["source", "epoch", "stepDays"],
              "additionalProperties": false,
              "properties": {
                "source": { "type": "string" },
                "epoch": { "type": "string" },
                "stepDays": { "type": "number" }
              }
            },
            "readingFormatVersion": {
              "type": "string",
              "description": "App-owned version of the deterministic reading semantics."
            }
          }
        },
        "inputHash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
        "outputHash": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
      }
    },
    "input": {
      "type": "object",
      "description": "Canonical, reproducible birth input. The UTC instant + place + requested house system fully determine the chart.",
      "required": ["datetimeUtc", "latitude", "longitude", "houseSystem"],
      "additionalProperties": false,
      "properties": {
        "datetimeUtc": { "type": "string", "format": "date-time" },
        "latitude": { "type": "number", "minimum": -90, "maximum": 90 },
        "longitude": { "type": "number", "minimum": -180, "maximum": 180 },
        "houseSystem": {
          "type": "string",
          "enum": ["whole_sign", "equal", "alcabitius", "placidus"]
        }
      }
    },
    "display": {
      "type": "object",
      "description": "Informational only - NOT part of any hash.",
      "additionalProperties": false,
      "properties": {
        "placeName": { "type": "string" },
        "localDate": { "type": "string" },
        "localTime": { "type": "string" },
        "timezone": { "type": "string" }
      }
    },
    "chart": {
      "description": "Rounded, volatile-redacted natal chart snapshot (engine output)."
    },
    "diagnosis": {
      "description": "Rounded, language-neutral deterministic lead diagnosis."
    },
    "exportedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Envelope timestamp - NOT part of any hash."
    }
  }
}
