{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:rognalia:note-workspace:schema:image-registry-event:1",
  "title": "note Workspace image registry event",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version", "event_type", "request_id", "payload_sha256",
    "article_id", "article_revision", "kind", "asset_revision",
    "generated_at", "reviewed_at", "saved_at", "status", "selected_title", "brief_path",
    "brief_sha256", "image_path", "image_sha256", "preview_path",
    "preview_sha256", "preview_source_sha256", "preview_width",
    "preview_height", "metadata_path", "metadata_sha256", "width",
    "height", "caption", "alt",
    "external_actions"
  ],
  "properties": {
    "schema_version": {"const": 1},
    "event_type": {"const": "image_saved"},
    "request_id": {"type": "string"},
    "payload_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "article_id": {"type": "string"},
    "article_revision": {"type": "integer", "minimum": 1},
    "kind": {"enum": ["thumbnail", "inline"]},
    "asset_revision": {"type": "integer", "minimum": 1},
    "generated_at": {"type": "string", "format": "date-time"},
    "reviewed_at": {"type": "string", "format": "date-time"},
    "saved_at": {"type": "string", "format": "date-time"},
    "status": {"const": "ready_for_draft"},
    "selected_title": {"type": "string"},
    "brief_path": {"type": "string"},
    "brief_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "image_path": {"type": "string"},
    "image_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "preview_path": {
      "oneOf": [{"type": "null"}, {"type": "string", "minLength": 1}]
    },
    "preview_sha256": {
      "oneOf": [
        {"type": "null"},
        {"type": "string", "pattern": "^[0-9a-f]{64}$"}
      ]
    },
    "preview_source_sha256": {
      "oneOf": [
        {"type": "null"},
        {"type": "string", "pattern": "^[0-9a-f]{64}$"}
      ]
    },
    "preview_width": {
      "oneOf": [{"type": "null"}, {"type": "integer", "const": 320}]
    },
    "preview_height": {
      "oneOf": [{"type": "null"}, {"type": "integer", "const": 168}]
    },
    "metadata_path": {"type": "string"},
    "metadata_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "width": {"type": "integer", "minimum": 1},
    "height": {"type": "integer", "minimum": 1},
    "caption": {
      "oneOf": [
        {"type": "null"},
        {"type": "string", "minLength": 1, "maxLength": 300}
      ]
    },
    "alt": {
      "oneOf": [
        {"type": "null"},
        {"type": "string", "minLength": 1, "maxLength": 80}
      ]
    },
    "external_actions": {"const": []}
  }
}
