from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel, ConfigDict

class ImageBase(BaseModel):
    imageUrl: str
    localPath: Optional[str] = None
    
    model_config = ConfigDict(from_attributes=True)

class TemperatureBase(BaseModel):
    temperature: str
    confidence: str
    createTime: datetime
    
    model_config = ConfigDict(from_attributes=True)

class EventBase(BaseModel):
    eventId: str
    tenantInfoId: Optional[str] = None
    reportEventId: Optional[str] = None
    number: Optional[str] = None
    name: Optional[str] = None
    etypeName: Optional[str] = None
    insDate: Optional[datetime] = None
    
    model_config = ConfigDict(from_attributes=True)

class EventList(EventBase):
    images: List[ImageBase] = []
    temperatures: List[TemperatureBase] = []
    
    model_config = ConfigDict(from_attributes=True)

class EventDetail(EventBase):
    eclassify: Optional[str] = None
    operationType: Optional[str] = None
    etype: Optional[str] = None
    enTypeName: Optional[str] = None
    hkTypeName: Optional[str] = None
    reportStatus: Optional[str] = None
    results: Optional[str] = None
    insDateShow: Optional[datetime] = None
    updDate: Optional[datetime] = None
    updDateShow: Optional[datetime] = None
    fileType: Optional[str] = None
    area: Optional[str] = None
    floor: Optional[str] = None
    map: Optional[str] = None
    staffId: Optional[str] = None
    targetUserId: Optional[str] = None
    position: Optional[str] = None
    actualStaffName: Optional[str] = None
    targetStaffName: Optional[str] = None
    routeName: Optional[str] = None
    phoneAddress: Optional[str] = None
    width: Optional[str] = None
    height: Optional[str] = None
    resolution: Optional[str] = None
    originX: Optional[str] = None
    originY: Optional[str] = None
    robotType: Optional[str] = None
    eventFloor: Optional[str] = None
    floorName: Optional[str] = None
    coordId: Optional[str] = None
    coord: Optional[str] = None
    coordName: Optional[str] = None
    positonName: Optional[str] = None
    processingRemark: Optional[str] = None
    carId: Optional[str] = None
    parkingSpaceType: Optional[str] = None
    parkingSpaceNumber: Optional[str] = None
    carNumber: Optional[str] = None
    eno: Optional[str] = None
    instrument: Optional[str] = None
    evideo: Optional[str] = None
    createTime: Optional[datetime] = None
    updateTime: Optional[datetime] = None
    images: List[ImageBase] = []
    temperatures: List[TemperatureBase] = []
    
    model_config = ConfigDict(from_attributes=True)

class EventUpdate(BaseModel):
    number: Optional[str] = None
    name: Optional[str] = None
    etypeName: Optional[str] = None
    area: Optional[str] = None
    position: Optional[str] = None
    processingRemark: Optional[str] = None
    
    model_config = ConfigDict(from_attributes=True)

class EventQuery(BaseModel):
    start_time: Optional[datetime] = None
    end_time: Optional[datetime] = None
    etypeName: Optional[str] = None
    area: Optional[str] = None
    skip: int = 0
    limit: int = 100
    
    model_config = ConfigDict(from_attributes=True) 
    
    
class TestEvent(BaseModel):
    eventId: str 
    number: Optional[str] = None
    name : Optional[str] = None
    imageUrl : Optional[str] = None
    localPath: Optional[str] = None
    temperature: Optional[str] = None
    confidence : Optional[str] = None
    createTime: Optional[datetime] = None
    
    model_config = ConfigDict(from_attributes=True)
    