from typing import Optional

from sqlmodel import SQLModel, Field

from entity.base import TimestampMixin


class SceneBase(SQLModel):
    name: str
    version: str
    handle_task: str
    remark: Optional[str] = None


class Scene(SceneBase, TimestampMixin, table=True):
    __tablename__ = "scene"  # 显式指定表名

    id: Optional[int] = Field(default=None, primary_key=True)


class SceneCreate(SceneBase):
    handle_task: Optional[str] = None


class SceneUpdate(SceneBase):
    id: int
    name: Optional[str] = None
    version: Optional[str] = None
    handle_task: Optional[str] = None


class SceneInfo(SceneBase, TimestampMixin):
    id: int
    usage_status: Optional[str] = None
