from datetime import datetime

from pydantic import BaseModel

from src.db.models.tysc import FieldPosition


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


def to_response(fieldposition: FieldPosition) -> FieldPositionResponse:
    response: FieldPositionResponse = FieldPositionResponse(
        id=fieldposition.id,
        created_date=fieldposition.created_date,
        last_modified_date=fieldposition.last_modified_date,
        version=fieldposition.version,
        name=fieldposition.name,
        short_name=fieldposition.short_name,
        sport_id=fieldposition.sport_id
    )
    return response
