"""首页入口 VO。"""

from pydantic import BaseModel, Field


class HomeEntryAreaVO(BaseModel):
    """入口模块地区配置。"""

    area: str = Field(..., description="地区名称")
    enabled: bool = Field(..., description="是否启用")
    sortOrder: int = Field(0, description="地区内排序")


class HomeEntryDocumentTypeVO(BaseModel):
    """入口模块下的文档类型。"""

    id: int = Field(..., description="文档类型ID")
    name: str = Field(..., description="文档类型名称")
    code: str | None = Field(None, description="文档类型编码")


class HomeEntryModuleVO(BaseModel):
    """首页入口模块。"""

    id: int = Field(..., description="入口模块ID")
    name: str = Field(..., description="模块名称")
    description: str | None = Field(None, description="模块描述")
    targetPath: str | None = Field(None, description="点击后跳转路径")
    routePath: str | None = Field(None, description="用于 RBAC 校验的页面路径")
    iconPath: str | None = Field(None, description="模块图标路径")
    sortOrder: int = Field(0, description="排序序号")
    requiresDocumentTypes: bool = Field(True, description="是否要求至少绑定一个文档类型")
    areas: list[HomeEntryAreaVO] = Field(default_factory=list, description="地区配置")
    documentTypes: list[HomeEntryDocumentTypeVO] = Field(default_factory=list, description="关联文档类型列表")
