import * as react from 'react';
import { ReactNode } from 'react';

declare const workOsOrgIdBrand: unique symbol;
/** A WorkOS organization id (`org_...`) -- the auth identity for API/SSE/query keys. */
type WorkOsOrgId = string & {
    readonly [workOsOrgIdBrand]: true;
};

interface AuthContextValue {
    user: {
        id: string;
    } | null;
    isLoading: boolean;
    getAccessToken: () => Promise<string>;
    organizationId?: WorkOsOrgId | null;
    /**
     * Trigger WorkOS AuthKit's sign-in flow (redirect to WorkOS hosted auth page).
     * Used by ProtectedRoute for auto-recovery when `canRecover()` returns true.
     */
    signIn: (options?: {
        state?: {
            returnTo?: string;
        };
    }) => void;
    /**
     * Returns true when a previous session can be recovered (refresh token
     * exists in storage). ProtectedRoute calls `signIn()` only when this returns
     * true; otherwise it navigates to the login page.
     *
     * Explicit logout clears the stored token, so canRecover() returns false
     * and the user sees the login page as expected.
     */
    canRecover: () => boolean;
}
declare function useAuthContext(): AuthContextValue;
declare function AuthProvider({ value, children }: {
    value: AuthContextValue;
    children: ReactNode;
}): react.FunctionComponentElement<react.ProviderProps<AuthContextValue | null>>;

export { AuthProvider, useAuthContext };
export type { AuthContextValue };
