{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dubaioftomorrow.com/schema/anchored-record.v2.schema.json",
  "title": "Anchored Record Format v2",
  "description": "Current public record view. Proof chains remain historical snapshots; current factual admission is bound per claim.",
  "type": "object",
  "required": ["format", "publication", "domain", "generatedAt", "records"],
  "properties": {
    "format": { "const": "anchored-record/v2" },
    "publication": { "type": "string" },
    "domain": { "type": "string" },
    "schema": { "type": "string", "format": "uri" },
    "protocol": { "type": "string", "format": "uri" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "license": { "type": "object" },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "routeAliases", "publicationKind", "no", "publicationDate", "personId", "founder", "company", "verified", "verification", "profile", "proof"],
        "properties": {
          "id": { "type": "string", "format": "uri" },
          "routeAliases": { "type": "array", "items": { "type": "string", "format": "uri" } },
          "publicationKind": { "enum": ["card-record", "cardless-chronicle"] },
          "no": { "type": ["integer", "null"], "minimum": 1 },
          "series": { "type": ["string", "null"], "pattern": "^[0-9]{4}$" },
          "publicationDate": { "type": ["string", "null"], "format": "date" },
          "personId": { "type": ["string", "null"] },
          "founder": { "type": ["string", "null"] },
          "companyId": { "type": ["string", "null"] },
          "company": { "type": ["string", "null"] },
          "category": { "type": ["string", "null"] },
          "founded": { "type": ["string", "null"] },
          "raised": { "type": ["string", "null"] },
          "backers": { "type": ["string", "null"] },
          "moves": { "type": "array", "items": { "type": "string" }, "maxItems": 4 },
          "verified": { "type": ["string", "null"], "format": "date", "description": "Retired record-wide field. Null because partial claim checks do not certify the whole record." },
          "verification": {
            "type": "object",
            "required": ["state", "admittedClaimCount", "claims"],
            "properties": {
              "state": { "enum": ["pending-evidence", "claims-admitted"] },
              "admittedClaimCount": { "type": "integer", "minimum": 0 },
              "claims": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": ["claimId", "predicate", "object", "asOf", "checkedAt", "replayedAt", "receipts"],
                  "properties": {
                    "claimId": { "type": "string" },
                    "predicate": { "type": "string" },
                    "object": { "type": "object" },
                    "asOf": { "type": ["string", "null"], "format": "date" },
                    "checkedAt": { "type": ["string", "null"], "format": "date" },
                    "replayedAt": { "type": ["string", "null"], "format": "date" },
                    "receipts": { "type": "array", "items": { "type": "object" } }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "profile": { "type": "string", "format": "uri" },
          "proof": {
            "anyOf": [
              { "type": "null" },
              {
                "type": "object",
                "required": ["version", "sha256", "otsStatus", "chain", "page"],
                "properties": {
                  "version": { "type": "integer", "minimum": 1 },
                  "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
                  "otsStatus": { "enum": ["bitcoin", "pending", "unstamped"] },
                  "chain": { "type": "string", "format": "uri" },
                  "ots": { "type": ["string", "null"], "format": "uri" },
                  "page": { "type": "string", "format": "uri" }
                },
                "additionalProperties": false
              }
            ]
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
