import { type ReactNode } from "react";
import type { Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
/** Value exposed by {@link OrgProvider} via {@link useOrg}. */
export interface OrgContextValue {
    /** All organizations the authenticated user belongs to. */
    readonly orgs: Organization[];
    /** The currently selected organization. Null while loading or if the user has no orgs. */
    readonly activeOrg: Organization | null;
    /** Switch the active organization. Persisted to localStorage. */
    readonly setActiveOrg: (org: Organization) => void;
    /** True during the initial fetch of organizations. */
    readonly isLoading: boolean;
    /** Non-null when the fetch failed. */
    readonly error: string | null;
    /** Re-attempt the organization fetch after a failure. */
    readonly retry: () => void;
    /**
     * Refetch the organization list. If `targetSlug` is provided, the
     * org matching that slug will be auto-selected after the fetch
     * completes (useful after creating a new organization).
     */
    readonly refresh: (targetSlug?: string) => void;
}
/**
 * Provides organization context to the component tree.
 *
 * Fetches the authenticated user's organizations via
 * `stigmer.organization.findMyOrganizations()`, manages the active
 * organization selection, and persists the choice to `localStorage`
 * under the key `stigmer:activeOrgSlug`.
 *
 * Must be rendered inside a {@link StigmerProvider}.
 *
 * @example
 * ```tsx
 * <StigmerProvider client={client}>
 *   <OrgProvider>
 *     <App />
 *   </OrgProvider>
 * </StigmerProvider>
 * ```
 */
export declare function OrgProvider({ children }: {
    children: ReactNode;
}): import("react/jsx-runtime").JSX.Element;
/**
 * Access the active organization context from the nearest
 * {@link OrgProvider}.
 *
 * Throws if called outside an `<OrgProvider>` — this surfaces wiring
 * mistakes immediately during development.
 */
export declare function useOrg(): OrgContextValue;
/**
 * Convenience accessor: returns the active org's slug for use in API
 * calls, or an empty string when no org is selected.
 */
export declare function useActiveOrgSlug(): string;
//# sourceMappingURL=OrgProvider.d.ts.map