"""
Admin Activity Log Model.

Tracks admin actions for audit purposes.
"""
from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text
from sqlalchemy.orm import relationship

from app.database import Base


class AdminActivityLog(Base):
    """Model for tracking admin activities."""
    __tablename__ = "admin_activity_logs"
    
    id = Column(Integer, primary_key=True, index=True)
    admin_id = Column(Integer, ForeignKey("users.id"), nullable=False)
    action = Column(String(100), nullable=False)  # e.g., "bulk_upgrade", "user_delete", "tld_scrape"
    details = Column(Text, nullable=True)  # Additional info about the action
    created_at = Column(DateTime, default=datetime.utcnow)
    
    # Relationship
    admin = relationship("User", backref="admin_activities")

