from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import String, Integer

from db.db_base import BaseModel


class ProjectTrain(BaseModel):
    """
    项目训练版本信息表
    """
    __tablename__ = "project_train"
    __table_args__ = ({'comment': '项目训练版本信息表'})

    project_id: Mapped[int] = mapped_column(Integer, nullable=False)
    train_version: Mapped[str] = mapped_column(String(32), nullable=False)
    train_url: Mapped[str] = mapped_column(String(255), nullable=False)
    train_data: Mapped[str] = mapped_column(String(255), nullable=False)
    weights_id: Mapped[int] = mapped_column(Integer)
    weights_name: Mapped[str] = mapped_column(String(32))
    epochs: Mapped[int] = mapped_column(Integer)
    patience: Mapped[int] = mapped_column(Integer)
    best_pt: Mapped[str] = mapped_column(String(255), nullable=False)
    last_pt: Mapped[str] = mapped_column(String(255), nullable=False)
    user_id: Mapped[int] = mapped_column(Integer, nullable=False)
