from sqlmodel import SQLModel, Field
from datetime import datetime
from typing import Optional
import pytz

TIME_ZONE = pytz.timezone("Asia/Shanghai")
class PhotoRecord(SQLModel, table=True):
    __tablename__ = "photo_record"
    id: Optional[int] = Field(default=None, primary_key=True, index=True)
    action_id: Optional[int] = Field(default=None)
    goods_art_no: Optional[str] = Field(max_length=128, nullable=False)
    image_path: Optional[str] = Field(default=None)
    image_index: Optional[int] = Field(default=None)
    image_deal_mode: Optional[int] = Field(default=None)
    photo_create_time: Optional[datetime] = Field(default=None)
    update_time: Optional[datetime] = Field(
        default_factory=lambda: datetime.now(TIME_ZONE)
    )
    create_time: Optional[datetime] = Field(default_factory=lambda: datetime.now(TIME_ZONE))
    delete_time: Optional[datetime] = Field(default=None)
