{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.intentforce.no/wp-content/uploads/intentforce-reference/evidence-passport-0.3.schema.json",
  "title": "IntentForce Evidence Passport 0.3",
  "description": "A bounded, source-aware record of one claim, its evidence, verification, limitations and recovery path.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "passport_id",
    "title",
    "status",
    "observed_at",
    "scope",
    "claim",
    "evidence",
    "verification",
    "boundaries",
    "recovery",
    "publisher"
  ],
  "properties": {
    "schema_version": {
      "const": "intentforce-evidence-passport/0.3"
    },
    "passport_id": {
      "type": "string",
      "pattern": "^[A-Z0-9][A-Z0-9._-]{2,63}$"
    },
    "title": {
      "type": "string",
      "minLength": 3,
      "maxLength": 160
    },
    "status": {
      "enum": ["verified", "partial", "failed", "unknown"]
    },
    "observed_at": {
      "type": "string",
      "format": "date-time"
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": ["system", "change_boundary", "excluded"],
      "properties": {
        "system": {"type": "string", "minLength": 1},
        "change_boundary": {"type": "string", "minLength": 1},
        "excluded": {
          "type": "array",
          "items": {"type": "string", "minLength": 1},
          "uniqueItems": true
        }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": ["statement", "classification"],
      "properties": {
        "statement": {"type": "string", "minLength": 1},
        "classification": {"enum": ["Observed", "Inferred", "Unknown"]}
      }
    },
    "evidence": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["evidence_id", "type", "source", "observed_at"],
        "properties": {
          "evidence_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{1,63}$"},
          "type": {
            "enum": ["command_output", "file", "http_response", "test_result", "screenshot", "external_source"]
          },
          "source": {"type": "string", "minLength": 1},
          "observed_at": {"type": "string", "format": "date-time"},
          "url": {"type": "string", "format": "uri"},
          "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}
        }
      }
    },
    "verification": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["check", "result", "evidence_ids"],
        "properties": {
          "check": {"type": "string", "minLength": 1},
          "result": {"enum": ["pass", "fail", "unknown"]},
          "evidence_ids": {
            "type": "array",
            "minItems": 1,
            "items": {"type": "string", "minLength": 2},
            "uniqueItems": true
          }
        }
      }
    },
    "boundaries": {
      "type": "array",
      "minItems": 1,
      "items": {"type": "string", "minLength": 1},
      "uniqueItems": true
    },
    "recovery": {
      "type": "object",
      "additionalProperties": false,
      "required": ["available", "procedure", "verified_at"],
      "properties": {
        "available": {"type": "boolean"},
        "procedure": {"type": "string", "minLength": 1},
        "verified_at": {
          "anyOf": [
            {"type": "string", "format": "date-time"},
            {"type": "null"}
          ]
        }
      }
    },
    "publisher": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "url"],
      "properties": {
        "name": {"type": "string", "minLength": 1},
        "url": {"type": "string", "format": "uri"}
      }
    }
  }
}
