#!/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")
    file_name: Optional[str] = Field(None, description="文件名称")
    thumb_image_url: Optional[str] = Field(None, description="图片在obs上的链接")
    create_datetime: 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="文件名称")
    thumb_image_url: Optional[str] = Field(None, description="图片在obs上的链接")
    label_count: Optional[int] = Field(0, description="图片的标注数量")
    create_datetime: DatetimeStr

    model_config = ConfigDict(from_attributes=True)
