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

45 lines
1.3 KiB
Python
Raw Normal View History

2024-03-28 21:23:25 +01:00
from datetime import datetime
import enum
2024-04-13 22:43:03 +02:00
from uuid import UUID
2024-03-28 21:23:25 +01:00
from pydantic import BaseModel
class TransactionStatus(enum.Enum):
ONGOING = "ongoing"
ENDED = "ended"
class TransactionEventTriggerReason(enum.Enum):
AUTHORIZED = "Authorized"
CABLE_PLUGGED_IN = "CablePluggedIn"
CHARGING_RATE_CHANGED = "ChargingRateChanged"
CHARGING_STATE_CHANGED = "ChargingStateChanged"
DEAUTHORIZED = "Deauthorized"
ENERGY_LIMIT_REACHED = "EnergyLimitReached"
EV_COMMUNICATION_LOST = "EVCommunicationLost"
EV_CONNECT_TIMEOUT = "EVConnectTimeout"
METER_VALUE_CLOCK = "MeterValueClock"
METER_VALUE_PERIODIC = "MeterValuePeriodic"
TIME_LIMIT_REACHED = "TimeLimitReached"
TRIGGER = "Trigger"
UNLOCK_COMMAND = "UnlockCommand"
STOP_AUTHORIZED = "StopAuthorized"
EV_DEPARTED = "EVDeparted"
EV_DETECTED = "EVDetected"
REMOTE_STOP = "RemoteStop"
REMOTE_START = "RemoteStart"
ABNORMAL_CONDITION = "AbnormalCondition"
SIGNED_DATA_RECEIVED = "SignedDataReceived"
RESET_COMMAND = "ResetCommand"
class Transaction(BaseModel):
2024-04-13 22:43:03 +02:00
id: UUID
2024-03-28 21:23:25 +01:00
status: TransactionStatus
started_at: datetime
ended_at: datetime
meter_start: float
meter_end: float
end_reason: TransactionEventTriggerReason
connector_id: str
id_token_id: str
class Config:
from_attributes = True