from datetime import datetime

class Conversation:
    """1:1 conversation between matched users"""
    
    TABLE_NAME = "conversations"
    
    def __init__(self, id, user_id_1, user_id_2, created_at=None, updated_at=None):
        self.id = id
        self.user_id_1 = user_id_1
        self.user_id_2 = user_id_2
        self.created_at = created_at or datetime.utcnow()
        self.updated_at = updated_at or datetime.utcnow()
    
    def to_dict(self):
        return {
            "id": self.id,
            "user_id_1": self.user_id_1,
            "user_id_2": self.user_id_2,
            "created_at": self.created_at.isoformat() if self.created_at else None,
            "updated_at": self.updated_at.isoformat() if self.updated_at else None,
        }
