from datetime import datetime

from pydantic import BaseModel

from src.db.models.tysc import Team


class TeamResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    name: str
    short_name: str
    sport_id: str


def to_response(team: Team) -> TeamResponse:
    response: TeamResponse = TeamResponse(
        id=team.id,
        created_date=team.created_date,
        last_modified_date=team.last_modified_date,
        version=team.version,
        name=team.name,
        short_name=team.short_name,
        sport_id=team.sport_id
    )
    return response
