"""Users router — authenticated user profile endpoint."""
from fastapi import APIRouter, Depends

from dependencies import get_current_user_or_401

router = APIRouter(prefix='/api', tags=['users'])


@router.get('/users/me')
async def get_me(user: dict = Depends(get_current_user_or_401)):
    """Return the current user's profile and credit balance."""
    return {
        'id': user.get('id'),
        'email': user.get('email'),
        'name': user.get('name', ''),
        'credits_balance': user.get('credits_balance', 0),
        'free_used': user.get('free_used', False),
    }
