{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://clavenar.com/schemas/ledger-verify.schema.json",
  "title": "Clavenar Ledger Verify Response",
  "oneOf": [
    {
      "title": "ValidChain",
      "type": "object",
      "required": ["valid", "entries_checked", "head_hash"],
      "additionalProperties": true,
      "properties": {
        "valid": { "const": true },
        "entries_checked": { "type": "integer", "minimum": 0 },
        "head_hash": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8,128}$"
        }
      }
    },
    {
      "title": "BrokenChain",
      "type": "object",
      "required": ["valid", "broken_at", "expected_hash", "actual_hash"],
      "additionalProperties": true,
      "properties": {
        "valid": { "const": false },
        "broken_at": { "type": "integer", "minimum": 0 },
        "expected_hash": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8,128}$"
        },
        "actual_hash": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8,128}$"
        }
      }
    }
  ]
}
