from pydantic import BaseModel, Field
from typing import Optional, TypeVar
from datetime import datetime
T = TypeVar('T')

class RobotStatusRequest(BaseModel):
    columnName: str
    battery: Optional[int] = None
    batteryCondition: Optional[str] = None
    drive_status: Optional[str] = None
    collect_date: Optional[str] = Field(default=None)  # Field 사용하여 명시적으로 None 허용

    class Config:
        json_encoders = {
            datetime: lambda v: v.isoformat() if v else None
        }

class RobotStatusResponse(BaseModel):
    robot_name: str
    serial_number: str
    battery: Optional[int] = None
    drive_status: Optional[str] = None
    collect_date: Optional[str] = None

class OccurredEventRequest(BaseModel): # None None None 으로 호출 
    '''
    Occurred Event Request Schema
    '''
    robotSerial : Optional[str] = None
    fixed : Optional[bool] = None
    company_id : Optional[str] = None

class OccurredEventResponse(BaseModel):
    '''
    Occurred Event Response Schema
    '''
    robot_name : Optional[str] = None
    serial_number : Optional[str] = None
    occurredDate : Optional[str] = None
    company_id : Optional[str] = None
    eventCode : Optional[str] = None