{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:rognalia:note-workspace:schema:source-card-event:1",
  "title": "note Workspace source card event",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "event_id",
    "event_type",
    "request_id",
    "source_card_id",
    "revision",
    "source_log_ids",
    "kind",
    "statement_type",
    "summary",
    "exact_words",
    "topics",
    "public_scope",
    "status",
    "created_at",
    "updated_at",
    "payload_sha256"
  ],
  "properties": {
    "schema_version": {"const": 1},
    "event_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._:-]{7,127}$"},
    "event_type": {"enum": ["created", "updated"]},
    "request_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._:-]{7,127}$"},
    "source_card_id": {"type": "string", "pattern": "^src-[a-z0-9]{8,32}$"},
    "revision": {"type": "integer", "minimum": 1},
    "source_log_ids": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "uniqueItems": true,
      "items": {"type": "string", "pattern": "^log-[0-9]{8}-[a-z0-9]{8,24}$"}
    },
    "kind": {"enum": ["event", "observation", "emotion", "decision", "quote", "change", "question", "other"]},
    "statement_type": {"enum": ["fact", "experience", "inference", "unknown"]},
    "summary": {"type": "string", "minLength": 1, "maxLength": 4000},
    "exact_words": {
      "oneOf": [
        {"type": "null"},
        {"type": "string", "minLength": 1, "maxLength": 20000}
      ]
    },
    "topics": {
      "type": "array",
      "maxItems": 20,
      "uniqueItems": true,
      "items": {"type": "string", "minLength": 1, "maxLength": 4000}
    },
    "public_scope": {"enum": ["private", "confirm_before_use", "public"]},
    "status": {"enum": ["active", "archived"]},
    "created_at": {"type": "string", "format": "date-time"},
    "updated_at": {"type": "string", "format": "date-time"},
    "payload_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
  }
}
