{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://backscroll.hubersoftware.com/schemas/backscroll-message.schema.json",
  "title": "Backscroll JSONL message, version 1",
  "type": "object",
  "allOf": [{ "$ref": "#/$defs/message" }],
  "required": ["schema_version", "channel_id"],
  "properties": {
    "schema_version": { "const": 1 },
    "channel_id": { "type": "string", "pattern": "^[0-9]+$" },
    "guild_id": { "type": ["string", "null"] },
    "citation": { "type": "string", "pattern": "^discord:[0-9]+:[0-9]+$" },
    "export_partial": { "type": "boolean" },
    "export_date_range": { "type": "object" }
  },
  "$defs": {
    "message": {
      "type": "object",
      "required": ["id", "timestamp", "author", "content"],
      "properties": {
        "id": { "type": "string", "pattern": "^[0-9]+$" },
        "timestamp": { "type": "string", "format": "date-time" },
        "author": { "type": "string" },
        "author_id": { "type": "string" },
        "content": { "type": "string" },
        "edited": { "type": "string" },
        "attachments": { "type": "array", "items": { "type": "object" } },
        "embeds": { "type": "array", "items": { "type": "object" } },
        "reactions": { "type": "array", "items": { "type": "object" } },
        "reply_to": { "type": "string" },
        "reply": { "type": ["object", "null"] },
        "pinned": { "type": "boolean" },
        "type": { "type": "integer" }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
