#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2025/04/03 10:27
# @File           : project_image.py
# @IDE            : PyCharm
# @desc           : pydantic 模型，用于数据库序列化操作

from pydantic import BaseModel, Field, ConfigDict
from core.data_types import DatetimeStr
from typing import Optional


class ProjectImage(BaseModel):
    id: Optional[int] = Field(None, description="id")
    project_id: Optional[int] = Field(..., description="项目id")
    img_type: Optional[str] = Field(None, description="图片类别")
    file_name: Optional[str] = Field(None, description="文件名称")
    create_time: DatetimeStr

    model_config = ConfigDict(from_attributes=True)


class ProjectImageOut(BaseModel):
    id: Optional[int] = Field(None, description="id")
    project_id: Optional[int] = Field(..., description="项目id")
    file_name: Optional[str] = Field(None, description="文件名称")
    create_time: DatetimeStr
    label_count: Optional[int]

    model_config = ConfigDict(from_attributes=True)


class ProjectImagePager(BaseModel):
    project_id: Optional[int] = Field(..., description="项目id")
    img_type: Optional[str] = Field(None, description="图片类别")
    pagerNum: Optional[int] = Field(None, description="当前页码")
    pagerSize: Optional[int] = Field(None, description="每页数量")
