simple-ocpp-cs/app/models/chargepoint_variable.py

29 lines
1.2 KiB
Python
Raw Permalink Normal View History

2024-04-20 02:36:46 +02:00
from dataclasses import dataclass
import uuid
from sqlalchemy import ForeignKey, Integer, Numeric, Uuid, Boolean, Column, String, Enum
from app.database import Base
from app.schemas.chargepoint_variable import AttributeType, MutabilityType, DataType
@dataclass
class ChargepointVariable(Base):
__tablename__ = "chargepoint_variables"
id = Column(Uuid, primary_key=True, default=uuid.uuid4)
name = Column(String)
type = Column(Enum(AttributeType), default=AttributeType.ACTUAL)
value = Column(String, nullable=True)
mutability = Column(Enum(MutabilityType), default=MutabilityType.READ_WRITE)
persistent = Column(Boolean, default=False)
constant = Column(Boolean, default=False)
unit = Column(String, nullable=True)
data_type = Column(Enum(DataType), nullable=True)
min_limit = Column(Numeric, nullable=True)
max_limit = Column(Numeric, nullable=True)
values_list = Column(String, nullable=True)
component_name = Column(String)
component_instance = Column(String, nullable=True)
evse = Column(Integer, nullable=True)
connector_id = Column(Integer, nullable=True)
chargepoint_id = Column(Uuid, ForeignKey("chargepoints.id"), index=True)