/**
 * BetterAuth Request Type
 *
 * BetterAuth expects a Request object compatible with the Fetch API standard.
 * This extends the web standard Request interface with additional properties
 * that may be present in the Express request object at runtime.
 */

import type { AuthUser } from "@mosaic/shared";

// Re-export AuthUser for use in other modules
export type { AuthUser };

/**
 * Session data stored in request after authentication
 */
export interface RequestSession {
  id: string;
  token: string;
  expiresAt: Date;
  [key: string]: unknown;
}

/**
 * Web standard Request interface extended with Express-specific properties
 * This matches the Fetch API Request specification that BetterAuth expects.
 */
export interface BetterAuthRequest extends Request {
  // Express route parameters
  params?: Record<string, string>;

  // Express query string parameters
  query?: Record<string, string | string[]>;

  // Session data attached by AuthGuard after successful authentication
  session?: RequestSession;

  // Authenticated user attached by AuthGuard
  user?: AuthUser;
}
