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

from core.data_types import DatetimeStr

from typing import Optional
from pydantic import BaseModel, Field, ConfigDict


class ProjectDetectIn(BaseModel):
    project_id: Optional[int] = Field(..., description="项目id")
    file_type: Optional[str] = Field('img', description="推理集合文件类别")
    detect_name: Optional[str] = Field(..., description="推理集合名称")
    rtsp_url: Optional[str] = Field(None, description="视频流地址")

    model_config = ConfigDict(from_attributes=True)


class ProjectDetectPager(BaseModel):
    project_id: Optional[int] = Field(..., description="项目id")
    detect_name: Optional[str] = Field(None, description="推理集合名称")
    pagerNum: Optional[int] = Field(1, description="当前页码")
    pagerSize: Optional[int] = Field(10, description="每页数量")

    model_config = ConfigDict(from_attributes=True)


class ProjectDetectOut(BaseModel):
    id: Optional[int]
    project_id: Optional[int]
    detect_name: Optional[str]
    detect_no: Optional[str]
    detect_version: Optional[int]
    file_type: Optional[str]
    folder_url: Optional[str]
    rtsp_url: Optional[str]
    create_datetime: DatetimeStr

    model_config = ConfigDict(from_attributes=True)


class ProjectDetectList(BaseModel):
    id: Optional[int]
    file_type: Optional[str]
    detect_name: Optional[str]

    model_config = ConfigDict(from_attributes=True)