import { IUser, IIAMProviderName } from '../../models';
import type { ICredits, ICreditsReservation } from '../../models';
/**
 * Limit to warn about low credits in milliseconds.
 */
export declare const RESERVATION_WARNING_TIME_MS: number;
export type IAMProviderAuthorizationURL = string;
export type IIAMState = {
    /**
     * User credits
     */
    credits?: ICredits & {
        available: number;
    };
    /**
     * User credits reservations
     */
    creditsReservations: ICreditsReservation[];
    /**
     * User token for the external infrastructure
     */
    externalToken?: string;
    /**
     * IAM server base URL.
     */
    iamRunUrl: string;
    /**
     * Mapping of IAM providers and the corresponding Authorization URL.
     */
    iamProvidersAuthorizationURL: Record<IIAMProviderName, IAMProviderAuthorizationURL> | object;
    /**
     * User authenticated to Datalayer.
     */
    user?: IUser;
    /**
     * Authentication token
     */
    token?: string;
    /**
     * IAM service version
     */
    version: string;
    /**
     * Flag to indicate if login is in progress
     */
    isLoginInProgress?: boolean;
};
export type IAMState = IIAMState & {
    addIAMProviderAuthorizationURL: (provider: IIAMProviderName, authorizationURL: IAMProviderAuthorizationURL) => void;
    login: (token: string) => Promise<void>;
    logout: () => void;
    /**
     * Refresh user credits. It also warn if any
     * reservation is getting close to the end.
     */
    refreshCredits: () => Promise<void>;
    checkIAMToken: (token: string) => Promise<void>;
    setIAMProviderAccessToken: (provider: IIAMProviderName, accessToken?: string | null) => void;
    getIAMProviderAccessToken: (user: IUser, provider: IIAMProviderName) => string | undefined;
    refreshUser: () => Promise<void>;
    refreshUserByTokenStored: () => Promise<void>;
    refreshUserByToken: (token: string) => Promise<void>;
    setExternalToken: (externalToken: string) => void;
    setVersion: (version: string) => void;
    /**
     * Set the {@link token} and the {@link user}.
     *
     * The user detail will be automatically retrieve
     * to avoid inconsistency.
     *
     * @param token User token
     */
    setLogin: (user: IUser, token: string) => void;
    updateUser: (user: Partial<Omit<IUser, 'handle'>>) => void;
};
export declare const iamStore: import("zustand").StoreApi<IAMState>;
export declare function useIAMStore(): IAMState;
export declare function useIAMStore<T>(selector: (state: IAMState) => T): T;
export default useIAMStore;
