from datetime import datetime
from typing import Optional

from src.db.models.media import MediaActorFile
from pydantic import BaseModel


class MediaActorFileResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    media_actor_id: str
    media_file_id: Optional[str]

def actorfile_to_response(actorfile:  MediaActorFile) -> MediaActorFileResponse:
    response: MediaActorFileResponse = MediaActorFileResponse(
            id=actorfile.id,
            created_date=actorfile.created_date,
            last_modified_date=actorfile.last_modified_date,
            version=actorfile.version,
            media_actor_id=actorfile.media_actor_id,
            media_file_id=actorfile.media_file_id
    )
    return response


class MediaActorFileModel(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    media_actor_id: str
    media_file_id: Optional[str]
    