from datetime import datetime

from pydantic import BaseModel

from src.db.models.tysc import Player


class PlayerResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    first_name: str
    last_name: str

def to_response(player: Player) -> PlayerResponse:
    response: PlayerResponse = PlayerResponse(
            id=player.id,
            created_date=player.created_date,
            last_modified_date=player.last_modified_date,
            version=player.version,
            first_name=player.first_name,
            last_name=player.last_name
    )
    return response
