import { D as DrizzleAuthService, U as UserInfo, S as SessionInfo } from '../../drizzle-auth-service-Bxlovhv8.js';
import '../../enums-Dume-V5Y.js';
import 'drizzle-orm/pg-core';

/**
 * Auth Middleware - Types
 * 认证中间件类型定义
 */

/**
 * 认证级别
 */
type AuthLevel = 'none' | 'user' | 'admin' | 'super_admin';
/**
 * 路由上下文
 */
interface RouteContext {
    /**
     * 用户信息（认证后注入）
     */
    user?: UserInfo;
    /**
     * 会话信息（认证后注入）
     */
    session?: SessionInfo;
    /**
     * 路由参数
     */
    params?: any;
}
/**
 * 路由处理器
 */
type RouteHandler = (request: Request, context: RouteContext) => Promise<Response>;
/**
 * 认证中间件配置
 */
interface AuthMiddlewareConfig {
    /**
     * 认证服务实例
     */
    authService: DrizzleAuthService;
}

/**
 * Auth Middleware - withAuth
 * 认证中间件
 */

/**
 * 创建认证中间件
 *
 * @example
 * ```typescript
 * import { createAuthMiddleware } from '@qhr123/sa2kit/auth/middleware';
 *
 * const { withAuth, requireAdmin } = createAuthMiddleware({
 *   authService: myAuthService,
 * });
 *
 * // 使用中间件
 * export const GET = requireAdmin(async (request, context) => {
 *   const { user } = context; // 自动注入用户信息
 *   // ... 业务逻辑
 * });
 * ```
 */
declare function createAuthMiddleware(config: AuthMiddlewareConfig): {
    withAuth: (handler: RouteHandler, level?: AuthLevel) => RouteHandler;
    requireAuth: (handler: RouteHandler) => RouteHandler;
    requireAdmin: (handler: RouteHandler) => RouteHandler;
    requireSuperAdmin: (handler: RouteHandler) => RouteHandler;
};

export { type AuthLevel, type AuthMiddlewareConfig, type RouteContext, type RouteHandler, createAuthMiddleware };
