Oliver Traber
f48a9d71ef
All checks were successful
ci/woodpecker/push/docker Pipeline was successful
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
from datetime import datetime
|
|
from decimal import Decimal
|
|
import enum
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
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 RemoteTransactionStartStopStatus(enum.Enum):
|
|
ACCEPTED = "Accepted"
|
|
REJECTED = "Rejected"
|
|
|
|
class Transaction(BaseModel):
|
|
id: str
|
|
status: TransactionStatus
|
|
started_at: datetime
|
|
ended_at: Optional[datetime] = None
|
|
meter_start: Decimal
|
|
meter_end: Optional[Decimal] = None
|
|
end_reason: Optional[TransactionEventTriggerReason] = None
|
|
price: Decimal
|
|
user_id: Optional[UUID] = None
|
|
chargepoint_id: UUID
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class RemoteTransactionStartStopResponse(BaseModel):
|
|
status: RemoteTransactionStartStopStatus
|