{
  "$defs": {
    "AnchorOperation": {
      "description": "Registry mutation represented by an anchor intent.",
      "enum": [
        "create",
        "update",
        "revoke",
        "transfer",
        "attest"
      ],
      "type": "string"
    },
    "AnchorOutboxState": {
      "description": "Durable outbox state, including the internal worker-lease transition.",
      "enum": [
        "pending",
        "claimed",
        "submitted",
        "confirmed",
        "failed",
        "abandoned"
      ],
      "type": "string"
    },
    "AnchorReceiptRecord": {
      "description": "One immutable observation returned by an anchor adapter.",
      "properties": {
        "blockHeight": {
          "description": "Optional finalized ledger height.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "observedAt": {
          "description": "Time the adapter observed this state.",
          "format": "date-time",
          "type": "string"
        },
        "proof": {
          "description": "Optional provider-neutral proof document."
        },
        "receiptKey": {
          "description": "Adapter-defined idempotency key for this observation.",
          "type": "string"
        },
        "state": {
          "$ref": "#/$defs/AnchorReceiptState",
          "description": "Submitted or confirmed state represented by this receipt."
        },
        "transactionId": {
          "description": "Provider-neutral external transaction or operation identifier.",
          "type": "string"
        }
      },
      "required": [
        "receiptKey",
        "transactionId",
        "state",
        "observedAt"
      ],
      "type": "object"
    },
    "AnchorReceiptState": {
      "description": "State represented by an immutable adapter receipt.",
      "enum": [
        "submitted",
        "confirmed"
      ],
      "type": "string"
    }
  },
  "$id": "urn:mars:schema:v1:anchor-status-record",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Persisted status of one durable anchor intent.",
  "properties": {
    "attempts": {
      "format": "uint32",
      "minimum": 0,
      "type": "integer"
    },
    "availableAt": {
      "format": "date-time",
      "type": "string"
    },
    "createdAt": {
      "format": "date-time",
      "type": "string"
    },
    "entryDid": {
      "type": "string"
    },
    "intentId": {
      "type": "string"
    },
    "operation": {
      "$ref": "#/$defs/AnchorOperation"
    },
    "receipts": {
      "items": {
        "$ref": "#/$defs/AnchorReceiptRecord"
      },
      "type": "array"
    },
    "sequence": {
      "format": "uint64",
      "minimum": 0,
      "type": "integer"
    },
    "state": {
      "$ref": "#/$defs/AnchorOutboxState"
    },
    "transactionId": {
      "type": [
        "string",
        "null"
      ]
    },
    "updatedAt": {
      "format": "date-time",
      "type": "string"
    }
  },
  "required": [
    "intentId",
    "entryDid",
    "sequence",
    "operation",
    "state",
    "attempts",
    "availableAt",
    "createdAt",
    "updatedAt"
  ],
  "title": "AnchorStatusRecord",
  "type": "object"
}
