from typing import Optional from pydantic import Field from domain.dtos.base_dto import DtoBase class SysRoleBaseDto(DtoBase): role_name: str = Field(..., title="角色名称", max_length=30) role_code: str = Field(..., title="角色编码", max_length=60) status: int = Field(0, title="状态", ge=0, le=1) remark: Optional[str] = Field(None, title="备注", max_length=500) class Config: from_attributes = True class SysRoleDto(SysRoleBaseDto): id: int = Field(..., title="角色ID", gt=0) class SysRoleCreateDto(SysRoleBaseDto): role_name: str = Field(..., title="角色名称", max_length=30) role_code: str = Field(..., title="角色编码", max_length=60) class SysRoleUpdateDto(SysRoleBaseDto): id: int = Field(..., title="角色ID", gt=0) role_name: str = Field(..., title="角色名称", max_length=30)