from sqlalchemy import Column, String, JSON, DateTime, Boolean
from sqlalchemy.sql import func
from app.db.base_class import Base

class SystemParameter(Base):
    __tablename__ = "system_parameters"
    __table_args__ = {"schema": "data", "extend_existing": True}

    key = Column(String, primary_key=True, index=True, nullable=False)
    value = Column(JSON, nullable=False)
    is_active = Column(Boolean, default=True)
    description = Column(String)
    updated_at = Column(DateTime(timezone=True), onupdate=func.now(), server_default=func.now())