from typing import Any

from pydantic import BaseModel, Field


class EvaluationPointVO(BaseModel):
    id: int = Field(..., description="评查点ID")
    code: str = Field(..., description="评查点编码")
    name: str = Field(..., description="评查点名称")
    evaluation_point_groups_id: int | None = Field(None, description="二级分组ID")
    evaluation_point_groups_pid: int | None = Field(None, description="一级分组ID")
    ruleType: str = Field("", description="一级分组名称")
    groupName: str = Field("", description="二级分组名称")
    groupId: str = Field("", description="二级分组ID字符串")
    risk: str = Field("", description="风险等级")
    description: str = Field("", description="评查点描述")
    is_enabled: bool = Field(True, description="是否启用")
    document_attribute_type: str = Field("通用", description="适用属性类型")
    references_laws: dict[str, Any] = Field(default_factory=dict, description="法律依据")
    extraction_config: dict[str, Any] = Field(default_factory=dict, description="抽取配置")
    evaluation_config: dict[str, Any] = Field(default_factory=dict, description="评查配置")
    pass_message: str = Field("", description="通过提示")
    fail_message: str = Field("", description="不通过提示")
    suggestion_message: str = Field("", description="建议提示")
    suggestion_message_type: str = Field("warning", description="建议提示类型")
    post_action: str = Field("none", description="后置动作")
    action_config: str = Field("", description="动作配置")
    score: float = Field(0, description="分值")
    area: str = Field("", description="地区")
    created_at: str | None = Field(None, description="创建时间")
    updated_at: str | None = Field(None, description="更新时间")


class EvaluationPointListVO(BaseModel):
    data: list[EvaluationPointVO] = Field(default_factory=list, description="评查点列表")
    total: int = Field(0, description="总数")
    page: int = Field(1, description="页码")
    page_size: int = Field(20, description="分页大小")


class EvaluationPointDeleteVO(BaseModel):
    success: bool = Field(..., description="是否成功")
    message: str = Field(..., description="结果消息")


class AttributeTypeVO(BaseModel):
    code: str = Field(..., description="属性类型编码")
    label: str = Field(..., description="属性类型名称")


class AttributeTypeListVO(BaseModel):
    types: list[AttributeTypeVO] = Field(default_factory=list, description="属性类型列表")
