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

48 lines
1.1 KiB
Python
Raw Normal View History

2024-04-13 22:43:03 +02:00
from datetime import datetime
2024-04-19 00:08:29 +02:00
from decimal import Decimal
2024-04-13 22:43:03 +02:00
from typing import Optional
from uuid import UUID
from pydantic import BaseModel
from app.schemas.connector import Connector
2024-04-14 22:56:51 +02:00
from ocpp.v201.enums import ResetType, ResetStatusType
2024-04-13 22:43:03 +02:00
class ChargePointBase(BaseModel):
2024-04-19 00:08:29 +02:00
identity: str
2024-04-13 22:43:03 +02:00
is_active: bool
2024-04-19 00:08:29 +02:00
price: Decimal
2024-04-13 22:43:03 +02:00
class ChargePointUpdate(BaseModel):
2024-04-19 00:08:29 +02:00
identity: Optional[str] = None
2024-04-13 22:43:03 +02:00
is_active: Optional[bool] = None
2024-04-19 00:08:29 +02:00
price: Optional[Decimal]= None
2024-04-13 22:43:03 +02:00
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
2024-04-13 22:43:03 +02:00
connectors: list[Connector] = []
class Config:
from_attributes = True
class ChargePointPassword(BaseModel):
password: str
class ChargePointConnectionInfo(BaseModel):
connected: bool
2024-04-14 22:56:51 +02:00
class ChargePointResetRequest(BaseModel):
type: ResetType
evse_id: Optional[int] = None
class ChargePointResetResponse(BaseModel):
status: ResetStatusType