{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sankarshanmukhopadhyay.github.io/agent-registry-protocol/schemas/historical-resolution.schema.json",
  "title": "ARPA Historical Authority Resolution",
  "description": "Deterministic point-in-time resolution result separating state at the requested time from current state, later material events, reconstruction quality, retention status, and evidence provenance.",
  "x-spec-section": "21.4.1, 28.5",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "subject",
    "requested_time",
    "evaluation_time",
    "state_at_requested_time",
    "current_state",
    "reconstruction_status",
    "selected_records",
    "later_material_events",
    "historical_effect",
    "retention",
    "evidence"
  ],
  "properties": {
    "subject": {
      "type": "string",
      "minLength": 1
    },
    "requested_time": {
      "type": "string",
      "format": "date-time"
    },
    "evaluation_time": {
      "type": "string",
      "format": "date-time"
    },
    "state_at_requested_time": {
      "$ref": "status.schema.json"
    },
    "current_state": {
      "$ref": "status.schema.json"
    },
    "reconstruction_status": {
      "enum": [
        "authoritative_complete",
        "authoritative_partial",
        "reconstructed_complete",
        "reconstructed_partial",
        "approximate",
        "indeterminate"
      ]
    },
    "selected_records": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "record_id",
          "version",
          "effective_from",
          "digest"
        ],
        "properties": {
          "record_id": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "minLength": 1
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "effective_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "digest": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "event_checkpoint": {
      "type": [
        "string",
        "null"
      ]
    },
    "later_material_events": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_type",
          "effective_at",
          "historical_effect"
        ],
        "properties": {
          "event_type": {
            "type": "string",
            "minLength": 1
          },
          "effective_at": {
            "type": "string",
            "format": "date-time"
          },
          "historical_effect": {
            "enum": [
              "none",
              "prospective",
              "retroactive",
              "governance_defined",
              "indeterminate"
            ]
          },
          "reason_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "historical_effect": {
      "enum": [
        "none",
        "prospective",
        "retroactive",
        "governance_defined",
        "indeterminate"
      ]
    },
    "retention": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "evidence_available",
        "status"
      ],
      "properties": {
        "evidence_available": {
          "type": "boolean"
        },
        "status": {
          "enum": [
            "available",
            "partial",
            "outside_retention",
            "withheld",
            "indeterminate"
          ]
        },
        "boundary": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "references",
        "integrity_status"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "integrity_status": {
          "enum": [
            "verified",
            "partial",
            "failed",
            "not_available"
          ]
        },
        "lineage_mechanism": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}
