"""Tools resource — utility APIs like TOTP 2FA generation."""
from __future__ import annotations

from .._http import HttpClient


class ToolsResource:
    def __init__(self, http: HttpClient):
        self._http = http

    def generate_2fa(self, secret: str) -> dict:
        """
        Generate a TOTP 2FA code from a Base32 secret key.

        Args:
            secret: Base32 2FA backup key. Spaces and dashes are automatically stripped.

        Returns:
            dict: ``{ code: str, timeRemaining: int }``
                  ``timeRemaining`` is how many seconds until this code expires (0–30).
        """
        return self._http.post("/v1/tools/2fa/generate", {"secret": secret})
