from datetime import datetime
from typing import Optional

from pydantic import BaseModel

from src.db.models.comic import Artist


class ArtistCreation(BaseModel):
    id: str
    name: str

class ArtistResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    name: str
    weblink: Optional[str]

def artist_to_response(artist:  Artist) -> ArtistResponse:
    response: ArtistResponse = ArtistResponse(
            id=artist.id,
            created_date=artist.created_date,
            last_modified_date=artist.last_modified_date,
            version=artist.version,
            name=artist.name,
            weblink=artist.weblink
    )
    return response


class AddArtist(BaseModel):
    id: str
    name: str
