"""User repository — all user data access via PocketBase."""
from __future__ import annotations

import structlog

import core.pocketbase as pb

log = structlog.get_logger()


class UserRepository:
    """Reads user records from PocketBase."""

    async def get_by_token(self, token: str) -> dict:
        """Validate token and return the user record (with refreshed token).

        Raises httpx.HTTPStatusError on invalid/expired token.
        """
        return await pb.get_user_by_token(token)
