"""交叉评查 DTO。"""

from __future__ import annotations

from pydantic import BaseModel, Field


class CrossReviewTaskCreateDTO(BaseModel):
    """创建交叉评查任务。"""

    taskName: str = Field(..., min_length=1, description="任务名称")
    taskType: str = Field("CITY", description="任务类型")
    docTypeId: int | None = Field(None, description="文档类型ID")
    docTypeCode: str | None = Field(None, description="文档类型编码")
    memberUserIds: list[int] = Field(default_factory=list, description="参与成员用户ID")
    principalUserIds: list[int] = Field(default_factory=list, description="负责人用户ID")
    documentIds: list[int] = Field(default_factory=list, description="挂载文档ID")


class CrossReviewTaskQueryDTO(BaseModel):
    """查询当前用户交叉评查任务。"""

    page: int = Field(1, ge=1, description="页码")
    pageSize: int = Field(20, ge=1, le=100, description="每页大小")
    keyword: str | None = Field(None, description="关键字")
    status: str | None = Field(None, description="任务状态")
    taskType: str | None = Field(None, description="任务类型")
    docTypeCode: str | None = Field(None, description="文档类型编码")


class CrossReviewTaskDocumentQueryDTO(BaseModel):
    """查询任务文档。"""

    page: int = Field(1, ge=1, description="页码")
    pageSize: int = Field(20, ge=1, le=100, description="每页大小")
    keyword: str | None = Field(None, description="关键字")


class CrossReviewProposalCreateDTO(BaseModel):
    """创建交叉评查提案。"""

    reviewPointResultId: int = Field(..., description="规则结果ID")
    documentId: int = Field(..., description="文档ID")
    evaluationPointId: int | None = Field(None, description="评查点ID")
    auditOpinion: str = Field(..., min_length=1, description="提案理由")
    deductionScore: float = Field(..., description="分值调整量")


class CrossReviewProposalVoteDTO(BaseModel):
    """提案投票。"""

    voteType: str = Field(..., description="agree/disagree/cancel")
