from typing import Optional
from datetime import datetime
from sqlmodel import Field, SQLModel
# 定义DeviceConfig模型类

class DeviceConfig(SQLModel, table=True):
    __tablename__ = "device_config"
    id: Optional[int] = Field(default=None, primary_key=True)
    tab_id: Optional[int] = Field(default=None, index=True, max_length=11)
    action_name: Optional[str] = Field(
        default=None, index=True, max_length=128, description="动作名称"
    )
    is_system: Optional[bool] = Field(default=False,description="是否是系统配置")
    action_status: Optional[bool] = Field(default=True,description="是否启用;true或者false")
    action_index: Optional[int] = Field(default=999,description="排序,默认999")
    camera_height: Optional[int] = Field(default=None, description="相机高度;步长1；最小0；最大400")
    camera_angle: Optional[float] = Field(default=None, description="相机倾角;步长0.1，最小-40；最大40")
    number_focus: Optional[int] = Field(default=None, description="对焦次数;最小0；最大1")
    take_picture: Optional[bool] = Field(default=False, description="是否拍照")
    turntable_position: Optional[float] = Field(default=None, description="转盘位置;步长1，最小0；最大800")
    turntable_angle: Optional[float] = Field(default=None, description="转盘角度;步长1；最小-720；最大720")
    shoe_upturn: Optional[bool] = Field(default=None, description="鞋子翻转;")
    pre_delay: Optional[float] = Field(default=None, description="拍照前延迟;步长1；最小0；最大99")
    after_delay: Optional[float] = Field(
        default=None, description="拍照后延迟;步长1；最小0；最大99"
    )
    led_switch: Optional[bool] = Field(default=False, description="Led灯光开关;")
    is_wait: Optional[bool] = Field(default=False, description="没用;")
    is_need_confirm: Optional[bool] = Field(default=False, description="没用;")
    update_time: Optional[datetime] = Field(default=None)
    create_time: Optional[datetime] = Field(default_factory=datetime.utcnow)
    delete_time: Optional[datetime] = Field(default=None)
