"""规则分组 DTO。"""

from pydantic import BaseModel, Field


class RuleGroupCreateDTO(BaseModel):
    """创建规则分组。"""

    name: str = Field(..., description="分组名称")
    code: str = Field(..., description="分组编码")
    pid: int | None = Field(None, description="父分组ID，空或0表示一级分组")
    description: str | None = Field(None, description="分组描述")
    documentTypeId: int | None = Field(None, description="关联文档类型ID，仅二级分组使用")
    isEnabled: bool = Field(True, description="是否启用")
    sortOrder: int = Field(0, description="排序")


class RuleGroupUpdateDTO(BaseModel):
    """更新规则分组。"""

    name: str | None = Field(None, description="分组名称")
    code: str | None = Field(None, description="分组编码")
    description: str | None = Field(None, description="分组描述")
    documentTypeId: int | None = Field(None, description="关联文档类型ID")
    isEnabled: bool | None = Field(None, description="是否启用")
    sortOrder: int | None = Field(None, description="排序")


class RuleGroupBindingCreateDTO(BaseModel):
    """创建规则组绑定。"""

    ruleSetId: int = Field(..., description="规则集ID")
    priority: int = Field(0, description="优先级")
    isActive: bool = Field(True, description="是否启用")
    note: str | None = Field(None, description="备注")


class RuleGroupBindingUpdateDTO(BaseModel):
    """更新规则组绑定。"""

    priority: int | None = Field(None, description="优先级")
    isActive: bool | None = Field(None, description="是否启用")
    note: str | None = Field(None, description="备注")
