from pydantic import BaseModel, Field
from typing import Optional


class ProjectTypeIn(BaseModel):
    """
    项目类型输入
    """
    type_code: Optional[str] = Field(..., description="类型code", max_length=20)
    type_name: Optional[str] = Field(..., description="类型名称", max_length=20, min_length=4)
    icon_path: Optional[str] = Field(None, description="iconPath", max_length=255)
    description: Optional[str] = Field(None, description="类型描述", max_length=255)


class ProjectTypeOut(BaseModel):
    """
    项目类型输出
    """
    id: Optional[int] = Field(..., description="id")
    type_code: Optional[str] = Field(..., description="类型code", max_length=20)
    type_name: Optional[str] = Field(..., description="类型名称", max_length=20, min_length=4)
    icon_path: Optional[str] = Field(None, description="iconPath", max_length=255)
    description: Optional[str] = Field(None, description="类型描述", max_length=255)

    class Config:
        orm_mode = True
