"""入口模块管理 VO。"""

from pydantic import BaseModel, Field


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

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


class EntryModuleVO(BaseModel):
    """入口模块详情。"""

    id: int = Field(..., description="入口模块ID")
    name: str = Field(..., description="模块名称")
    description: str | None = Field(None, description="模块描述")
    path: str | None = Field(None, description="图标路径")
    route_path: str | None = Field(None, description="前端跳转路径")
    sort_order: int = Field(0, description="排序")
    is_enabled: bool = Field(True, description="是否启用")
    areas: list[EntryModuleAreaVO] = Field(default_factory=list, description="地区配置")
    created_at: str | None = Field(None, description="创建时间")
    updated_at: str | None = Field(None, description="更新时间")


class EntryModuleListVO(BaseModel):
    """入口模块列表分页。"""

    total: int = Field(0, description="总数")
    page: int = Field(1, description="页码")
    page_size: int = Field(10, description="分页大小")
    items: list[EntryModuleVO] = Field(default_factory=list, description="入口模块列表")


class EntryModuleImageUploadVO(BaseModel):
    """入口模块图片上传结果。"""

    module_id: int = Field(..., description="模块ID")
    path: str = Field(..., description="对象路径")
    url: str = Field(..., description="访问地址")
    message: str = Field(..., description="结果消息")
