from typing import List
from fastapi import APIRouter

from src.apis.utils import SessionDep
from src.schema.tysc.sport import SportResponse
from src.db.models.tysc import Sport

router = APIRouter()

@router.get("/sports")
def get_all_sports(db: SessionDep) -> List[SportResponse]:
    results: list[SportResponse] = []
    sports = db.query(Sport).all()
    for sport in sports:
        results.append(SportResponse(id=sport.id, name=sport.name))
    return results
