from datetime import datetime

from pydantic import BaseModel

from src.db.models.bookshelf import Article


class ArticleResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    title: str

def to_response(article:  Article) -> ArticleResponse:
    response: ArticleResponse = ArticleResponse(
            id=article.id,
            created_date=article.created_date,
            last_modified_date=article.last_modified_date,
            version=article.version,
            title=article.title
    )
    return response
