from pydantic import BaseModel, Field
from typing import List, Optional

class MarkdownNode(BaseModel):
    level: int = Field(default=0, description="节点层级")
    title: str = Field(default="Root", description="节点标题")
    content: Optional[str] = Field(default=None, description="节点内容")
    children: List['MarkdownNode'] = Field(default_factory=list, description="子节点列表")

    class Config:
        arbitrary_types_allowed = True

MarkdownNode.model_rebuild()
