/**
 * Session Service
 * Handles session management for the auth module
 */
import type { AuthAdapter, Session, SessionWithUser, User, Role } from "../types.js";
export interface SessionConfig {
    /**
     * Session expiration time in seconds
     * @default 604800 (7 days)
     */
    expiresIn?: number;
    /**
     * How often to update session (in seconds)
     * @default 86400 (1 day)
     */
    updateAge?: number;
    /**
     * Whether to refresh the session cookie
     * @default true
     */
    cookieRefresh?: boolean;
}
export interface SessionService {
    /**
     * Generate a session token
     */
    generateToken(): string;
    /**
     * Create a new session for a user
     */
    createSession(data: {
        user: User;
        tenantId?: string | null;
        ipAddress?: string | null;
        userAgent?: string | null;
        type?: string;
    }): Promise<Session>;
    /**
     * Validate a session token
     */
    validateSession(token: string): Promise<SessionWithUser | null>;
    /**
     * Invalidate a session
     */
    invalidateSession(token: string): Promise<void>;
    /**
     * Invalidate all sessions for a user
     */
    invalidateAllSessions(userId: string): Promise<void>;
    /**
     * List all sessions for a user
     */
    listSessions(userId: string): Promise<Session[]>;
    /**
     * Update session (extend expiration)
     */
    updateSession(sessionId: string): Promise<Session | null>;
    /**
     * Clean up expired sessions
     */
    cleanupExpiredSessions(userId: string): Promise<void>;
    /**
     * Count active sessions by type
     */
    countSessionsByType(userId: string, type: string, tenantId?: string | null): Promise<number>;
}
export declare function createSessionService(adapter: AuthAdapter, config?: SessionConfig): SessionService;
/**
 * Session Limit Validation
 */
export interface SessionLimitConfig {
    mobile_session_limit?: number;
    web_session_limit?: number;
    session_limit_roles?: string[];
}
export declare function validateSessionLimits(sessionService: SessionService, userId: string, sessionType: string, tenantId?: string | null, role?: Role | null, config?: SessionLimitConfig): Promise<{
    isValid: boolean;
    error?: string;
}>;
export default createSessionService;
//# sourceMappingURL=session.d.ts.map