from datetime import datetime
from typing import Optional

from pydantic import BaseModel

from src.db.models.media import MediaVideo

class MediaVideoResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    cloud_link: Optional[str] = None
    file_name: Optional[str] = None
    path: Optional[str] = None
    review: bool = False
    title: Optional[str] = None
    url: Optional[str] = None
    should_download: bool = False

class AddLink(BaseModel):
    url: str

def video_to_response(video: MediaVideo) -> MediaVideoResponse:
    response: MediaVideoResponse = MediaVideoResponse(
        id=video.id,
        created_date=video.created_date,
        last_modified_date=video.last_modified_date,
        version=video.version,
        cloud_link=video.cloud_link,
        file_name=video.file_name,
        path=video.path,
        review=video.review,
        title=video.title,
        url=video.url,
        should_download=video.should_download
    )
    return response
