"""Statistics endpoints."""
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session

from ...models.database import get_db
from ...models import crud

router = APIRouter()


@router.get("")
async def get_stats(db: Session = Depends(get_db)):
    """Get database statistics.

    Args:
        db: Database session

    Returns:
        Statistics including:
        - Total tracks
        - Genre distribution
        - Mood distribution
        - Average BPM
        - Total duration
    """
    stats = crud.get_stats(db)

    return stats
