# [DEF:backend.src.models.config:Module]
#
# @TIER: STANDARD
# @SEMANTICS: database, config, settings, sqlalchemy
# @PURPOSE:   Defines database schema for persisted application configuration.
# @LAYER:     Domain
# @RELATION:  DEPENDS_ON -> sqlalchemy

from sqlalchemy import Column, String, DateTime, JSON
from sqlalchemy.sql import func

from .mapping import Base


# [DEF:AppConfigRecord:Class]
# @PURPOSE: Stores the single source of truth for application configuration.
class AppConfigRecord(Base):
    __tablename__ = "app_configurations"

    id = Column(String, primary_key=True)
    payload = Column(JSON, nullable=False)
    updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())


# [/DEF:AppConfigRecord:Class]
# [/DEF:backend.src.models.config:Module]
