from datetime import datetime

class Photo:
    """User profile photo"""
    
    TABLE_NAME = "photos"
    
    def __init__(self, id, profile_id, file_path, display_order, created_at=None):
        self.id = id
        self.profile_id = profile_id
        self.file_path = file_path
        self.display_order = display_order
        self.created_at = created_at or datetime.utcnow()
    
    def to_dict(self):
        return {
            "id": self.id,
            "profile_id": self.profile_id,
            "file_path": self.file_path,
            "display_order": self.display_order,
            "created_at": self.created_at.isoformat() if self.created_at else None,
        }
