{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:rognalia:note-workspace:schema:draft-saved-event:1",
  "title": "note Workspace draft saved event",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version", "event_type", "request_id", "article_id",
    "article_revision", "registration_revision", "created_at", "status",
    "registration_path", "registration_sha256", "result_path",
    "result_sha256", "draft_url", "external_actions"
  ],
  "properties": {
    "schema_version": {"const": 1},
    "event_type": {"const": "note_draft_saved"},
    "request_id": {"type": "string"},
    "article_id": {"type": "string"},
    "article_revision": {"type": "integer", "minimum": 1},
    "registration_revision": {"type": "integer", "minimum": 1},
    "created_at": {"type": "string", "format": "date-time"},
    "status": {"const": "saved_private_draft"},
    "registration_path": {"type": "string"},
    "registration_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "result_path": {"type": "string"},
    "result_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "draft_url": {
      "type": "string",
      "pattern": "^https://(?:www\\.)?note\\.com/notes/[A-Za-z0-9_-]+/edit$"
    },
    "external_actions": {"const": ["note:new_private_draft_saved"]}
  }
}
