"""Domain entity for CommentLike. This module defines the CommentLike entity that tracks which users have liked which comments. """ from dataclasses import dataclass from typing import Any from uuid import UUID from app.domain.entities.base import BaseEntity @dataclass(kw_only=True) class CommentLike(BaseEntity): """Comment like domain entity. Tracks a like on a comment by a user. Each like is uniquely identified by its entity ID. Attributes: comment_id: UUID of the liked comment. liked_by: Identifier of the user who liked. """ comment_id: UUID liked_by: str def to_dict(self) -> dict[str, Any]: """Convert entity to dictionary. Returns: Dictionary with all CommentLike attributes. """ return { "id": str(self.id), "comment_id": str(self.comment_id), "liked_by": self.liked_by, "created_at": self.created_at.isoformat(), }