"""PropertyAccess model.""" from datetime import datetime from sqlalchemy import Column, DateTime, ForeignKey, Integer from app.db.session import Base class PropertyAccess(Base): """Tracks which users/organizations have access to private properties.""" __tablename__ = "property_access" id = Column(Integer, primary_key=True, index=True) property_id = Column(Integer, ForeignKey("properties.id"), nullable=False, index=True) user_id = Column(Integer, ForeignKey("users.id"), nullable=True, index=True) organization_id = Column(Integer, ForeignKey("organizations.id"), nullable=True, index=True) granted_by = Column(Integer, ForeignKey("users.id"), nullable=True) created_at = Column(DateTime, nullable=False, default=datetime.utcnow)