"""
Model definitions for IssueWork.
"""

from datetime import datetime

from pydantic import BaseModel

from src.db.models.comic import IssueWork


class IssueWorkResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    issue_id: str
    artist_id: str
    work_type_id: str


def issuework_to_response(issuework: IssueWork) -> IssueWorkResponse:
    response: IssueWorkResponse = IssueWorkResponse(
        id=issuework.id,
        created_date=issuework.created_date,
        last_modified_date=issuework.last_modified_date,
        version=issuework.version,
        issue_id=issuework.issue_id,
        artist_id=issuework.artist_id,
        work_type_id=issuework.work_type_id,
    )
    return response
