import { DriverOptions } from '@analog-tools/session';
import { H3Event } from 'h3';
/**
 * Represents an authentication route with a path and handler function
 */
export type AuthRoute = {
    /**
     * The path of the route relative to the auth base path
     */
    path: string;
    /**
     * The handler function for the route that processes H3Event objects
     */
    handler: (event: H3Event) => Promise<any> | any;
};
type StorageBasicConfig = {
    ttl?: number;
    prefix?: string;
    sessionSecret?: string | string[];
    cookieName?: string;
};
type RedisBasicConfig = {
    tls?: boolean;
};
type RedisConnectionConfig = {
    host: string;
    port: number | string;
    username?: string;
    password?: string;
    db?: number;
};
type RedisUrlConfig = {
    url: string;
};
/**
 * Redis session storage configuration
 */
export type RedisSessionConfig = StorageBasicConfig & RedisBasicConfig & (RedisUrlConfig | RedisConnectionConfig);
/**
 * Memory session storage configuration
 */
export type MemorySessionConfig = StorageBasicConfig;
/**
 * Cookie session storage configuration
 */
export type CookieSessionConfig = StorageBasicConfig & {
    maxAge?: number;
    secure?: boolean;
    sameSite?: 'strict' | 'lax' | 'none';
    domain?: string;
    path?: string;
};
/**
 * Type-safe session storage configuration using discriminated union
 */
export type SessionStorageConfig = StorageBasicConfig & {
    driver: DriverOptions;
};
export type UserHandler = {
    mapUserToLocal?: <T>(user: T) => Promise<any> | any;
    createOrUpdateUser?: <T>(user: T) => Promise<any>;
};
/**
 * Configuration for analog auth
 */
export type AnalogAuthConfig = {
    issuer: string;
    clientId: string;
    clientSecret: string;
    audience?: string;
    scope: string;
    callbackUri: string;
    tokenRefreshApiKey?: string;
    unprotectedRoutes?: string[];
    logoutUrl?: string;
    /**
     * Timeout in milliseconds for fetching the OpenID discovery document
     * (`{issuer}/.well-known/openid-configuration`). Default: `10000` (10s).
     */
    discoveryTimeoutMs?: number;
    /**
     * Optional security policy: if true, a successful login invalidates
     * other authenticated sessions for the same user identity.
     * Default: false (allow multiple device/browser sessions).
     */
    singleSessionPerUser?: boolean;
    /**
     * Session storage configuration with type-safe mapping between
     * storage type and corresponding configuration
     */
    sessionStorage: SessionStorageConfig;
    userHandler?: UserHandler;
};
export {};
