/**
 * mizan/jwt
 *
 * JWT token management via mizan server functions.
 * Handles token lifecycle: obtain, refresh, clear.
 *
 * ## Quick Start
 *
 * Use JWTContext in authenticated areas (e.g., inside UserRoute):
 *
 * ```tsx
 * import { JWTContext } from 'mizan/jwt'
 * import { UserRoute } from 'mizan/allauth'
 *
 * function ProtectedPage() {
 *     return (
 *         <UserRoute>
 *             <JWTContext>
 *                 <MyProtectedContent />
 *             </JWTContext>
 *         </UserRoute>
 *     )
 * }
 * ```
 *
 * Then use JWT-authenticated requests:
 *
 * ```tsx
 * import { useDjangoCSRClient, Auth } from 'mizan/client/react'
 *
 * function MyProtectedContent() {
 *     const client = useDjangoCSRClient(Auth.JWT)
 *
 *     const fetchData = async () => {
 *         const response = await client.request('GET', '/api/protected/')
 *         return response.json()
 *     }
 * }
 * ```
 *
 * ## How It Works
 *
 * 1. JWTContext calls jwt_obtain server function (via /api/mizan/call/)
 * 2. If not authenticated, returns FORBIDDEN (tokens stay null)
 * 3. Client uses getAccessToken() for Bearer token injection
 * 4. Tokens auto-refresh via jwt_refresh server function
 * 5. On logout, call clearTokens()
 *
 * ## Configuration
 *
 * ```tsx
 * <JWTContext
 *     config={{
 *         endpoint: '/api/mizan/call/',  // default
 *         refreshBuffer: 30,               // refresh 30s before expiry
 *         autoObtain: true,                // obtain on mount
 *         autoRefresh: true,               // auto-refresh before expiry
 *     }}
 * >
 * ```
 *
 * ## Manual Token Management
 *
 * ```tsx
 * import { useJWT } from 'mizan/jwt'
 *
 * function LogoutButton() {
 *     const jwt = useJWT()
 *
 *     const handleLogout = async () => {
 *         await fetch('/api/logout/', { method: 'POST' })
 *         jwt?.clearTokens()
 *     }
 * }
 * ```
 */

export { JWTContext, useJWT, useJWTRequired, useJWTReady } from './JWTContext'
export type { JWTTokens, JWTConfig, JWTState } from '../client/types'
