from datetime import datetime

from pydantic import BaseModel

from src.db.models.comic import WorkType

class AddWorkType(BaseModel):
    worktype: str

class WorktypeResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    name: str


def worktype_to_response(worktype: WorkType) -> WorktypeResponse:
    response: WorktypeResponse = WorktypeResponse(
        id=worktype.id,
        created_date=worktype.created_date,
        last_modified_date=worktype.last_modified_date,
        version=worktype.version,
        name=worktype.name
    )
    return response
