from datetime import datetime

class Like:
    """User like/heart action on another user"""
    
    TABLE_NAME = "likes"
    
    def __init__(self, id, liker_id, liked_id, created_at=None):
        self.id = id
        self.liker_id = liker_id
        self.liked_id = liked_id
        self.created_at = created_at or datetime.utcnow()
    
    def to_dict(self):
        return {
            "id": self.id,
            "liker_id": self.liker_id,
            "liked_id": self.liked_id,
            "created_at": self.created_at.isoformat() if self.created_at else None,
        }
