"""
Modèles SQLAlchemy pour l'éditeur d'architecture
"""
from datetime import datetime
from sqlalchemy import Column, String, Integer, DateTime, Text

from backend.app.core.database import ArchBase


class ArchitectureNode(ArchBase):
    """Noeud d'architecture sauvegardé"""
    __tablename__ = "architecture_node"

    id = Column(String, primary_key=True, index=True)
    type = Column(String, nullable=False)
    x = Column(Integer, nullable=False, default=0)
    y = Column(Integer, nullable=False, default=0)
    width = Column(Integer, nullable=False, default=50)
    height = Column(Integer, nullable=False, default=50)
    rotation = Column(Integer, nullable=False, default=0)
    payload = Column(Text, nullable=False, default="{}")
    created_at = Column(DateTime, default=datetime.utcnow)
