"""
Model definitions for ComicWork.
"""

from datetime import datetime

from pydantic import BaseModel

from src.db.models.comic import ComicWork


class ComicWorkResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    comic_id: str
    artist_id: str
    work_type_id: str


def comicwork_to_response(comicwork: ComicWork) -> ComicWorkResponse:
    response: ComicWorkResponse = ComicWorkResponse(
        id=comicwork.id,
        created_date=comicwork.created_date,
        last_modified_date=comicwork.last_modified_date,
        version=comicwork.version,
        comic_id=comicwork.comic_id,
        artist_id=comicwork.artist_id,
        work_type_id=comicwork.work_type_id,
    )
    return response
