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

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


class ProjectTrain(BaseModel):
    project_id: int = Field(..., title="None")
    train_version: str = Field(..., title="None")
    train_url: str = Field(..., title="None")
    train_data: str = Field(..., title="None")
    weights_id: int = Field(..., title="None")
    weights_name: str = Field(..., title="None")
    epochs: int = Field(..., title="None")
    patience: int = Field(..., title="None")
    best_pt: str = Field(..., title="None")
    last_pt: str = Field(..., title="None")
    user_id: int = Field(..., title="None")


class ProjectTrainSimpleOut(ProjectTrain):
    model_config = ConfigDict(from_attributes=True)

    id: int = Field(..., title="编号")
    create_datetime: DatetimeStr = Field(..., title="创建时间")
    update_datetime: DatetimeStr = Field(..., title="更新时间")
