import { PayloadAction } from '@reduxjs/toolkit';
import { RootState } from '../../../store';
/**
 * Per-connector user-tier authentication state.
 *
 * The resolver on the backend reads three gates: an LD flag,
 * `connector.user_auth_enabled`, and the API's `auth_tier`. When all
 * three open the flow lands at `user_connectors` lookup. This slice
 * mirrors that lookup's result on the client so the right-panel can
 * render the appropriate state without re-hitting the BE on every
 * card mount.
 */
export type UserAuthState = 'unknown' | 'disconnected' | 'in_progress' | 'connected' | 'reauth_required' | 'workspace_mismatch';
export interface UserAuthEntry {
    state: UserAuthState;
    reason?: string;
    externalUserId?: string;
    connectUrl?: string;
    lastChecked?: number;
}
export interface UserAuthSlice {
    byConnectorId: {
        [connectorId: string]: UserAuthEntry;
    };
}
interface StatusReceivedPayload {
    connectorId: string;
    state: UserAuthState;
    reason?: string;
    externalUserId?: string;
}
interface AuthRequiredPayload {
    connectorId: string;
    connectUrl: string;
    reason?: string;
}
interface InProgressPayload {
    connectorId: string;
}
interface CompletedPayload {
    connectorId: string;
    externalUserId?: string;
}
interface FailedPayload {
    connectorId: string;
    reason: string;
}
interface ResetPayload {
    connectorId: string;
}
export declare const userAuthSlice: import('@reduxjs/toolkit').Slice<UserAuthSlice, {
    /**
     * Result of GET /user-auth/status — full picture from the server.
     * Replaces any local in-progress state too: if a poll comes back
     * with `connected` while we thought we were `in_progress`, we
     * adopt the server's view.
     */
    userAuthStatusReceived(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<StatusReceivedPayload>): void;
    /**
     * Fired from the bifrost 412 interceptor. Carries the connect URL
     * so the UI can launch the popup without a separate
     * /user-auth/start round-trip when the user opts to connect.
     * Multiple concurrent 412s for the same connector are naturally
     * deduped because we key on connectorId.
     */
    userAuthRequired(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<AuthRequiredPayload>): void;
    userAuthInProgress(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<InProgressPayload>): void;
    userAuthCompleted(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<CompletedPayload>): void;
    userAuthFailed(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<FailedPayload>): void;
    userAuthReset(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<ResetPayload>): void;
}, "userAuth", "userAuth", import('@reduxjs/toolkit').SliceSelectors<UserAuthSlice>>;
export declare const userAuthStatusReceived: import('@reduxjs/toolkit').ActionCreatorWithPayload<StatusReceivedPayload, "userAuth/userAuthStatusReceived">, userAuthRequired: import('@reduxjs/toolkit').ActionCreatorWithPayload<AuthRequiredPayload, "userAuth/userAuthRequired">, userAuthInProgress: import('@reduxjs/toolkit').ActionCreatorWithPayload<InProgressPayload, "userAuth/userAuthInProgress">, userAuthCompleted: import('@reduxjs/toolkit').ActionCreatorWithPayload<CompletedPayload, "userAuth/userAuthCompleted">, userAuthFailed: import('@reduxjs/toolkit').ActionCreatorWithPayload<FailedPayload, "userAuth/userAuthFailed">, userAuthReset: import('@reduxjs/toolkit').ActionCreatorWithPayload<ResetPayload, "userAuth/userAuthReset">;
declare const _default: import('redux').Reducer<UserAuthSlice>;
export default _default;
export declare const selectUserAuthEntry: (state: RootState, connectorId: string) => UserAuthEntry;
export declare const selectUserAuthState: (state: RootState, connectorId: string) => UserAuthState;
export declare const selectIsUserConnected: (state: RootState, connectorId: string) => boolean;
export declare const selectConnectUrl: (state: RootState, connectorId: string) => string | undefined;
/**
 * Any connector currently in the in_progress state. The modal mounts
 * once at the app level rather than per-card; this selector tells it
 * whether to render.
 */
export declare const selectAnyInProgressConnectorId: (state: RootState) => string | undefined;
//# sourceMappingURL=userAuth.d.ts.map