from datetime import datetime
from typing import Optional

from sqlmodel import SQLModel, Field


class FrameAnalysisResultBase(SQLModel):
    device_id: int
    frame_id: int
    algo_model_id: int
    object_class_id: int
    object_class_name: str
    confidence: float
    location: str
    time: datetime = Field(default_factory=datetime.now)


class FrameAnalysisResult(FrameAnalysisResultBase, table = True):
    __tablename__ = 'frame_analysis_result'
    id: Optional[int] = Field(default=None, primary_key=True)


class FrameAnalysisResultCreate(FrameAnalysisResultBase):
    pass


class FrameAnalysisResultInfo(FrameAnalysisResultBase):
    id: int
