{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "Artifact": {
      "properties": {
        "bytes": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "type": "object",
      "required": [
        "bytes",
        "type"
      ],
      "description": "Artifact is exact retained content with a selected interpretation: the hash of the bytes and the hash of the interpretation descriptor the bytes are read under (order 0002 D4)."
    },
    "Attempt": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "release": {
          "$ref": "#/$defs/EntryRef"
        },
        "request": {
          "type": "string"
        },
        "publisher": {
          "type": "string"
        },
        "request_id": {
          "type": "string"
        },
        "request_digest": {
          "type": "string"
        },
        "accepted_at": {
          "type": "string"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "release",
        "request",
        "publisher",
        "request_id",
        "request_digest",
        "accepted_at"
      ],
      "description": "Attempt is one admitted application's attempt fact: the release occurrence that ran, the retained normalized request by hash, and Dawn's admission provenance for the attempt."
    },
    "Batch": {
      "properties": {
        "first": {
          "type": "integer"
        },
        "last": {
          "type": "integer"
        }
      },
      "type": "object",
      "required": [
        "first",
        "last"
      ],
      "description": "Batch is the committed batch an entry belongs to."
    },
    "Bound": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "application": {
          "$ref": "#/$defs/EntryRef"
        },
        "role": {
          "type": "string"
        },
        "bound": {
          "$ref": "#/$defs/EntryRef"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "application",
        "role",
        "bound"
      ],
      "description": "Bound is one input role of the application named by application, bound to one occurrence."
    },
    "Child": {
      "properties": {
        "key": {
          "type": "string"
        },
        "space": {
          "$ref": "#/$defs/Space"
        },
        "created_at": {
          "$ref": "#/$defs/EntryRef"
        }
      },
      "type": "object",
      "required": [
        "key",
        "space",
        "created_at"
      ],
      "description": "Child is one child of a space at the parent's selected cutoff, with the creation entry that recorded it: Journal's own child observation."
    },
    "Declaration": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "assertion_id": {
          "type": "string"
        },
        "envelope": {
          "type": "string"
        },
        "artifact": {
          "$ref": "#/$defs/Artifact"
        },
        "subject": {
          "type": "string"
        },
        "publisher": {
          "type": "string"
        },
        "application": {
          "oneOf": [
            {
              "$ref": "#/$defs/EntryRef"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "entry",
        "assertion_id",
        "envelope",
        "artifact",
        "publisher"
      ],
      "description": "Declaration is one admitted declaration occurrence: the fact in an artifact's declarations journal."
    },
    "Entry": {
      "properties": {
        "ref": {
          "$ref": "#/$defs/EntryRef"
        },
        "origin": {
          "type": "string"
        },
        "batch": {
          "$ref": "#/$defs/Batch"
        },
        "fact": {
          "type": "string",
          "contentEncoding": "base64"
        },
        "content": {
          "oneOf": [
            {
              "$ref": "#/$defs/Artifact"
            },
            {
              "type": "null"
            }
          ]
        },
        "declaration": {
          "oneOf": [
            {
              "$ref": "#/$defs/Declaration"
            },
            {
              "type": "null"
            }
          ]
        },
        "record": {
          "oneOf": [
            {
              "$ref": "#/$defs/Record"
            },
            {
              "type": "null"
            }
          ]
        },
        "attempt": {
          "oneOf": [
            {
              "$ref": "#/$defs/Attempt"
            },
            {
              "type": "null"
            }
          ]
        },
        "bound": {
          "oneOf": [
            {
              "$ref": "#/$defs/Bound"
            },
            {
              "type": "null"
            }
          ]
        },
        "produced": {
          "oneOf": [
            {
              "$ref": "#/$defs/Produced"
            },
            {
              "type": "null"
            }
          ]
        },
        "result": {
          "oneOf": [
            {
              "$ref": "#/$defs/Result"
            },
            {
              "type": "null"
            }
          ]
        },
        "staged": {
          "oneOf": [
            {
              "$ref": "#/$defs/Staged"
            },
            {
              "type": "null"
            }
          ]
        },
        "justifies": {
          "oneOf": [
            {
              "$ref": "#/$defs/Justifies"
            },
            {
              "type": "null"
            }
          ]
        },
        "relation": {
          "oneOf": [
            {
              "$ref": "#/$defs/RelationFact"
            },
            {
              "type": "null"
            }
          ]
        },
        "child": {
          "oneOf": [
            {
              "$ref": "#/$defs/Child"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "ref",
        "origin",
        "batch",
        "fact"
      ],
      "description": "Entry is one occurrence in a journal as a read returns it: its reference, origin and batch, the canonical fact bytes (base64 on the wire), and the decoded Dawn fact when the predicate is one of dawn-facts-v2."
    },
    "EntryRef": {
      "properties": {
        "root_id": {
          "type": "string"
        },
        "space_id": {
          "type": "string"
        },
        "position": {
          "type": "integer"
        }
      },
      "type": "object",
      "required": [
        "root_id",
        "space_id",
        "position"
      ],
      "description": "EntryRef is the occurrence identity of one entry: a position in one journal."
    },
    "Justifies": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "assertion_id": {
          "type": "string"
        },
        "group": {
          "type": "string"
        },
        "premise": {
          "$ref": "#/$defs/EntryRef"
        },
        "method": {
          "type": "string"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "assertion_id",
        "group",
        "premise",
        "method"
      ],
      "description": "Justifies is one premise that jointly justifies an assertion: the assertion id, the group joining its premises, the premise occurrence and the method."
    },
    "Path": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "description": "Path is a location in the world: labels from a root organizer down, relative to the world."
    },
    "Produced": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "application": {
          "$ref": "#/$defs/EntryRef"
        },
        "role": {
          "type": "string"
        },
        "produced": {
          "$ref": "#/$defs/EntryRef"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "application",
        "role",
        "produced"
      ],
      "description": "Produced is one output occurrence of the application named by application."
    },
    "Record": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "profile": {
          "type": "string"
        },
        "hash": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        "publisher": {
          "type": "string"
        },
        "request_id": {
          "type": "string"
        },
        "request_digest": {
          "type": "string"
        },
        "accepted_at": {
          "type": "string"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "profile",
        "hash",
        "metadata",
        "publisher",
        "request_id",
        "request_digest",
        "accepted_at"
      ],
      "description": "Record is one admitted record occurrence: the fact Dawn appended to an individual record's leaf journal under dawn-facts-v2, with the provenance Dawn persists because Journal supplies none."
    },
    "RelationFact": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "assertion_id": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/EntryRef"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "assertion_id",
        "kind",
        "target"
      ],
      "description": "RelationFact is one relation of an assertion to another occurrence: supersedes, challenges or withdraws."
    },
    "Result": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "application": {
          "$ref": "#/$defs/EntryRef"
        },
        "outcome": {
          "type": "string"
        },
        "manifest": {
          "type": "string"
        },
        "resolution": {
          "type": "string"
        },
        "attestation": {
          "type": "string"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "application",
        "outcome",
        "manifest",
        "resolution",
        "attestation"
      ],
      "description": "Result is the seal fact of a terminal application: its outcome, the retained manifest, resolution and seal envelope by hash."
    },
    "Space": {
      "properties": {
        "root_id": {
          "type": "string"
        },
        "space_id": {
          "type": "string"
        },
        "path": {
          "$ref": "#/$defs/Path"
        }
      },
      "type": "object",
      "required": [
        "root_id",
        "space_id",
        "path"
      ],
      "description": "Space is a space's identity together with its Dawn path: the labels below the world, so a grant by path applies to it."
    },
    "Staged": {
      "properties": {
        "entry": {
          "$ref": "#/$defs/EntryRef"
        },
        "application": {
          "$ref": "#/$defs/EntryRef"
        }
      },
      "type": "object",
      "required": [
        "entry",
        "application"
      ],
      "description": "Staged is the first fact of an artifact space an application creates, before its content fact, naming the application."
    }
  },
  "properties": {
    "space": {
      "$ref": "#/$defs/Space"
    },
    "through": {
      "type": "integer"
    },
    "entries": {
      "items": {
        "$ref": "#/$defs/Entry"
      },
      "type": "array"
    },
    "scanned_through": {
      "type": "integer"
    },
    "next_after": {
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "space",
    "through",
    "entries",
    "scanned_through"
  ],
  "title": "EntriesPage",
  "description": "EntriesPage is one page of a journal's fixed prefix (after, through]."
}
