from datetime import datetime

from pydantic import BaseModel

from src.db.models.bookshelf import Author


class AuthorResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    first_name: str
    last_name: str

def to_response(author:  Author) -> AuthorResponse:
    response: AuthorResponse = AuthorResponse(
            id=author.id,
            created_date=author.created_date,
            last_modified_date=author.last_modified_date,
            version=author.version,
            first_name=author.first_name,
            last_name=author.last_name
    )
    return response
