"""Domain model for the Article entity."""
from __future__ import annotations

from datetime import datetime

from repo_core.base.models import DomainModel


class Article(DomainModel):
    """Strongly-typed representation of a persisted article record.

    Usage::

        article = Article.from_db({"id": 1, "title": "Hello", "body": "..."})
        row = article.to_db()
    """

    id: int
    title: str
    body: str = ""
    published: bool = False
    created_at: datetime | None = None
    updated_at: datetime | None = None
