"""Notification model.""" from datetime import datetime from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String, Text from sqlalchemy.orm import relationship from app.db.session import Base class Notification(Base): """Notification model for in-app notifications.""" __tablename__ = "notifications" id = Column(Integer, primary_key=True, index=True) user_id = Column(Integer, ForeignKey("users.id"), nullable=False) type = Column(String(50), nullable=False) # booking_created, booking_approved, etc title = Column(String(200), nullable=False) message = Column(Text, nullable=False) booking_id = Column(Integer, ForeignKey("bookings.id"), nullable=True) is_read = Column(Boolean, default=False, nullable=False) created_at = Column(DateTime, default=datetime.utcnow, nullable=False) # Relationships user = relationship("User", back_populates="notifications") booking = relationship("Booking", back_populates="notifications")