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