simple-ocpp-cs/app/schemas/chargepoint.py

48 lines
1.1 KiB
Python

from datetime import datetime
from decimal import Decimal
from typing import Optional
from uuid import UUID
from pydantic import BaseModel
from app.schemas.connector import Connector
from ocpp.v201.enums import ResetType, ResetStatusType
class ChargePointBase(BaseModel):
identity: str
is_active: bool
price: Decimal
class ChargePointUpdate(BaseModel):
identity: Optional[str] = None
is_active: Optional[bool] = None
price: Optional[Decimal]= None
class ChargePointCreate(ChargePointBase):
pass
class ChargePoint(ChargePointBase):
id: UUID
last_seen: datetime | None
vendor_name: str | None
model: str | None
serial_number: str | None
firmware_version: str | None
connectors: list[Connector] = []
class Config:
from_attributes = True
class ChargePointPassword(BaseModel):
password: str
class ChargePointConnectionInfo(BaseModel):
connected: bool
class ChargePointResetRequest(BaseModel):
type: ResetType
evse_id: Optional[int] = None
class ChargePointResetResponse(BaseModel):
status: ResetStatusType