{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "urn:exploder-kit:page-record:1",
 "title": "A page record",
 "description": "One page of an intake document (studio/pages.py): where it came from, when, its image and text, and the parts it evidences.",
 "type": "object",
 "required": [
  "doc",
  "page",
  "of",
  "source",
  "stated_date",
  "fetched_at",
  "terms",
  "page_sha256",
  "image",
  "image_sha256",
  "text",
  "labels",
  "parts"
 ],
 "properties": {
  "doc": {
   "type": "string"
  },
  "page": {
   "type": "integer",
   "minimum": 1
  },
  "of": {
   "type": "integer",
   "minimum": 1
  },
  "source": {
   "type": [
    "string",
    "null"
   ]
  },
  "stated_date": {
   "oneOf": [
    {
     "const": "not stated"
    },
    {
     "type": "object",
     "required": [
      "date",
      "where"
     ]
    }
   ]
  },
  "fetched_at": {
   "type": [
    "string",
    "null"
   ]
  },
  "terms": {
   "type": "string"
  },
  "page_sha256": {
   "type": "string",
   "pattern": "^[0-9a-f]{64}$"
  },
  "image": {
   "type": "string"
  },
  "image_sha256": {
   "type": "string",
   "pattern": "^[0-9a-f]{64}$"
  },
  "w": {
   "type": "integer"
  },
  "h": {
   "type": "integer"
  },
  "text": {
   "type": "string"
  },
  "labels": {
   "type": "array",
   "items": {
    "type": "string"
   }
  },
  "parts": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "id",
     "how"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "how": {
      "type": "string"
     }
    }
   }
  }
 }
}