from sqlalchemy import Column, String, Text, Boolean, Float, Integer
from .base import BaseModel

class Algorithm(BaseModel):
    __tablename__ = "algorithms"
    
    name = Column(String(100), nullable=False, comment="算法名称")
    description = Column(Text, comment="算法描述")
    version = Column(String(20), nullable=False, comment="算法版本")
    model_path = Column(String(255), comment="模型文件路径")
    config_path = Column(String(255), comment="配置文件路径")
    status = Column(String(20), default="inactive", comment="算法状态: active, inactive, training")
    accuracy = Column(Float, comment="算法准确率")
    detection_classes = Column(Text, comment="检测类别，JSON格式")
    input_size = Column(String(20), comment="输入尺寸，如: 640x640")
    inference_time = Column(Float, comment="推理时间(ms)")
    is_enabled = Column(Boolean, default=True, comment="是否启用")
    creator = Column(String(50), comment="创建者")
    tags = Column(Text, comment="标签，JSON格式") 