import { LoginSession, LoginSessionState } from "@authhero/adapter-interfaces";
/**
 * Context for the login session state machine
 */
export interface LoginSessionContext {
    /** User ID once identified */
    userId?: string;
    /** Error/failure reason if login failed */
    failureReason?: string;
    /** Hook/flow ID if waiting for completion */
    hookId?: string;
    /** Continuation scope - which pages are allowed during AWAITING_CONTINUATION */
    continuationScope?: string[];
    /** Additional state data */
    stateData?: Record<string, unknown>;
}
/**
 * Event types for the login session state machine
 */
export declare enum LoginSessionEventType {
    AUTHENTICATE = "AUTHENTICATE",
    REQUIRE_EMAIL_VERIFICATION = "REQUIRE_EMAIL_VERIFICATION",
    REQUIRE_MFA = "REQUIRE_MFA",
    COMPLETE_MFA = "COMPLETE_MFA",
    START_HOOK = "START_HOOK",
    COMPLETE_HOOK = "COMPLETE_HOOK",
    START_CONTINUATION = "START_CONTINUATION",
    COMPLETE_CONTINUATION = "COMPLETE_CONTINUATION",
    COMPLETE = "COMPLETE",
    FAIL = "FAIL",
    EXPIRE = "EXPIRE"
}
/**
 * Events that can trigger state transitions
 */
export type LoginSessionEvent = {
    type: LoginSessionEventType.AUTHENTICATE;
    userId: string;
} | {
    type: LoginSessionEventType.REQUIRE_EMAIL_VERIFICATION;
} | {
    type: LoginSessionEventType.REQUIRE_MFA;
} | {
    type: LoginSessionEventType.COMPLETE_MFA;
} | {
    type: LoginSessionEventType.START_HOOK;
    hookId?: string;
} | {
    type: LoginSessionEventType.COMPLETE_HOOK;
} | {
    type: LoginSessionEventType.START_CONTINUATION;
    scope: string[];
} | {
    type: LoginSessionEventType.COMPLETE_CONTINUATION;
} | {
    type: LoginSessionEventType.COMPLETE;
} | {
    type: LoginSessionEventType.FAIL;
    reason: string;
} | {
    type: LoginSessionEventType.EXPIRE;
};
/**
 * Login session state machine
 *
 * The AUTHENTICATED state acts as a "hub" that decides the next requirement.
 * After completing hooks or continuations, the flow returns to AUTHENTICATED
 * so the backend can check if additional steps are needed.
 *
 * Flow examples:
 *   pending → authenticated → completed (simple login)
 *   pending → authenticated → awaiting_email_verification → authenticated → completed
 *   pending → authenticated → awaiting_mfa → authenticated → completed
 *   pending → authenticated → awaiting_hook → authenticated → awaiting_continuation → authenticated → completed
 *
 * Any non-final state can transition to failed or expired.
 *
 * States:
 * - pending: Initial state, awaiting user authentication
 * - authenticated: Credentials validated - hub state that decides next steps
 * - awaiting_email_verification: Blocked on email verification
 * - awaiting_mfa: Waiting for MFA verification (SMS, TOTP, etc.)
 * - awaiting_hook: Waiting for hook/flow completion (form, page, impersonate)
 * - awaiting_continuation: Waiting for user to complete action on account page
 * - completed: Tokens issued successfully (final)
 * - failed: Authentication failed (final)
 * - expired: Session timed out (final)
 */
export declare const loginSessionMachine: import("xstate").StateMachine<LoginSessionContext, {
    type: LoginSessionEventType.AUTHENTICATE;
    userId: string;
} | {
    type: LoginSessionEventType.REQUIRE_EMAIL_VERIFICATION;
} | {
    type: LoginSessionEventType.REQUIRE_MFA;
} | {
    type: LoginSessionEventType.COMPLETE_MFA;
} | {
    type: LoginSessionEventType.START_HOOK;
    hookId?: string;
} | {
    type: LoginSessionEventType.COMPLETE_HOOK;
} | {
    type: LoginSessionEventType.START_CONTINUATION;
    scope: string[];
} | {
    type: LoginSessionEventType.COMPLETE_CONTINUATION;
} | {
    type: LoginSessionEventType.COMPLETE;
} | {
    type: LoginSessionEventType.FAIL;
    reason: string;
} | {
    type: LoginSessionEventType.EXPIRE;
}, {}, never, {
    type: "setUserId";
    params: import("xstate").NonReducibleUnknown;
} | {
    type: "setHookId";
    params: import("xstate").NonReducibleUnknown;
} | {
    type: "clearHookId";
    params: import("xstate").NonReducibleUnknown;
} | {
    type: "setContinuationScope";
    params: import("xstate").NonReducibleUnknown;
} | {
    type: "clearContinuationScope";
    params: import("xstate").NonReducibleUnknown;
} | {
    type: "setFailureReason";
    params: import("xstate").NonReducibleUnknown;
}, never, never, "expired" | "pending" | "failed" | "authenticated" | "awaiting_email_verification" | "awaiting_mfa" | "awaiting_hook" | "awaiting_continuation" | "completed", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
    id: "loginSession";
    states: {
        readonly pending: {};
        readonly authenticated: {};
        readonly awaiting_email_verification: {};
        readonly awaiting_mfa: {};
        readonly awaiting_hook: {};
        readonly awaiting_continuation: {};
        readonly completed: {};
        readonly failed: {};
        readonly expired: {};
    };
}>;
/**
 * Transition a login session and return the new state
 *
 * Uses XState's transition for a single source of truth - the machine
 * definition determines all valid transitions.
 */
export declare function transitionLoginSession(currentState: LoginSessionState, event: LoginSessionEvent, context?: LoginSessionContext): {
    state: LoginSessionState;
    context: Partial<LoginSessionContext>;
};
/**
 * Check if a login session can transition with the given event
 *
 * Uses XState's transition - if the state changes, the transition is valid.
 */
export declare function canTransition(currentState: LoginSessionState, eventType: LoginSessionEvent["type"], context?: LoginSessionContext): boolean;
/**
 * Helper to transition from a LoginSession object
 */
export declare function transitionLoginSessionFromEntity(loginSession: LoginSession, event: LoginSessionEvent): {
    state: LoginSessionState;
    context: Partial<LoginSessionContext>;
};
/**
 * Get valid events for a given state
 */
export declare function getValidEvents(currentState: LoginSessionState): LoginSessionEventType[];
